doctrine - Image not view on page in symfony -
newcontroller
this newcontroller going fetch data database image not view on view page don't know how can view image on view page.
<?php namespace appbundle\controller; use appbundle\entity\users; use appbundle\entity\login; use appbundle\entity\customer; use appbundle\entity\product; use sensio\bundle\frameworkextrabundle\configuration\route; use symfony\bundle\frameworkbundle\controller\controller; use symfony\component\httpfoundation\request; use symfony\component\httpfoundation\redirectresponse; use symfony\component\httpfoundation\response; use symfony\component\httpfoundation\session\session; class newcontroller extends controller { /** * @route("/main", name="main") */ public function mainaction(request $request) { $product = $this->getdoctrine() ->getrepository('appbundle:product') ->findall(); return $this->render('website/main.html.twig', array('view' => $product)); } ?> **main.html.twig** **main.html.twig** don't know how can display image database on view page.
this main.html.twig don't know how can display image database on view page. main.html.twig don't know how can display image database on view page. main.html.twig don't know how can display image database on view page. enter image description here
{% key in view %} <table border="1"> <tr> <td> <img src="{{ key.fileinput }}" alt="" width="100" height="100" /> </td> <td> {{ key.productname }} </td> <td> {{ key.productprice }} </td> </tr> </table> {% endfor %} **product.php** **product.php**. <?php namespace appbundle\entity; use doctrine\orm\mapping orm; /** * product * * @orm\table(name="product") * @orm\entity(repositoryclass="appbundle\repository\productrepository") */ class product { /** * @var int * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="productname", type="string", length=255) */ private $productname; /** * @var int * * @orm\column(name="productprice", type="integer") */ private $productprice; /** * @var string * * @orm\column(name="fileinput", type="string", length=255) */ private $fileinput; /** * id * * @return int */ public function getid() { return $this->id; } /** * set productname * * @param string $productname * * @return product */ public function setproductname($productname) { $this->productname = $productname; return $this; } /** * productname * * @return string */ public function getproductname() { return $this->productname; } /** * set productprice * * @param integer $productprice * * @return product */ public function setproductprice($productprice) { $this->productprice = $productprice; return $this; } /** * productprice * * @return int */ public function getproductprice() { return $this->productprice; } /** * set fileinput * * @param string $fileinput * * @return product */ public function setfileinput($fileinput) { $this->fileinput = $fileinput; return $this; } /** * fileinput * * @return string */ public function getfileinput() { return $this->fileinput; } }
Comments
Post a Comment