/** * @expectedException \Storm\Core\Object\ObjectException */ public function testUnmappedProcedureIsDisallowed() { $Procedure = $this->getMock(self::CoreObjectNamespace . 'IProcedure'); $Procedure->expects($this->any())->method('GetEntityType')->will($this->returnValue(__CLASS__)); $this->UnitOfWork->Execute($Procedure); }
/** * Constructs a unit of work instance containing the supplied operations to commit. * * @param object[] $EntitiesToPersist * @param IProcedure[] $ProceduresToExecute * @param object[] $EntitiesToDiscard * @param ICriterion[] $CriterionToDiscard * @return UnitOfWork The constructed unit of work */ public final function BuildUnitOfWork(array $EntitiesToPersist = [], array $ProceduresToExecute = [], array $EntitiesToDiscard = [], array $CriterionToDiscard = []) { $UnitOfWork = new UnitOfWork($this); foreach ($EntitiesToPersist as $Entity) { $UnitOfWork->Persist($Entity); } foreach ($ProceduresToExecute as $Procedure) { $UnitOfWork->Execute($Procedure); } foreach ($EntitiesToDiscard as $Entity) { $UnitOfWork->Discard($Entity); } foreach ($CriterionToDiscard as $Criterion) { $UnitOfWork->DiscardWhere($Criterion); } return $UnitOfWork; }