예제 #1
0
 /**
  * @param LifecycleEventArgs $event
  */
 public function postLoad(LifecycleEventArgs $event)
 {
     $em = $event->getEntityManager();
     $entity = $event->getEntity();
     if ($entity instanceof Invoice && count($entity->getUsers()) > 0) {
         $contacts = $em->getRepository('CSBillClientBundle:Contact')->findBy(['id' => ArrayUtil::column($entity->getUsers()->toArray(), 'id')]);
         $entity->setUsers($contacts);
     }
 }
예제 #2
0
 /**
  * @param LifecycleEventArgs $event
  */
 public function postLoad(LifecycleEventArgs $event)
 {
     $entity = $event->getEntity();
     if ($entity instanceof Quote && count($entity->getUsers()) > 0) {
         $entityManager = $event->getEntityManager();
         $repository = $entityManager->getRepository('CSBillClientBundle:Contact');
         $criteria = ['id' => ArrayUtil::column($entity->getUsers(), 'id')];
         $contacts = $repository->findBy($criteria);
         $entity->setUsers($contacts);
     }
 }
예제 #3
0
 /**
  * Gets section specific settings.
  *
  * @param string $section
  * @param bool   $combineArray Should the settings be returned as a key => value array
  *
  * @return array
  */
 public function getSettingsBySection($section, $combineArray = true)
 {
     $qb = $this->createQueryBuilder('s')->where('s.section = :section')->orderBy('s.key', 'ASC')->setParameter('section', $section);
     $query = $qb->getQuery()->useQueryCache(true);
     $result = $query->getResult();
     if (count($result) > 0) {
         if ($combineArray) {
             return array_combine(ArrayUtil::column($result, 'key'), ArrayUtil::column($result, 'value'));
         }
     }
     return $result;
 }
예제 #4
0
 /**
  * @return array
  */
 public function getStatusList()
 {
     $qb = $this->createQueryBuilder('c');
     $qb->select('DISTINCT c.status');
     return ArrayUtil::column($qb->getQuery()->getResult(), 'status');
 }