Skip to content

Commit

Permalink
Load proxies before getting value for uploadable field
Browse files Browse the repository at this point in the history
  • Loading branch information
Koc committed Aug 27, 2013
1 parent 16d6321 commit fb40b7d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Mapping/PropertyMappingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Vich\UploaderBundle\Adapter\AdapterInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Vich\UploaderBundle\Mapping\Annotation\UploadableField;
use Doctrine\Common\Persistence\Proxy;

/**
* PropertyMappingFactory.
Expand Down Expand Up @@ -61,6 +62,9 @@ public function __construct(ContainerInterface $container, AnnotationDriver $dri
*/
public function fromObject($obj)
{
if ($obj instanceof Proxy) {
$obj->__load();
}
$class = $this->adapter->getReflectionClass($obj);
$this->checkUploadable($class);

Expand All @@ -82,6 +86,9 @@ public function fromObject($obj)
*/
public function fromField($obj, $field)
{
if ($obj instanceof Proxy) {
$obj->__load();
}
$class = $this->adapter->getReflectionClass($obj);
$this->checkUploadable($class);

Expand Down

0 comments on commit fb40b7d

Please sign in to comment.