Example #1
0
 public function testClassName()
 {
     $meta = new ServiceMetadata('Service\\Test');
     $this->assertEquals('Service\\Test', $meta->getClassName());
     $meta->setClassName('Service\\TestTwo');
     $this->assertEquals('Service\\TestTwo', $meta->getClassName());
 }
 /**
  * Loads the ServiceMetadata for the supplied class.
  *
  * @param string $class
  */
 protected function loadMetadata($class)
 {
     // first run, we have no parent
     $parent = null;
     $parentClasses = $this->getParentClasses($class);
     $parentClasses[] = $class;
     // iterate through the list of mapped service parent classes
     foreach ($parentClasses as $parentClass) {
         // create an empty metadata class
         $class = new ServiceMetadata($class);
         // copy all data from the immediate parent, if present
         if ($parent) {
             $class->setClassName($parent->getClassName());
             $class->setAllListeners($parent->getAllListeners());
         }
         // now overlay the metadata from the class itself
         if (!isset($this->loadedMetadata[$parentClass])) {
             $this->driver->loadMetadataForClass($parentClass, $class);
             $this->loadedMetadata[$parentClass] = $class;
         }
         // the parent for the next iteration will be this iteration
         $parent = $class;
     }
 }