I have a listing of an object with OneToMany to represent the entity, the key between them is view.content_id, which contains the listing identifier, however it also applies to other objects, so adding
/**
* @var Listing
*
* @ORM\ManyToOne(targetEntity="\Acme\Bundle\Entity\Listing", inversedBy="views")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="content_id", referencedColumnName="id")
* })
*/
private $listing;
It slows down by sight, because when you save the view object, the content_id becomes zero.
How can i fix this?
Relationship to listing:
/**
* @var views
*
* @ORM\OneToMany(targetEntity="\Acme\Bundle\Entity\View", mappedBy="listing")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id", referencedColumnName="content_id")
* })
*/
private $views;
I make queries by joining the Listing.views list and adding WITH content_type =: ContentType, which distinguishes some of the results of the βviewβ.
source
share