[DDC-2526] ORM does not see one filed when run from Symfonys app/console Created: 24/Jun/13  Updated: 30/Jul/13  Resolved: 30/Jul/13

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

Type: Bug Priority: Major
Reporter: Goran Juric Assignee: Benjamin Eberlei
Resolution: Invalid Votes: 0
Labels: None


 Description   

I am in the process of moving my code base from ZF1 to Symfony2. For ZF1 I used a custom console for running Doctrines CLI.

When I run Doctrine from my ZF1 branch I get:

application/console orm:schema-tool:update --dump-sql
Nothing to update - your database is already in sync with the current entity metadata.

But if I run this on my SF2 branch through Symfonys console I get:

app/console doctrine:schema:update --dump-sql
ALTER TABLE profile DROP allowed_protocols

I have 15 entites, and this occurs only for this one filed in one entity. The field is defined as:

    /**
     * @ORM\Column(type="integer", nullable=true)
     * @var integer
     */
    protected $allowed_protocols;

If I change the name of the field (add or remove a letter in the name of the variable) Doctrine starts recognizing it in both CLI applications.

This sounds very strange to me and I do not know where to start digging since the Doctrine versions are the same in both branches, as well as the entites.



 Comments   
Comment by Goran Juric [ 30/Jul/13 ]

Finally found the solution, the entity had two properties:

class Entity
{
    // not persisted
    public static $VAR_NAME = 'something';

    /**
     * @ORM\Column(type="integer", nullable=true)
     * @var integer
     */
    protected $var_name;
}

The issue was that the variables had the same name, but one was static and uppercase, and another one was protected and private.

I still do not know why parsing the same entity produced different result depending on how Doctrine 2 was bootstraped, but at least I found the solution to my problem.

Generated at Fri Oct 24 12:48:57 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.