예제 #1
0
 public function __isset($propertyName)
 {
     if (parent::__isset($propertyName)) {
         return true;
     }
     $schema = $this->getSchema();
     $columns = $schema->getColumns();
     // Check for schema columns
     if (isset($columns[$propertyName])) {
         return true;
     }
     // Check for dot operator
     if (strpos($propertyName, ".") !== false) {
         $parts = explode(".", $propertyName);
         $firstStep = $this[$parts[0]];
         if ($firstStep === null || !$firstStep instanceof Model) {
             // If the next item in the chain is not model object we can't ask it to
             // set it's value.
             return false;
         }
         if (isset($firstStep[$parts[1]])) {
             return true;
         }
     }
     // Check for relationships
     $className = get_class($this);
     if (!isset(self::$relationships[$className])) {
         self::$relationships[$className] = SolutionSchema::getAllRelationshipsForModel($this->modelName);
     }
     if (isset(self::$relationships[$className][$propertyName])) {
         return true;
     }
     return false;
 }