[DDC-2671] YAML mapping: entity generation with inheritance does work Created: 11/Sep/13  Updated: 11/Sep/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.4.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Peter Tulala Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: inheritance, mapping, yaml


 Description   

Entities inherited from parent entities should be defined as class Foo extends Bar. However YAML driver ignores inheritance hierarchy and does not use "extends" keyword at all.






[DDC-2669] YAML mapping: discriminator map exception Created: 10/Sep/13  Updated: 10/Sep/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.4.1
Fix Version/s: None
Security Level: All

Type: Bug Priority: Minor
Reporter: Peter Tulala Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: mapping, yaml


 Description   

I'm getting this exception when I generate all entities from YAML using orm:generate-entities:

[Doctrine\ORM\Mapping\MappingException]
Entity class 'Entity\PersonIndividual' used in the discriminator map of class 'Entity\Person' does not exist.

My discriminator map defined in Entity.Person.dcm.yml:

discriminatorMap:
  1: PersonIndividual
  2: PersonCompany
  3: PersonSelfEmployed

Mapping driver probably generates entities in wrong order, so entities defined in discriminator map does not exist when entity Person is being generated.

Note: The easiest workaround is to temporarily remove discriminatorMap definition from entity, generate entities, then put discriminatorMap back and then generate entities again. It would be great if it would be possible to generate all entities in only one step.






[DDC-2632] Doctrine reverse engineer doesn't honor NOT NULL foreign keys Created: 24/Aug/13  Updated: 24/Aug/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: 2.3.4
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Paolo Avezzano Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: engineer, mysql, null, nullable, reverse, yaml
Environment:

MAMP, latest version. Symfony up to date



 Description   

In this table, the two foreign keys (which I had to downgrade from primary keys because of Doctrine and then added a separate PK named 'Id') called 'Oggetto' and 'Sistema' have been set as NOT NULL.


-- -----------------------------------------------------
-- Table `mydb`.`Composizione`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`Composizione` ;

CREATE  TABLE IF NOT EXISTS `mydb`.`Composizione` (
  `Id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `Oggetto` INT UNSIGNED NOT NULL ,
  `Sistema` INT NOT NULL ,
  INDEX `fk_Oggetto_has_Sistema_Sistema1_idx` (`Sistema` ASC) ,
  INDEX `fk_Oggetto_has_Sistema_Oggetto1_idx` (`Oggetto` ASC) ,
  PRIMARY KEY (`Id`) ,
  CONSTRAINT `fk_Oggetto_has_Sistema_Oggetto1`
    FOREIGN KEY (`Oggetto` )
    REFERENCES `mydb`.`Oggetto` (`Id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Oggetto_has_Sistema_Sistema1`
    FOREIGN KEY (`Sistema` )
    REFERENCES `mydb`.`Sistema` (`Id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;

Converting into Yaml here it is what I get.

    type: entity
    table: Composizione
    fields:
        id:
            id: true
            type: integer
            unsigned: true
            nullable: false
            column: Id
            generator:
                strategy: IDENTITY
    manyToOne:
        oggetto:
            targetEntity: Oggetto
            cascade:      {  }
            mappedBy:     null
            inversedBy:   null
            joinColumns:
                Oggetto:
                    referencedColumnName: Id
            orphanRemoval: false
        sistema:
            targetEntity: Sistema
            cascade:      {  }
            mappedBy:     null
            inversedBy:   null
            joinColumns:
                Sistema:
                    referencedColumnName: Id
            orphanRemoval: false
    lifecycleCallbacks: {  }

Basically it lost in translation the NOT NULL part.
To make it work I had to manually add two "nullable: false" lines as I did below:

    type: entity
    table: Composizione
    fields:
        id:
            id: true
            type: integer
            unsigned: true
            nullable: false
            column: Id
            generator:
                strategy: IDENTITY
    manyToOne:
        oggetto:
            targetEntity: Oggetto
            cascade:      {  }
            mappedBy:     null
            inversedBy:   null
            joinColumns:
                Oggetto:
                    referencedColumnName: Id
                    nullable:     false
            orphanRemoval: false
        sistema:
            targetEntity: Sistema
            cascade:      {  }
            mappedBy:     null
            inversedBy:   null
            joinColumns:
                Sistema:
                    referencedColumnName: Id
                    nullable:     false
            orphanRemoval: false
    lifecycleCallbacks: {  }

Is it a bug or am I missing something?

Regards,
Paolo Avezzano






[DDC-2199] Yaml driver does not take into account field @Version attribute Created: 14/Dec/12  Updated: 16/Dec/12  Resolved: 16/Dec/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: Git Master
Fix Version/s: 2.3.2
Security Level: All

Type: Bug Priority: Blocker
Reporter: Georgy Galakhov Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: mapping, yaml


 Description   

Even if field has version: true attribute, Yaml driver does not set class metadata isVersioned and versionField properties. As a result optimistic lock cannot be used.



 Comments   
Comment by Benjamin Eberlei [ 16/Dec/12 ]

Fixed





[DDC-2136] convert-mapping can't create YML from Annotation when Id column is a OneToOne relationship Created: 11/Nov/12  Updated: 01/May/13  Resolved: 01/May/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.3
Fix Version/s: 2.4

Type: Bug Priority: Minor
Reporter: Gergely Polonkai Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: yaml
Environment:

Symfony 2.1.3



 Description   

I have two entities

/**

  • @ORM\Entity
    */
    class User { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ private $id }

/**

  • @ORM\Entity
    */
    class UserData { /** * @ORM\Id * @ORM\OneToOne(targetEntity="User") */ private $id }

When I convert these with symfony's

doctrine:mapping:convert yml test/

it generates an entity definition for UserData without any id fields, which, of course, cannot be imported to the database, as the new entity doesn't have an identifier column.



 Comments   
Comment by Benjamin Eberlei [ 01/May/13 ]

Fixed in 2.4





[DDC-2069] Spaces are not ignored in the "column" list of a uniqueConstraints Created: 12/Oct/12  Updated: 09/Nov/12  Resolved: 21/Oct/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers
Affects Version/s: 2.3
Fix Version/s: 2.3.1
Security Level: All

Type: Bug Priority: Minor
Reporter: Matthieu Napoli Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: yaml


 Description   

In a YAML configuration file

Behavior correct for this:

  uniqueConstraints:
    myConstraint:
      columns: column1,column2

However, if I add a space in the "columns" list:

  uniqueConstraints:
    myConstraint:
      columns: column1, column2

I end up with the following exception:

exception 'Doctrine\DBAL\Schema\SchemaException' with message 'There is no column with name ' column2' on table 'myTable'.

This can be very confusing, especially if (by any chance) you have a line return just on the space in the command line: you never see the space in the exception message.

It seems that YAML allows spaces in lists (http://en.wikipedia.org/wiki/YAML#Lists), but this line doesn't seem to be a YAML list. If it is parsed by Doctrine (split on ","), spaces should be ignored (or trimmed).



 Comments   
Comment by Matthieu Napoli [ 17/Oct/12 ]

Note that using the correct YAML format works:

uniqueConstraints:
    myConstraint:
      columns: [column1, column2]

So it's confusing to have 2 possibilities to write the same thing, and that they don't behave the same.

Comment by Fabio B. Silva [ 21/Oct/12 ]

Fixed by : https://github.com/doctrine/doctrine2/commit/814f2f9e039caf712b75af7f61d28c361189bcab





Generated at Fri Aug 01 12:11:04 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.