twigParams = array(); } /** * @return string */ public function __toString() { return (string) $this->name; } /** * @return int */ public function getId() { return $this->id; } /** * @param string $name * * @return Action */ public function setName($name) { $this->name = $name; return $this; } /** * @return string */ public function getName() { return $this->name; } /** * @param array $event * * @return Action */ public function setEvent($event = array()) { $this->event = $event; return $this; } /** * @return array */ public function getEvent() { return $this->event; } /** * @param text $template * * @return Action */ public function setTemplate($template) { $this->template = $template; return $this; } /** * @return text */ public function getTemplate() { return $this->template; } /** * Set workflowName * * @param string $workflowName * * @return Action */ public function setWorkflowName($workflowName = null) { $this->workflowName = $workflowName; return $this; } /** * Get workflowName * * @return string */ public function getWorkflowName() { return $this->workflowName; } /** * Set objectClass * * @param string $objectClass * * @return Action */ public function setObjectClass($objectClass) { $this->objectClass = $objectClass; return $this; } /** * Get objectClass * * @return string */ public function getObjectClass() { return $this->objectClass; } /** * Set eventReference * * @param string $eventReference * * @return Action */ public function setEventReference($eventReference) { $this->eventReference = $eventReference; return $this; } /** * Get eventReference * * @return string */ public function getEventReference() { return $this->eventReference; } /** * Set tenancyId * * @param integer $tenancyId * * @return Action */ public function setTenancyId($tenancyId) { $this->tenancyId = $tenancyId; return $this; } /** * Get tenancyId * * @return integer */ public function getTenancyId() { return $this->tenancyId; } /** * @return array */ public function getTwigParams() { return $this->twigParams; } /** * @param array $twigParams * * @return $this */ public function setTwigParams($twigParams) { $this->twigParams = $twigParams; return $this; } /** * @param Entity $entity * * @return string */ public function render($entity) { $template = $this->template; $loader = new \Twig_Loader_Array(array( $this->name => $template )); $twig = new \Twig_Environment($loader, array( 'cache' => false, )); return $twig->render($this->name, array( 'entity' => $entity, 'object' => $entity, 'params' => $this->twigParams, )); } }