Skip to content

Instantly share code, notes, and snippets.

@tarlepp
Created April 16, 2021 15:25
Show Gist options
  • Save tarlepp/f385ad73c9c919686e265a0afd838513 to your computer and use it in GitHub Desktop.
Save tarlepp/f385ad73c9c919686e265a0afd838513 to your computer and use it in GitHub Desktop.
public function foo()
{
$ids = ($this->createQueryBuilder())
->select('Images.id')
->innerJoin('Slider', 's')
->where('s.id = :yourSliderId')
->setParameter('yourSliderId', 123)
->getQuery()
->getArrayResult();
$images = ($this->createQueryBuilder())
->select('Images')
->where('Images.id NOT IN (:ids)')
->setParameter('ids', $ids)
->getQuery()
->getResult();
dump($images);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment