/** * Creates an array of PropetyMapping objects which contain the * configuration for the uploadable fields in the specified * object. * * @param object $obj The object. * @return array An array up PropertyMapping objects. */ public function fromObject($obj) { $class = $this->adapter->getReflectionClass($obj); $this->checkUploadable($class); $mappings = array(); foreach ($this->driver->readUploadableFields($class) as $field) { $mappings[] = $this->createMapping($obj, $field); } return $mappings; }
/** * Test that the driver reads zero UploadableField * properties when none exist. */ public function testReadNoUploadableFieldsWhenNoneExist() { $entity = new DummyEntity(); $class = new \ReflectionClass($entity); $reader = $this->getMock('Doctrine\\Common\\Annotations\\Reader'); $reader->expects($this->any())->method('getPropertyAnnotation')->will($this->returnValue(null)); $driver = new AnnotationDriver($reader); $fields = $driver->readUploadableFields($class); $this->assertEquals(0, count($fields)); }