i'm new symfony2 , know whether there way use "findby" param present in mapped entity.
this snippet controller:
$prods = $em->getrepository('ecommerceproductbundle:productdata') ->findby(array( 'product_id'=>46 ));
it works if try add element array, present in mapped entity, (rightly) error
unrecognized field: productimage.is_visible
what do, know wehether can use "filterby" mapped element of entity productdata.
i'm in wrong idea:
->findby(array( 'product_id'=>46, 'productimage.is_visible'=>1 ));
not possible far know. add custom method repository:
public function findbyidandvisibleimage($id) { return $this->createquerybuilder('product') ->lefjoin("product.image","i") ->where("product.product_id = :id") ->andwhere("i.is_visible = 1") ->setparameter("id", $id) ->getquery() ->getsingleresult(); }
Comments
Post a Comment