<?php
 namespace App\OfferProfileRules; class Criterion_Supplier extends CriterionAbstract { public function checkFields(\App\OfferProfileRules\Fields $fields) { return $this->checkField($fields->idSupplier); } public function checkAssignedValues(\App\MessagesCollector $msgs) { if (!$this->values) { $msgs->addWarning("No supplier set."); } else { foreach($this->values as $idSupplier) { if (!\Entity\Supplier::select($idSupplier)->recordExists()) { $msgs->addWarning("The supplier id `{$idSupplier}` is not valid."); } } } } protected function createDescription_getEntityName($code) { return \Entity\Supplier::select($code)->alias; } } 