Example #1
0
 public function __construct($object, array $allowed = null, $parent = null, $reference = null, array $md = null)
 {
     if (is_array($object)) {
         $object = new \Doctrine\Common\Collections\ArrayCollection($object);
     }
     parent::__construct($object, $allowed, $parent, $reference);
     $this->_md = $md;
 }
Example #2
0
 public function getMetadata($type = null, $name = null)
 {
     $md = parent::getMetadata($type, $name);
     switch ($type) {
         case \Toast\Entity::MD_PROPERTIES:
         case \Toast\Entity::MD_PROPERTY:
             $md = $type == \Toast\Entity::MD_PROPERTY ? array($name => $md) : $md;
             foreach ($md as $key => $value) {
                 $value['context'] = array_merge($this->getContext(), array($name));
                 $value['contextName'] = $id = $value['context'][0] . (count($value['context']) > 1 ? '[' . implode('][', array_slice($value['context'], 1)) . ']' : '');
                 $md[$key] = $value;
             }
             $md = $type == \Toast\Entity::MD_PROPERTY ? $md[$name] : $md;
             break;
     }
     return $md;
 }