Created
August 7, 2018 11:31
-
-
Save simplyniceweb/233cf638da393abaa0f01c4b35258b92 to your computer and use it in GitHub Desktop.
Doctrine query not equal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\Common\Collections\Criteria; | |
class Classy | |
{ | |
public function index() | |
{ | |
$criteria = new Criteria(); | |
$criteria->where(Criteria::expr()->neq('roles', 'ROLE_USER')); | |
$users = $app['orm.em']->getRepository('models\\User')->matching($criteria); | |
// ICYM: Making query easy. | |
// Finally doctrine realizes we need !=/neq | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment