CommandeRepository.php 674 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<?php

namespace PotageBundle\Repository;

/**
 * CommandeRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CommandeRepository extends \Doctrine\ORM\EntityRepository
{
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
    
    /**
     * Toutes les commandes d'un utilisateur
     * TODO introduire un status sur les commandes
     *
     * @param $id
     * @return array
     */
    public function findAllCurrentByUser($id)
    {
        $qb = $this->createQueryBuilder('c')
            ->where('c.user = :id')
            ->setParameter(':id', $id)
            ->orderBy('c.createdAt', 'DESC');
        return $qb->getQuery()->getResult();
    }
29
}