Exemplo n.º 1
0
 /**
  * @param array $option_attributes
  */
 public function setOptionAttributes(array $option_attributes)
 {
     foreach ($option_attributes as $key => $value) {
         if (method_exists($this->getTargetClass(), $value)) {
             $option_attributes[$key] = function ($entity) use($value) {
                 return $entity->{$value}();
             };
         }
     }
     parent::setOptionAttributes($option_attributes);
 }
Exemplo n.º 2
0
 public function prepareEmptyProxy()
 {
     $objectClass = 'DoctrineModuleTest\\Form\\Element\\TestAsset\\FormObject';
     $result = new ArrayCollection();
     $metadata = $this->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
     $objectRepository = $this->getMock('Doctrine\\Common\\Persistence\\ObjectRepository');
     $objectRepository->expects($this->once())->method('findAll')->will($this->returnValue($result));
     $objectManager = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $objectManager->expects($this->once())->method('getClassMetadata')->with($this->equalTo($objectClass))->will($this->returnValue($metadata));
     $objectManager->expects($this->once())->method('getRepository')->with($this->equalTo($objectClass))->will($this->returnValue($objectRepository));
     $this->proxy->setOptions(array('object_manager' => $objectManager, 'target_class' => $objectClass));
     $this->metadata = $metadata;
 }