I have a problem that is analogous to the following situation:
A car may or may not have a driver, ie a car may have a minimum of 0 and a maximum of 1 driver.
A driver may or may not have a car, ie a driver can have a minimum of 0 and a maximum of 1 car.
In the example in question we are accepting that the driver may have maximum one car.
Turning this into a class would then have two classes.
<?php
class Carro{
/**
* esse deve aceitar null
*/
private $motorista;
}
class Motorista{
/**
* esse deve aceitar null
*/
private $carro;
}
In my view, the mapping that would interest me most would be OneToOne, but I do not know if it should be OneToMany or ManyToOne, if it were possible to get it to accept null values, however, I would like to know what is the best way to do it doctrine and the most correct way according to Designer Partner (I wonder why it might be that the best way to do it using the doctrine is not the right way).