Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
 }