![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/LeadBundle/Entity/ |
<?php namespace Mautic\LeadBundle\Entity; use Mautic\CoreBundle\Entity\CommonRepository; /** * @extends CommonRepository<LeadCategory> */ class LeadCategoryRepository extends CommonRepository { /** * @return array<mixed, array<string, mixed>> */ public function getLeadCategories(Lead $lead): array { $q = $this->_em->getConnection()->createQueryBuilder() ->select('lc.id, lc.category_id, lc.date_added, lc.manually_added, lc.manually_removed, c.alias, c.title') ->from(MAUTIC_TABLE_PREFIX.'lead_categories', 'lc') ->join('lc', MAUTIC_TABLE_PREFIX.'categories', 'c', 'c.id = lc.category_id') ->where('lc.lead_id = :lead') ->andWhere('lc.manually_removed = 0') ->setParameter('lead', $lead->getId()); $results = $q->executeQuery() ->fetchAllAssociative(); $categories = []; foreach ($results as $category) { $categories[$category['category_id']] = $category; } return $categories; } /** * @return mixed[] */ public function getUnsubscribedLeadCategories(Lead $lead): array { $q = $this->_em->getConnection()->createQueryBuilder() ->select('lc.id, lc.category_id, lc.date_added, lc.manually_added, lc.manually_removed, c.alias, c.title') ->from(MAUTIC_TABLE_PREFIX.'lead_categories', 'lc') ->join('lc', MAUTIC_TABLE_PREFIX.'categories', 'c', 'c.id = lc.category_id') ->where('lc.lead_id = :lead') ->andWhere('lc.manually_removed = 1') ->setParameter('lead', $lead->getId()); $results = $q->executeQuery()->fetchAllAssociative(); $categories = []; foreach ($results as $category) { $categories[$category['category_id']] = $category; } return $categories; } }