public function testSetClassFromPackageName()
 {
     $class = 'Rhapsody.SetupBundle.Test.Mocks.MockPerson';
     $expected = 'Rhapsody\\SetupBundle\\Test\\Mocks\\MockPerson';
     $metadata = new ObjectMetadata();
     $metadata->setClassName($class);
     $this->assertEquals($expected, $metadata->getClassName());
 }
 public function testSetProperty()
 {
     $name = 'John Smith';
     $property = $this->createProperty('name', $name);
     $metadata = new ObjectMetadata();
     $metadata->setClassName('Rhapsody.SetupBundle.Test.Mocks.MockPerson');
     $obj = new Object($metadata);
     $obj->set($property);
     $this->assertEquals($name, $obj->getInstance()->getName());
 }
 /**
  * (non-PHPDoc)
  * @see Rhapsody\SetupBundle\Model\DataSource\AbstractDataSource::process()
  */
 protected function handle()
 {
     foreach ($this->data as $record) {
         $instance = $record->instantiate();
         $metadata = new ObjectMetadata();
         $metadata->setClassName(get_class($instance));
         $object = new Object($metadata);
         $object->setInstance($instance);
         $this->queue($object);
     }
     $this->populator->save();
 }
Esempio n. 4
0
 public function isTransient()
 {
     return $this->metadata->isTransient();
 }
 /**
  *
  * @param \Rhapsody\SetupBundle\Model\ObjectMetadata $metadata
  */
 public function applyAttributes(&$metadata)
 {
     $name = $this->getAttribute('name');
     if (!empty($name)) {
         $this->getLog()->debug('Apply name attribute with value: ' . $name);
         $metadata->setName($name);
     }
     $class = $this->getAttribute('class');
     if (!empty($class)) {
         $this->getLog()->debug('Apply class attribute with value: ' . $class);
         $metadata->setClassName($class);
     }
     $parent = $this->getAttribute('parent');
     if (!empty($parent)) {
         $this->getLog()->debug('Apply parent attribute with value: ' . $parent);
         $metadata->setParentRef($parent);
     }
     $ref = $this->getAttribute('ref');
     if (!empty($ref)) {
         $this->getLog()->debug('Apply ref attribute with value: ' . $ref);
         $metadata->setRef($ref);
     }
     $abstract = $this->getBooleanAttribute('abstract');
     $this->getLog()->debug('Apply abstract attribute with value: ' . ($abstract ? 'true' : 'false') . ' type(' . gettype($abstract) . ')');
     $metadata->setAbstract($abstract);
     $transient = $this->getBooleanAttribute('transient');
     $this->getLog()->debug('Apply transient attribute with value: ' . ($transient ? 'true' : 'false'));
     $metadata->setTransient($transient);
 }