/**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     if ($this->notNull && $this->nullify) {
         return "Spécifications de propriété incohérentes entre 'notNull' et 'nullify'";
     }
     $fieldName = $this->fieldName;
     $propValue = CMbFieldSpec::checkNumeric($object->{$fieldName}, true);
     if ($propValue === null || $object->{$fieldName} === "") {
         return "N'est pas une référence (format non numérique)";
     }
     if ($propValue == 0) {
         return "ne peut pas être une référence nulle";
     }
     if ($propValue < 0) {
         return "N'est pas une référence (entier négatif)";
     }
     if (!$this->class and !$this->meta) {
         return "Type d'objet cible on défini";
     }
     $class = $this->class;
     if ($meta = $this->meta) {
         $class = $object->{$meta};
     }
     // Gestion des objets étendus ayant une pseudo-classe
     $ex_object = CExObject::getValidObject($class);
     if ($ex_object) {
         if (!$this->unlink && !$ex_object->load($propValue)) {
             return "Objet référencé de type '{$class}' introuvable";
         }
     } else {
         if (!is_subclass_of($class, "CStoredObject")) {
             return "La classe '{$class}' n'est pas une classe d'objet enregistrée";
         }
         /** @var CStoredObject $ref */
         $ref = new $class();
         if (!$this->unlink && !$ref->idExists($propValue)) {
             return "Objet référencé de type '{$class}' introuvable";
         }
     }
     return null;
 }
 /**
  * Load target of meta object
  *
  * @param bool $cache Utilisation du cache
  *
  * @return CMbObject
  */
 function loadTargetObject($cache = true)
 {
     if ($this->_ref_object || !$this->object_class) {
         return $this->_ref_object;
     }
     if (!class_exists($this->object_class)) {
         $ex_object = CExObject::getValidObject($this->object_class);
         if (!$ex_object) {
             CModelObject::error("Unable-to-create-instance-of-object_class%s-class", $this->object_class);
             return null;
         } else {
             $ex_object->load($this->object_id);
             $this->_ref_object = $ex_object;
         }
     } else {
         $this->_ref_object = $this->loadFwdRef("object_id", $cache);
     }
     if (!$this->_ref_object->_id) {
         $this->_ref_object->load(null);
         $this->_ref_object->_view = "Element supprimé";
     }
     return $this->_ref_object;
 }
 /**
  * Make an instance of a ModelObject
  *
  * @param string $class Object class to get an instance of
  *
  * @return null|self
  */
 static function getInstance($class)
 {
     $object = CExObject::getValidObject($class);
     if (!$object) {
         // Non existing class
         if (!self::classExists($class)) {
             return null;
         }
         return new $class();
     }
     return $object;
 }