Exemplo n.º 1
0
 /**
  * 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);
     }
 }