/** * 是否為該客戶的訂單 * * @param integer $id * @return boolean */ public function isOwnInvoice($id) { return $this->custom->getId() === (int) $id; }
public function findOwn(Custom $custom) { $qb = $this->getEntityManager()->createQueryBuilder(); return $qb->select('p')->from('WoojinOrderBundle:Benefit', 'p')->where($qb->expr()->andX($qb->expr()->lte('p.expireAt', $qb->expr()->literal($date->format('Y-m-d H:i:s'))), $qb->expr()->gt('p.remain', 0), $qb->expr()->eq('p.custom', $custom->getId())))->orderBy('p.expireAt', 'DESC')->getQuery()->getResult(); }