sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
451 stars 495 forks source link

validate() not being called #324

Closed tiagojsag closed 11 years ago

tiagojsag commented 11 years ago

Related to: https://github.com/sonata-project/SonataMediaBundle/issues/288

I think BaseMediaAdmin.php is missing a validate() implementation that calls the pool's validate. Right now, validation is not happening at all. The above issue is due to images not being validates, and FileProvider is not validating mime types and extensions either.

public function validate(\Sonata\AdminBundle\Validator\ErrorElement $errorElement, $media)
    {
        $this->pool->validate($errorElement, $media);
    }
tiagojsag commented 11 years ago

Turns out it was my error.

By default, the validation is being associated with Application\Sonata\MediaBundle\Entity\Media. Since I'm not using this entity, but extending Media in my own bundle, validation was ever being called.