/** * Save simple related entity. * * @param EntityInterface $entity * @param bool $validate * @return bool|void */ private function saveEntity(EntityInterface $entity, $validate) { if ($entity instanceof RecordInterface && $entity->isDeleted()) { return true; } if (!$entity instanceof ActiveEntityInterface) { throw new RelationException("Unable to save non active entity."); } $this->mountRelation($entity); if (!$entity->save($validate)) { return false; } if ($entity instanceof IdentifiedInterface) { $this->orm->registerEntity($entity); } return true; }