public function findByLocaleAndFilter($locale, array $filter)
    {
        try {
            $qb = $this->getShippingQuery($locale);

            foreach ($filter as $key => $value) {
                switch ($key) {
                    case 'status':
                        $qb->andWhere('status.id = :' . $key);
                        $qb->setParameter($key, $value);
                        break;
                    case 'orderId':
                        $qb->leftJoin('shipping.order', 'o');
                        $qb->andWhere('o.id = :' . $key);
                        $qb->setParameter($key, $value);
                        break;
                }
            }

            $query = $qb->getQuery();
            return $query->getResult();
        } catch (NoResultException $ex) {
            return null;
        }
    }
public function findByLocaleAndFilter($locale, array $filter)
    {
        try {
            $qb = $this->getShippingQuery($locale);

            foreach ($filter as $key => $value) {
                switch ($key) {
                    case 'status':
                        $qb->andWhere('status.id = :' . $key);
                        $qb->setParameter($key, $value);
                        break;
                    case 'orderId':
                        $qb->leftJoin('shipping.order', 'o');
                        $qb->andWhere('o.id = :' . $key);
                        $qb->setParameter($key, $value);
                        break;
                }
            }

            $query = $qb->getQuery();
            return $query->getResult();
        } catch (NoResultException $ex) {
            return null;
        }
    }
public function findByLocaleAndFilter ( $ locale , array $ filter ) { try { $ qb = $ this -> getShippingQuery ( $ locale ) ; foreach ( $ filter as $ key => $ value ) { switch ( $ key ) { case 'status' : $ qb -> andWhere ( 'status.id = :' . $ key ) ; $ qb -> setParameter ( $ key , $ value ) ; break ; case 'orderId' : $ qb -> leftJoin ( 'shipping.order' , 'o' ) ; $ qb -> andWhere ( 'o.id = :' . $ key ) ; $ qb -> setParameter ( $ key , $ value ) ; break ; } } $ query = $ qb -> getQuery ( ) ; return $ query -> getResult ( ) ; } catch ( NoResultException $ ex ) { return null ; } }
Returns all shippings and filters them
@param $locale
@param array $filter
@return Shipping[]|null
Returns all shippings and filters them