<?php
 namespace App\OfferProfileRules; class Criterion_OwnerCorporate extends CriterionAbstract { public function checkFields(\App\OfferProfileRules\Fields $fields) { return $this->checkField($fields->idOwnerCorporate); } public function checkAssignedValues(\App\MessagesCollector $msgs) { if ($this->operation=='notEqual' and !$this->values) { $msgs->addWarning("No corporate set."); } else { foreach($this->values as $idCorporate) { if (!\Entity\Corporate::select($idCorporate)->recordExists()) { $msgs->addWarning("The corporate id `{$idCorporate}` is not valid."); } } } } protected function createDescription_getEntityName($code) { return \Entity\Corporate::select($code)->alias; } } 