I would like to display an image which is in my database. But I have error:
"Unrecognized field: name"
I made a entity:
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $title;
/**
* @ORM\Column(type="string")
*/
private $description;
/**
* @ORM\Column(type="blob", nullable=true)
*/
private $image;
/**
* @ORM\Column(type="date")
*/
private $dataStart;
/**
* @ORM\Column(type="date")
*/
private $dataEnd;
And this is my controller:
/**
* @Route(
* "/promotion",
* name = "pizza_promotion"
* )
*
* @Template
*/
public function promotionAction() {
$RepoPromotion = $this->getDoctrine()->getRepository('PizzaBundle:Promotion');
$rowsPromotion = $RepoPromotion->findAll();
$rowsImage = $RepoPromotion->findBy(array('name' => 'image'));
if(!empty($rowsImage)) {
$respons = base64_decode($rowsImage);
}
return array(
'rowsPromotion' => $rowsPromotion,
'respons' => $respons
);
}
But when I want display image with my twig
{% for entry in response %}
<img src="data:image/jpeg;base64,{{ entry.image }}" alt="HTML5 Icon"> zł</li>
{% endfor %}
I have error - "Unrecognized field: name"