Skip to content

Loading…

DDC-2526: ORM does not see one filed when run from Symfonys app/console #3249

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user gog:

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.

@doctrinebot

Comment created by gog:

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.

@doctrinebot

Issue was closed with resolution "Invalid"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.