/** * Loads a property into this graph element. * * This loads a property object into the graph element. If the property is the primary key, it is remembered in * <code>$this->primaryKey</code>, if it is a property, it is saved in <code>$this->properties</code>. If it is indexed, * it is saved to <code>$this->indexedProperties</code> * * @param Property $prop The property to load. */ public function loadProperty($prop) { //Save primary key if ($prop->isPrimaryKey()) { $this->setPrimaryKey($prop); } else { if ($prop->isProperty()) { $this->properties[] = $prop; //Check for indexed properties if ($prop->isIndexed()) { $this->indexedProperties[] = $prop; } } } }
/** * Loads the required properties. * * Loops through properties and saves them based on their annotation, using the annotation reader supplied. * Properties are saved in <code>$this->properties</code>, indexed properties are saved in <code>$this->indexedProperties</code>, and the * primary key is saved in <code>$this->primaryKey</code>. * * @param \Doctrine\Common\Annotations\AnnotationReader $reader The annotation reader to use. * @param \ReflectionProperty[] $properties Array of reflection properties, from <code>reflectionClass->getProperties()</code>. * @throws Exception If the node contains a start or end property. */ public function loadProperties($reader, $properties) { //Loop through properties foreach ($properties as $property) { $prop = new Property($reader, $property); //A node can't have a start. if ($prop->isStart()) { throw new Exception("A node entity cannot contain a start property (@Start)."); } else { if ($prop->isEnd()) { throw new Exception("A node entity cannot contain an end property (@End)."); } } //Load the property (auto, property, indexed) $this->loadProperty($prop); } }
/** * Loads the required properties. * * Loops through properties and saves them based on their annotation, using the annotation reader supplied. * Properties are saved in <code>$this->properties</code>, indexed properties are saved in <code>$this->indexedProperties</code>, * the primary key is saved in <code>$this->primaryKey</code>, the start property is saved in <code>$this->start</code>, and the * end property is saved in <code>$this->end</code> * * @param \Doctrine\Common\Annotations\AnnotationReader $reader The annotation reader to use. * @param \ReflectionProperty[] $properties Array of reflection properties, from <code>reflectionClass->getProperties()</code>. */ public function loadProperties($reader, $properties) { //Loop through properties foreach ($properties as $property) { $prop = new Property($reader, $property); //Load start. if ($prop->isStart()) { $this->setStart($prop); } else { if ($prop->isEnd()) { $this->setEnd($prop); } } //Load the property (auto, property, indexed) $this->loadProperty($prop); } }