Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: 2.0-ALPHA3
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:

      Description

      I'm have some problems when I try to persist..
      I've created these classes:

      class Customer
      {
          public $id;
          public $users;
      
          public function __construct()
          {
              $this->users = new \Doctrine\Common\Collections\ArrayCollection();
          }
      }
      
      class User
      {
          public $id;
          public $customer;
      }
      
      

      And then I make the mappers with YAML

      Ciutat\DomainModel\Customer:
        type: entity
        table: customer
        fields:
          id:
            type: integer
            id: true
            generator:
              strategy: auto
            sequenceGenerator:
              sequenceName: customer_id_seq
              allocationSize: 1
              initialValue: 1
        oneToMany:
          users:
            targetEntity: User
            mappedBy: customer
            cascade: cascadePersist
      
      Ciutat\DomainModel\User:
        type: entity
        table: user1
        fields:
          id:
            type: integer
            id: true
            generator:
              strategy: auto
            sequenceGenerator:
              sequenceName: user1_id_seq
              allocationSize: 1
              initialValue: 1
        manyToOne:
          customer:
            targetEntity: Customer
            joinColumn:
              name: customerId
              referencedColumnName: id
      

      And when I try to persist some data

      $costumer = new DomainModel\Customer();
      $user = new DomainModel\User();
      $user2 = new DomainModel\User();
      $user3 = new DomainModel\User();
      
      $costumer->users->add($user);
      $costumer->users->add($user2);
      $costumer->users->add($user3);
          
      $em->persist($costumer);
      $em->flush();
      

      the result in my database is not what I think it must be expected

      select * from customer;
       id 
      ----
        1
      
      elect * from user1;
       id | customerid 
      ----+------------
        1 |           
        2 |           
        3 |           
      
      

      I would like to know if have some mistake with my code or is there a problem with YAML? 'cause I think there should be some data on 'customerId', don't I ?

        Activity

        Henrique Girardi dos Santos created issue -
        Henrique Girardi dos Santos made changes -
        Field Original Value New Value
        Summary YAML isn't persisting YAML isn't persisting correcty
        Roman S. Borschel made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 10668 ] jira-feedback [ 14215 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14215 ] jira-feedback2 [ 16079 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16079 ] jira-feedback3 [ 18332 ]

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Henrique Girardi dos Santos
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: