Reputation: 11
i read this documentation about this issue
but not working
and return this error:
The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?
mi code is
in MyApp\MainBundle\Resources\config\validation.yml
MyApp\MainBundle\Entity\Product:
properties:
name: # YES VALIDATE
- Length:
min: 2
max: 60
image: # NOT VALIDATE
- Image:
maxSize: 6000000
mimeTypes: [image/*]
mimeTypesMessage: Solo imagenes estan permitidas
the Entity MyApp\MainBundle\Entity\Product
use Symfony\Component\HttpFoundation\File\File;
/**
* @ORM\Column(name="image", type="string", length=255, nullable=false)
*/
private $image;
// UPLOAD OF IMAGES
/**
* Set image
*/
public function setImage(File $image= null)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return UploadedFile
*/
public function getImage()
{
return $this->image;
}
// UPLOAD IMAGES
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
## .....
}
/**
* @ORM\PreUpdate()
*/
public function preUpdate()
{
## .....
}
## ETC .....
Upvotes: 0
Views: 277
Reputation: 3736
The error that you are receiving has nothing to do with your validation. The problem is in your controller. You must return some kind of Response
object in your controller. Take a look at the controller you are using for your product entity, and ensure that you are returning a Response
object in each Action. It looks like you aren't returning anything
Upvotes: 2