Knp\Bundle\KnpBundlesBundle\Repository\BundleRepository::queryAllWithOwnersAndContributorsSortedBy PHP Method

queryAllWithOwnersAndContributorsSortedBy() public method

Returns the query to retrieve all the bundles with their associated owners and contributors, sorted by the specified field
public queryAllWithOwnersAndContributorsSortedBy ( string $field ) : Doctrine\ORM\Query
$field string The name of the field to sort by
return Doctrine\ORM\Query
    public function queryAllWithOwnersAndContributorsSortedBy($field)
    {
        $q = $this->createQueryBuilder('bundle')->select('bundle, owner, contributors')->leftJoin('bundle.owner', 'owner')->leftJoin('bundle.contributors', 'contributors')->addOrderBy('bundle.' . $field, 'name' === $field ? 'asc' : 'desc')->addOrderBy('bundle.score', 'desc')->addOrderBy('bundle.lastCommitAt', 'desc')->getQuery();
        return $q;
    }