Skip to content

Nullable assocations for entity generator#287

Merged
beberlei merged 1 commit intodoctrine:masterfrom
goetas:nullable
Feb 19, 2012
Merged

Nullable assocations for entity generator#287
beberlei merged 1 commit intodoctrine:masterfrom
goetas:nullable

Conversation

@goetas
Copy link
Member

@goetas goetas commented Feb 15, 2012

Hi all!
If an entity is identified thought another entity (using @association-key), this entity can't be nullable

@guilhermeblanco
Copy link
Member

Where is this situation applicable?
Looking at the patch seems that you are inspecting for @*ToOne(id="..."), which seems to be invalid.

@goetas
Copy link
Member Author

goetas commented Feb 15, 2012

<doctrine-mapping>
  <entity name="EntA" table="ent">
    <id name="entb" type="integer" column="entb_id" association-key="true"/>
    <one-to-one field="entb" target-entity="EntB">
      <join-columns>
        <join-column name="entb_id" referenced-column-name="id"/>
      </join-columns>
    </one-to-one>
</doctrine-mapping>

this should generate something like this

clas EntA{
  function setEntB(EntB $entb){
  }
}

but currently generate

clas EntA{
  function setEntB(EntB $entb = null){
  }
}

beberlei added a commit that referenced this pull request Feb 19, 2012
Nullable assocations for entity generator
@beberlei beberlei merged commit f040ed0 into doctrine:master Feb 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants