/** * Adds an entity to the repo * * @param object $entity The entity to add * * @return void * * @throws OrmException if the entity could not be added */ public function add($entity) { foreach ($this->restrictions as $preset) { if ($preset['op'] == Operator::EQUAL) { $property = Normalise::toVariable($preset['field']); $entity->{$property} = $preset['value']; } } $this->unitOfWork->scheduleForInsertion($entity); }
/** * Schedules an entity for insertion * * @param object $entity The entity to schedule for insertion */ public function scheduleForInsertion($entity) { $this->unitOfWork->scheduleForInsertion($entity); }