/**
  * {@inheritdoc}
  */
 public function postExecute()
 {
     foreach ($this->bindingDescriptors->toArray() as $bindingDescriptor) {
         if ($this->typeName === $bindingDescriptor->getTypeName()) {
             $this->reloadBindingDescriptor($bindingDescriptor);
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function rollback()
 {
     if ($this->bindingDescriptor->isLoaded() || !$this->containingPackage || !$this->typeDescriptor) {
         return;
     }
     // never fails with the check before, given that the type name of
     // the description/type didn't changed, which is impossible since
     // they're immutable
     $this->bindingDescriptor->load($this->containingPackage, $this->typeDescriptor);
     if ($this->wasRemoved) {
         // never fails
         $this->bindingDescriptors->add($this->bindingDescriptor);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function rollback()
 {
     // sanity check
     if (!$this->bindingDescriptor->isLoaded()) {
         return;
     }
     // never fails with the check before
     $this->bindingDescriptor->unload();
     if ($this->previousDescriptor) {
         // never fails
         $this->bindingDescriptors->add($this->previousDescriptor);
     } else {
         // never fails
         $this->bindingDescriptors->remove($this->bindingDescriptor->getUuid());
     }
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if (!$this->snapshotTaken) {
         throw new LogicException('takeSnapshot() was not called');
     }
     // Remember for rollback()
     $this->enabledBindingAfter = null;
     if ($this->bindingDescriptors->contains($this->uuid)) {
         $bindingDescriptor = $this->bindingDescriptors->get($this->uuid);
         if ($bindingDescriptor->isEnabled()) {
             // Clone so that rollback() works if the binding is unloaded
             $this->enabledBindingAfter = clone $bindingDescriptor;
         }
     }
     $this->syncBindingUuid($this->enabledBindingBefore, $this->enabledBindingAfter);
 }
 private function getUuidsByTypeName($typeName)
 {
     $uuids = array();
     foreach ($this->bindingDescriptors->getUuids() as $uuid) {
         if ($typeName === $this->bindingDescriptors->get($uuid)->getTypeName()) {
             $uuids[$uuid->toString()] = $uuid;
         }
     }
     return $uuids;
 }
 /**
  * {@inheritdoc}
  */
 public function postExecute()
 {
     $this->reloadBindingDescriptor($this->bindingDescriptors->get($this->uuid));
 }