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; }
/** * @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; }
public function hasRelation() { return !is_null($this->property->getRelation()); }
protected function propertyAsArray(Property $property) { return array('comment' => $property->getComment(), 'type' => $property->getType(), 'required' => $property->getRequired()); }