Example #1
0
 /**
  * {@inheritdoc}
  */
 public function isEditable(ModelInterface $model = null, PropertyValueBag $input = null, LegendInterface $legend = null)
 {
     if ($this->editableCondition) {
         return $this->editableCondition->match($model, $input, $this, $legend);
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function match(ModelInterface $model = null, PropertyValueBag $input = null, PropertyInterface $property = null, LegendInterface $legend = null)
 {
     $result = $this->propertyCondition->match($model, $input, $property, $legend);
     // @codingStandardsIgnoreStart - We explicitely allow var_dump() here for debugging purposes.
     echo '<pre>$condition: </pre>';
     var_dump($this->propertyCondition);
     echo '<pre>$model: </pre>';
     var_dump($model);
     echo '<pre>$input: </pre>';
     var_dump($input);
     echo '<pre>$condition->match() result: </pre>';
     var_dump($result);
     echo '<pre>';
     debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     echo '</pre>';
     // @codingStandardsIgnoreEnd
     return $result;
 }
Example #3
0
 /**
  * Start a new property-value condition and chain with previous condition.
  *
  * @param string $propertyName  The name of the property.
  *
  * @param mixed  $propertyValue The value of the property.
  *
  * @param bool   $strict        Flag if the comparison shall be strict (type safe).
  *
  * @param string $conjunction   The conjunction.
  *
  * @return PaletteBuilder
  *
  * @throws DcGeneralRuntimeException If neither a palette nor a property is stored in the builder.
  */
 public function chainPropertyValueCondition($propertyName, $propertyValue, $strict = false, $conjunction = PropertyConditionChain::AND_CONJUNCTION)
 {
     if ($this->property) {
         $this->createPropertyConditionChain($conjunction);
         $condition = $this->propertyValueConditionClass->newInstance();
     } elseif ($this->palette) {
         $this->createPaletteConditionChain();
         $condition = $this->palettePropertyValueConditionClass->newInstance();
     } else {
         throw new DcGeneralRuntimeException('Does not know where to create the property-value condition, please create a palette or property first');
     }
     $condition->setPropertyName($propertyName);
     $condition->setPropertyValue($propertyValue);
     $condition->setStrict($strict);
     $event = new CreatePropertyValueConditionEvent($condition, $this);
     $this->dispatchEvent($event);
     $condition = $event->getPropertyValueCondition();
     $event = new CreateConditionEvent($condition, $this);
     $this->dispatchEvent($event);
     $condition = $event->getCondition();
     $this->condition->addCondition($condition);
     return $this;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function match(ModelInterface $model = null, PropertyValueBag $input = null, PropertyInterface $property = null, LegendInterface $legend = null)
 {
     return !$this->condition->match($model, $input, $property, $legend);
 }