DDC-1437: Strange behavior with proxied classes,expected to get entity, but returned identifier. #2063

doctrinebot opened this Issue Oct 19, 2011 · 3 comments

2 participants


Jira issue originally created by user goetas:

I have the following xml mapping:

  <entity name="User" table="user">
    <id name="id" type="integer" column="id">
      <generator strategy="SEQUENCE"/>
    <field name="name" type="string" column="name"/>

  <entity name="SuperUser" table="superuser">

    <id name="user" type="integer" column="user_id" association-key="true"/>

    <one-to-one field="user" target-entity="User">
        <join-column name="user_id" referenced-column-name="id"/>


From this mapping i have generated the php classes.

In my application, when the SuperUser class is proxied, SuperUser::getUser() method looks like this:

public function getUser(){

        if ($this->*_isInitialized_* === false) {
            return $this->_identifier["user"];
        return parent::getUser();

When i call $usperuser->getUser() the expected return value is the User class instance; but the current implementation returns only user id (contained in $this->_identifier["user"]).

In this behavior is also involved private function ProxyFactory::isShortIdentifierGetter($method, $class)

Some solutions proposed by me, can be:

  • remove this behavior
  • during proxy generation, add in this case a method called getUserId, and this method can return user id (but in this case, the behavior continues to be strange because is available only for proxied classes).

(sorry for my english)


Comment created by @beberlei:

very recent bug in master, i will fix it.


Comment created by @beberlei:

fixed in master


Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.2 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment