You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractController.php 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. namespace Lc\SovBundle\Controller;
  3. use App\Container\Delivery\DeliveryAvailabilityPointSaleContainer;
  4. use App\Container\Delivery\DeliveryAvailabilityZoneContainer;
  5. use App\Container\Delivery\DeliveryPriceContainer;
  6. use App\Container\Delivery\DeliverySlotContainer;
  7. use App\Container\Delivery\DeliveryZoneContainer;
  8. use App\Container\Notification\NotificationContainer;
  9. use App\Container\Notification\NotificationLogContainer;
  10. use App\Container\Notification\NotificationUserContainer;
  11. use App\Container\Order\PurchaseOrderContainer;
  12. use App\Container\Product\SupplierContainer;
  13. use App\Container\Sponsor\SponsorContainer;
  14. use App\Payment\SystemPay;
  15. use App\Solver\Price\PriceSolver;
  16. use Doctrine\ORM\EntityManagerInterface;
  17. use Knp\Component\Pager\PaginatorInterface;
  18. use Lc\CaracoleBundle\Container\Address\AddressContainer;
  19. use Lc\CaracoleBundle\Container\Config\TaxRateContainer;
  20. use Lc\CaracoleBundle\Container\Config\UnitContainer;
  21. use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer;
  22. use Lc\CaracoleBundle\Container\File\DocumentContainer;
  23. use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
  24. use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer;
  25. use Lc\CaracoleBundle\Container\Order\OrderProductContainer;
  26. use Lc\CaracoleBundle\Container\Order\OrderProductReductionCatalogContainer;
  27. use Lc\CaracoleBundle\Container\Order\OrderProductRefundContainer;
  28. use Lc\CaracoleBundle\Container\Order\OrderReductionCartContainer;
  29. use Lc\CaracoleBundle\Container\Order\OrderReductionCreditContainer;
  30. use Lc\CaracoleBundle\Container\Order\OrderRefundContainer;
  31. use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
  32. use Lc\CaracoleBundle\Container\Order\OrderStatusContainer;
  33. use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer;
  34. use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer;
  35. use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer;
  36. use Lc\CaracoleBundle\Container\Product\ProductContainer;
  37. use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
  38. use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer;
  39. use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer;
  40. use Lc\CaracoleBundle\Container\Reduction\ReductionCreditContainer;
  41. use Lc\CaracoleBundle\Container\Section\OpeningContainer;
  42. use Lc\CaracoleBundle\Container\Section\SectionContainer;
  43. use Lc\CaracoleBundle\Container\Setting\MerchantSettingContainer;
  44. use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer;
  45. use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
  46. use Lc\CaracoleBundle\Container\User\UserPointSaleContainer;
  47. use Lc\CaracoleBundle\Container\User\VisitorContainer;
  48. use Lc\SovBundle\Container\ComponentContainer;
  49. use Lc\SovBundle\Container\File\FileContainer;
  50. use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
  51. use Lc\SovBundle\Container\Reminder\ReminderContainer;
  52. use Lc\SovBundle\Container\Setting\SiteSettingContainer;
  53. use Lc\SovBundle\Container\Site\NewsContainer;
  54. use Lc\SovBundle\Container\Site\PageContainer;
  55. use Lc\SovBundle\Container\Site\SiteContainer;
  56. use Lc\SovBundle\Container\Ticket\TicketContainer;
  57. use Lc\SovBundle\Container\Ticket\TicketMessageContainer;
  58. use Lc\SovBundle\Container\User\GroupUserContainer;
  59. use Lc\SovBundle\Container\User\UserContainer;
  60. use Lc\SovBundle\Solver\Setting\SettingSolver;
  61. use Psr\Log\LoggerInterface;
  62. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as SfAbstractController;
  63. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  64. use Symfony\Component\HttpFoundation\Request;
  65. use Symfony\Component\HttpFoundation\RequestStack;
  66. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  67. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  68. use Symfony\Component\Security\Core\Security;
  69. use Symfony\Contracts\Translation\TranslatorInterface;
  70. class AbstractController extends SfAbstractController
  71. {
  72. public static function getSubscribedServices()
  73. {
  74. return array_merge(
  75. parent::getSubscribedServices(),
  76. [
  77. Security::class => Security::class,
  78. EntityManagerInterface::class => EntityManagerInterface::class,
  79. UrlGeneratorInterface::class => UrlGeneratorInterface::class,
  80. SessionInterface::class => SessionInterface::class,
  81. PaginatorInterface::class => PaginatorInterface::class,
  82. RequestStack::class => RequestStack::class,
  83. EventDispatcherInterface::class => EventDispatcherInterface::class,
  84. TranslatorInterface::class => TranslatorInterface::class,
  85. LoggerInterface::class => LoggerInterface::class,
  86. SettingSolver::class => SettingSolver::class,
  87. ComponentContainer::class => ComponentContainer::class,
  88. FileContainer::class => FileContainer::class,
  89. NewsletterContainer::class => NewsletterContainer::class,
  90. ReminderContainer::class => ReminderContainer::class,
  91. NewsContainer::class => NewsContainer::class,
  92. PageContainer::class => PageContainer::class,
  93. SiteContainer::class => SiteContainer::class,
  94. TicketContainer::class => TicketContainer::class,
  95. TicketMessageContainer::class => TicketMessageContainer::class,
  96. GroupUserContainer::class => GroupUserContainer::class,
  97. UserContainer::class => UserContainer::class,
  98. SiteSettingContainer::class => SiteSettingContainer::class,
  99. ]
  100. );
  101. }
  102. public function getReferer(Request $request): ?string
  103. {
  104. return $request->headers->get('referer');
  105. }
  106. public function getEntityManager(): EntityManagerInterface
  107. {
  108. return $this->get(EntityManagerInterface::class);
  109. }
  110. public function getRouter(): UrlGeneratorInterface
  111. {
  112. return $this->get(UrlGeneratorInterface::class);
  113. }
  114. public function getSession(): SessionInterface
  115. {
  116. return $this->get(SessionInterface::class);
  117. }
  118. public function getSecurity(): Security
  119. {
  120. return $this->get(Security::class);
  121. }
  122. public function getPaginator(): PaginatorInterface
  123. {
  124. return $this->get(PaginatorInterface::class);
  125. }
  126. public function getRequestStack(): RequestStack
  127. {
  128. return $this->get(RequestStack::class);
  129. }
  130. public function getEventDispatcher(): EventDispatcherInterface
  131. {
  132. return $this->get(EventDispatcherInterface::class);
  133. }
  134. public function getTranslator(): TranslatorInterface
  135. {
  136. return $this->get(TranslatorInterface::class);
  137. }
  138. public function getLogger(): LoggerInterface
  139. {
  140. return $this->get(LoggerInterface::class);
  141. }
  142. public function getSettingSolver(): SettingSolver
  143. {
  144. return $this->get(SettingSolver::class);
  145. }
  146. public function getSettingValue($entity, $settingName)
  147. {
  148. return $this->getSettingSolver()->getSettingValue($entity, $settingName);
  149. }
  150. public function getComponentContainer(): ComponentContainer
  151. {
  152. return $this->get(ComponentContainer::class);
  153. }
  154. public function getFileContainer(): FileContainer
  155. {
  156. return $this->get(FileContainer::class);
  157. }
  158. public function getNewsletterContainer(): NewsletterContainer
  159. {
  160. return $this->get(NewsletterContainer::class);
  161. }
  162. public function getReminderContainer(): ReminderContainer
  163. {
  164. return $this->get(ReminderContainer::class);
  165. }
  166. public function getNewsContainer(): NewsContainer
  167. {
  168. return $this->get(NewsContainer::class);
  169. }
  170. public function getPageContainer(): PageContainer
  171. {
  172. return $this->get(PageContainer::class);
  173. }
  174. public function getSiteContainer(): SiteContainer
  175. {
  176. return $this->get(SiteContainer::class);
  177. }
  178. public function getTicketContainer(): TicketContainer
  179. {
  180. return $this->get(TicketContainer::class);
  181. }
  182. public function getTicketMessageContainer(): TicketMessageContainer
  183. {
  184. return $this->get(TicketMessageContainer::class);
  185. }
  186. public function getGroupUserContainer(): GroupUserContainer
  187. {
  188. return $this->get(GroupUserContainer::class);
  189. }
  190. public function getUserContainer(): UserContainer
  191. {
  192. return $this->get(UserContainer::class);
  193. }
  194. public function getSiteSettingContainer(): SiteSettingContainer
  195. {
  196. return $this->get(SiteSettingContainer::class);
  197. }
  198. }