use Doctrine\Common\Collections\Criteria;
public function getActiveTags(): Collection
{
$criteria = Criteria::create()
->where(Criteria::expr()->eq('isActive', true))
->orderBy(['name' => Criteria::ASC]);
// If $this->tags is already loaded → filters in PHP (no query).
// If not initialized → Doctrine issues a filtered SQL query.
return $this->tags->matching($criteria);
}
I have an idea!
I have an idea!