public function persist($object, Collection $onCollection) { $next = $onCollection->getNext(); if ($this->filterable($onCollection)) { $next->setMapper($this); $next->persist($object); return; } if ($next) { $remote = $this->getStyle()->remoteIdentifier($next->getName()); $next->setMapper($this); $next->persist($object->{$remote}); } foreach ($onCollection->getChildren() as $child) { $remote = $this->getStyle()->remoteIdentifier($child->getName()); $child->persist($object->{$remote}); } return parent::persist($object, $onCollection); }