テーブルのクエリに dql を使用しています。
$dql = "SELECT p FROM WIC\ListingBundle\Entity\Listing p order by p.name";
私は2つのテーブルを持っていListingますProducts.
Listingテーブルには、テーブルproduct_idフィールドを参照するフィールドがあります。Productsid
Productテーブルフィールドでクエリを並べ替えnameたいのですが、毎回エラーが発生し続けたいと思っていますp.name。p.nameテーブルに存在しないためListing、エラーがスローされます。適切に行う方法がわかりません。
Listing実在物:
/**
* @ORM\ManyToOne(targetEntity="WIC\ProductBundle\Entity\Product", inversedBy="listings", cascade={"remove","persist"})
* @ORM\JoinColumn(name="product_id", referencedColumnName="id")
* @Common\Versioned
* @Assert\NotBlank()
*/
protected $product;