public function _checkRelationModelExists() { $relModel = $this->relation->toModel; if ($relModel instanceof Model) { $relModel = $relModel->meta->modelName; } $relMissing = $this->scopeModel->meta->registry->hasModel($relModel); $error = []; if (!$relMissing) { $msg = "Field defines a relation with model '%s', which is either does not exist, or is abstract."; $error = [CheckError::createObject(['message' => sprintf($msg, $relModel), 'hint' => null, 'context' => $this, 'id' => 'fields.E300'])]; } return $error; }
private function checkModels() { $error = []; if ($this->meta->proxy) { if (!empty($this->meta->localFields) || !empty($this->meta->localManyToMany)) { $error = [CheckError::createObject(['message' => sprintf('Proxy model "%s" contains model fields.', $this->getFullClassName()), 'hint' => null, 'context' => $this, 'id' => 'models.E017'])]; } } return $error; }
public function _checkFieldName() { $errors = []; if (!StringHelper::isValidVariableName($this->name)) { $errors = [CheckError::createObject(['message' => sprintf(' "%s" is not a valid field name on model %s .', $this->name, $this->scopeModel->getFullClassName()), 'hint' => null, 'context' => $this, 'id' => 'fields.E001'])]; } return $errors; }