Getting a “true” object from a proxy object in doctrine2

This is unlikely to help in the specific instance for the question, since you’re relying on a third-party module, but you can prevent the lazy loading by setting the “fetch mode” for your entity to “EAGER”.

User:
    ManyToOne:
        city:
            fetch: EAGER

This can also be handled by annotations:

@ManyToOne(targetEntity="city", fetch="EAGER")
@JoinColumn(name="city", referencedColumnName="id")

See http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/annotations-reference.html#annref-manytoone

None of the other answers I’ve seen here worked for me.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)