DiscardWhere() public méthode

Discard all entities matching the supplied criterion.
public DiscardWhere ( Storm\Core\Object\ICriterion $Criterion )
$Criterion Storm\Core\Object\ICriterion The criterion to discard by
 /**
  * @expectedException \Storm\Core\Object\ObjectException
  */
 public function testUnmappedCriterionIsDisallowed()
 {
     $Criterion = $this->getMock(self::CoreObjectNamespace . 'ICriterion');
     $Criterion->expects($this->any())->method('GetEntityType')->will($this->returnValue(__CLASS__));
     $this->UnitOfWork->DiscardWhere($Criterion);
 }
Exemple #2
0
 /**
  * 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;
 }