/** * {@inheritdoc} */ public function match(Workflow $workflow, EntityId $entityId, $entity) { if ($this->providerName) { return $entityId->getProviderName() == $this->providerName; } return $entityId->getProviderName() == $workflow->getProviderName(); }
function it_matches_against_workflow_provider_name(Workflow $workflow, EntityId $entityId) { $workflow->getProviderName()->willReturn('test'); $entityId->getProviderName()->willReturn('test'); $this->match($workflow, $entityId, static::$entity)->shouldReturn(true); }
/** * Create the item. * * It also converts the entity to a ModelInterface instance. * * @param EntityId $entityId The entity id. * @param mixed $model The data model. * * @return Item */ public function createItem(EntityId $entityId, $model) { $event = new CreateEntityEvent($model, $entityId->getProviderName()); $this->eventDispatcher->dispatch($event::NAME, $event); return parent::createItem($entityId, $event->getEntity()); }