Company
и Product
. Product
имеет отношение one-to-one unidirectional
с Company
. тоесть, я могу получить Company
через Product
: $product->getCompany()
$product = $this->getDoctrine()->getRepository('AppBundle:Product')->createQueryBuilder('p')
->where('p.id = :id')
->setParameter('id', 3)
->getQuery()->getOneOrNullResult();
var_dump($product);
getCompany()
и у меня один запрос:SELECT p0_.id AS id0, p0_.name AS name1, p0_.price AS price2, p0_.company_id AS company_id3 FROM product p0_ WHERE p0_.id = 3;
app.get('/user/:field', function(req, res){
res.send(user[req.params.field]);
res.end();
});