0

I've two entities, let's call them entityA and entityB, entityA has a not nullable attribute entityBID. In my form for entityA creation I'd like to add a select with some entityB names ( not id ) that I would select in a function ( which would be in Repository/entityBRepository if possible ).

Thanks :)

BleuBizarre
  • 368
  • 2
  • 15

1 Answers1

1

I'm not sure of what you're asking, but i guess you are making a choice (or entity) field type of entityB class. Those kind of field use the __toString() function of entity class (or getId() by default).

So just add in your entityB class

public function __toString()
{
    return $this->getName();
}
Thomas Piard
  • 1,209
  • 2
  • 15
  • 25