コード例 #1
0
ファイル: Property.php プロジェクト: cti/storage
 public function getUsages()
 {
     $usages = array();
     if ($this->hasRelation()) {
         $model = $this->schema->getModel($this->property->getRelation()->getDestination());
         $usages[] = sprintf('use %s as %s;', $model->getModelClass(), $model->getClassName());
     }
     return $usages;
 }
コード例 #2
0
ファイル: Model.php プロジェクト: cti/storage
 /**
  * @param $name
  * @param $config
  * @return Property
  */
 public function addProperty($name, $config)
 {
     if ($config instanceof Property) {
         $property = $config;
     } else {
         if (is_string($config)) {
             $config = array('name' => $name, 'comment' => $config);
         } elseif (is_array($config) && !is_numeric($name)) {
             if (isset($config[0])) {
                 array_unshift($config, $name);
             } else {
                 $config['name'] = $name;
             }
         }
         $config['model'] = $this;
         $property = new Property($config);
     }
     return $this->properties[$property->getName()] = $property;
 }
コード例 #3
0
ファイル: Reference.php プロジェクト: cti/storage
 public function hasRelation()
 {
     return !is_null($this->property->getRelation());
 }
コード例 #4
0
ファイル: SchemaToArray.php プロジェクト: cti/storage
 protected function propertyAsArray(Property $property)
 {
     return array('comment' => $property->getComment(), 'type' => $property->getType(), 'required' => $property->getRequired());
 }