Hellow, in de Doctrine documentations says: 'Doctrine will only check the owning side of an association for changes.'
I have read other posts here, but I can't find an example that makes me understand why if there is a change in the inverse side this would not be persisted by doctrine.
I take the example of the post: Understanding of “owning side” and “inverse side” concepts in Doctrine
Customer
entity:
class Customer
{
// ...
/** ONE-TO-ONE BIDIRECTIONAL, OWNING SIDE
* @ORM\OneToOne(targetEntity="Company", inversedBy="customer")
* @ORM\JoinColumn(name="company_id", referencedColumnName="id")
*/
private $company;
// ...
/**
* Set company method
*
* @param Company $company
*/
public function setCompany( Company $company )
{
$this->company = $company;
$company->setCustomer( $this );
}
}
Company
entity:
class Company
{
// ...
/** ONE-TO-ONE BIDIRECTIONAL, INVERSE SIDE
* @OneToOne(targetEntity="Customer", mappedBy="company")
*/
private $customer;
// ...
}
and I have two questions: 1. How would be setCustomer method in Company Entity? (to reflect this database model) 2. In that case it could be that a change in the Company Entity could not be persisted by doctrine?