I have an rntity called Account, which can have many phone numbers (or Dnis, as I have named the related Entity ).
The definition for Account using yml is:
models\Account:
type: entity
table: account
oneToMany:
dnis:
targetEntity: models\Dnis
mappedBy: account
The problem is when I generate the entities classes with the following command:
doctrine orm:generate:entities
Since it is a OneToMany relation, the Account entity has a dnis collection, the problem is that the "add" method gets named as "addDni".
/**
* Add dni
*
* @param \application\models\Dnis $dni
*
* @return CreditAccount
*/
public function addDni(\application\models\Dnis $dni)
{
$this->dnis[] = $dni;
return $this;
}
/**
* Remove dni
*
* @param \application\models\Dnis $dni
*/
public function removeDni(\application\models\Dnis $dni)
{
$this->dnis->removeElement($dni);
}
I guess doctrine get confused because it thinks that the property "dnis" is a plural just because ends with a letter "s".
How can I let doctrine know that "dnis" is the actual name of the property? Or am I missing something here in the entity definition?
Thanks in advance.