예제 #1
0
 public function testImport()
 {
     $step = new WorkflowStep();
     $step->setName('step');
     $definition = new WorkflowDefinition();
     $definition->addStep($step);
     $this->entityAcl->setAttribute('attribute');
     $this->entityAcl->setStep($step);
     $this->entityAcl->setEntityClass('TestEntity');
     $this->entityAcl->setUpdatable(false);
     $this->entityAcl->setDeletable(false);
     $newEntityAcl = new WorkflowEntityAcl();
     $newEntityAcl->setDefinition($definition);
     $this->assertEquals($newEntityAcl, $newEntityAcl->import($this->entityAcl));
     $this->assertEquals('attribute', $newEntityAcl->getAttribute());
     $this->assertEquals($step, $newEntityAcl->getStep());
     $this->assertEquals('TestEntity', $newEntityAcl->getEntityClass());
     $this->assertFalse($this->entityAcl->isUpdatable());
     $this->assertFalse($this->entityAcl->isDeletable());
     $this->assertEquals($this->entityAcl->getAttributeStepKey(), $newEntityAcl->getAttributeStepKey());
 }
예제 #2
0
 /**
  * @param WorkflowEntityAcl $acl
  * @return WorkflowDefinition
  */
 public function addEntityAcl(WorkflowEntityAcl $acl)
 {
     $attributeStep = $acl->getAttributeStepKey();
     if (!$this->hasEntityAclByAttributeStep($attributeStep)) {
         $acl->setDefinition($this)->setStep($this->getStepByName($acl->getStep()->getName()));
         $this->entityAcls->add($acl);
     } else {
         $this->getEntityAclByAttributeStep($attributeStep)->import($acl);
     }
     return $this;
 }