public function validate($groups = null, $fields = null, $exclude_fields = null, $exclude_types = null) { if (parent::validate($groups, $fields, $exclude_fields)) { $qb = static::select('item.id, item.code')->where("item.code = '{$this->code}'"); if (isset($this->id)) { $qb->andWhere("item.id != {$this->id}"); } // Throw an error if there are other languages set to this if (count($qb->getQuery()->getArrayResult()) > 0) { $this->addErrorForField('code', 'This language has already been added!'); } return count($this->errors) === 0; } return false; }
protected function metadata2() { $metadata = \CMF\Model\Base::metadata(); }
/** inheritdoc */ public function blank($ignore_fields = null) { parent::blank($ignore_fields); $this_class = get_class($this); $this->title = $this->menu_title = $this->html_title = $this_class::singular(); }
/** inheritdoc */ public function blank($ignore_fields = null) { parent::blank($ignore_fields); $this->email = '*****@*****.**'; $this->username = '******'; $this->password = '******'; }