Diciamo che ho un'entità Post e un'entità Commento. Un commento può essere approvato o meno da un amministratore (che è una bandiera nel db). L'entità post ha:Relazione condizionale in Symfony2
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="post")
*/
protected $comments;
E voglio anche un secondo attributo, che sarà simile:
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="post")
*/
protected $approvedComments;
Come è possibile caricare solo i commenti approvati qui?
Solo caricando solo quelli approvati?Non ho davvero il tuo problema. Puoi espandere un po 'come lo stai caricando? Repository? Controllore? – Koalabaerchen
Attualmente non sto caricando i Commenti approvati, sto chiedendo un bel modo per farlo. –