You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace Zitec\RuleEngineBundle\DoctrineBehaviors;
use Zitec\RuleEngineBundle\Entity\Rule;use Zitec\RuleEngineBundle\Service\RuleContextInterface;
/** * Class RuleTrait * A trait that can be used in an entity class to add rule behavior to it. * It is recommended that you use it in conjecture with RuleInterface. */trait PostconditionTrait{
/** * @ORM\OneToOne(targetEntity="Zitec\RuleEngineBundle\Entity\Rule",cascade={"persist"}) * @ORM\JoinColumn(name="postcondicion_id", referencedColumnName="id") */ private $postcondition;
/** * @var RuleContextInterface */ private $contextObjectPostcondition;
/** * Get rule * * @return Rule */ public function getPostcondition(): ?Rule { return $this->postcondition; } /** * Set rule * * @param null|Rule $rule * * @return self */ public function setPostcondition(?Rule $rule = null) { $this->postcondition = $rule;
return $this; }
/** * @return RuleContextInterface */ public function getContextObjectPostcondition(): RuleContextInterface { return $this->contextObjectPostcondition; }
/** * @param RuleContextInterface $contextObject * * @return self */ public function setContextObjectPostcondition(RuleContextInterface $contextObject) { $this->contextObjectPostcondition = $contextObject;
return $this; }
/** * @return string */ public function __toString() { $rule = $this->getPostcondition(); if ($rule instanceof Rule) { $name = $rule->getName(); if (isset($name)){ return $name; } }
return "New postcondition"; }}
|