Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0.0BETA1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      CentOS 5.5, PHP 5.3

      Description

      It looks like that "name" attribute is not supported anymore in @Field annotation

      http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/reference/annotations-reference/en#ann_field
      > name - By default the property name is used for the mongodb field name also, however the 'name' attribute allows you to specify the field name.

      For instance the code below produces a document inside "mydocs" collection which has only one property "first_name" instead of two:

      /** @Document(collection="mydocs") */
      class MyDocument
      {
      /** @Id */
      public $id;

      /** @Field(type="string") */
      public $first_name;

      /** @Field(type="string", name="last_name") */
      protected $_last_name;

      public function __get($propertyName)
      {
      return $this->

      {'_'.$propertyName};
      }

      public function __set($propertyName, $propertyValue)
      {
      $this->{'_'.$propertyName}

      = $propertyValue;
      }
      }

      $doc = new MyDocument();
      $doc->first_name = 'aaa';
      $doc->last_name = 'bbb';
      dm()->persist($doc);
      dm()->flush();

        Activity

        Hide
        Jonathan H. Wage added a comment -

        I added a test here for your issue and it appears to be working properly in the latest master in git.

        https://github.com/doctrine/mongodb-odm/commit/cb1cbd2e81b8912dd5959f1d6275443679959a86

        Show
        Jonathan H. Wage added a comment - I added a test here for your issue and it appears to be working properly in the latest master in git. https://github.com/doctrine/mongodb-odm/commit/cb1cbd2e81b8912dd5959f1d6275443679959a86

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Vitaliy Kaplich
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: