I use an Symfony product form. That can be changed by an user. After the user saves the form I want to know if there are any changes made in the product.
The form uses the entity of the product. This product has an one-to-one relation with the entity price. As there are multiple one-to-one relation with price for discounts and so on. The price entity has an set of data like priceType
en currency
and value
.
It is an one-to-one one direction, only from product to price. The product entity has the following annotation:
/**
* @ORM\OneToOne(targetEntity="Price")
* @ORM\JoinColumn(name="price_sales_id", referencedColumnName="id")
*/
private $priceSales;
After the form is saved and validated I use the following code to compare:
$uow = $em->getUnitOfWork();
$uow->computeChangeSets();
$changeSet = $uow->getEntityChangeSet($product);
The $changeSet
object gives back the changes made in the product but not the one made in the one-to-one relation. Is there a way to also detect changed in the related entities?