safrazik / breeze.server.php

Breeze JS support for PHP applications
MIT License
29 stars 11 forks source link

Add support for automatic handling of bidirectional associations #6

Closed safrazik closed 9 years ago

safrazik commented 9 years ago

As mentioned in the Doctrine documentation, it is required to update both sides of a bidirectional association:

// Many-To-One / One-To-Many Bidirectional
$newComment = new Comment();
$user->getAuthoredComments()->add($newComment);
$newComment->setAuthor($user);

Currently the breeze.server.php library has support for assigning from the owning side only.

$newComment = new Comment();
$newComment->setAuthor($user);

While this is not a problem in a usual scenario, it can be very useful when lifecycle callbacks are involved.