diff --git a/config/services.yaml b/config/services.yaml index c6f2f877..42044b7d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -91,6 +91,17 @@ services: arguments: $geofence_flag: "%env(GEOFENCE_ENABLE)%" + App\Command\SetCustomerPrivacyPolicyCommand: + arguments: + $policy_promo: "%env(POLICY_PROMO)%" + $policy_third_party: "%env(POLICY_THIRD_PARTY)%" + $policy_mobile: "%env(POLICY_MOBILE)%" + + App\Command\CreateCustomerFromWarrantyCommand: + arguments: + $cvu_mfg_id: "%env(CVU_MFG_ID)%" + $cvu_brand_id: "%env(CVU_BRAND_ID)%" + Catalyst\APIBundle\Security\APIKeyUserProvider: arguments: $em: "@doctrine.orm.entity_manager" diff --git a/src/Command/CreateCustomerFromWarrantyCommand.php b/src/Command/CreateCustomerFromWarrantyCommand.php index 9d24fc03..91ae38d1 100644 --- a/src/Command/CreateCustomerFromWarrantyCommand.php +++ b/src/Command/CreateCustomerFromWarrantyCommand.php @@ -34,17 +34,12 @@ class CreateCustomerFromWarrantyCommand extends Command protected $cvu_mfg_id; protected $cvu_brand_id; - public function __construct(ObjectManager $em) + public function __construct(ObjectManager $em, $cvu_mfg_id, $cvu_brand_id) { $this->em = $em; - // get the default ids from .env - // TODO: DO NOT USE $_ENV - $dotenv = new Dotenv(); - $dotenv->loadEnv(__DIR__.'/../../.env'); - - $this->cvu_mfg_id = $_ENV['CVU_MFG_ID']; - $this->cvu_brand_id = $_ENV['CVU_BRAND_ID']; + $this->cvu_mfg_id = $cvu_mfg_id; + $this->cvu_brand_id = $cvu_brand_id; parent::__construct(); } diff --git a/src/Command/ImportPartnersCommand.php b/src/Command/ImportPartnersCommand.php index 526fb282..74e02d5b 100644 --- a/src/Command/ImportPartnersCommand.php +++ b/src/Command/ImportPartnersCommand.php @@ -34,7 +34,7 @@ class ImportPartnersCommand extends Command protected $em; - public function __construct(Objectmanager $om) + public function __construct(ObjectManager $om) { $this->em = $om; diff --git a/src/Command/SetCustomerPrivacyPolicyCommand.php b/src/Command/SetCustomerPrivacyPolicyCommand.php index d4431175..4132fa91 100644 --- a/src/Command/SetCustomerPrivacyPolicyCommand.php +++ b/src/Command/SetCustomerPrivacyPolicyCommand.php @@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Dotenv\Dotenv; use Doctrine\Common\Persistence\ObjectManager; @@ -19,10 +18,19 @@ class SetCustomerPrivacyPolicyCommand extends Command { private $em; - public function __construct(ObjectManager $om) + private $policy_promo_id; + private $policy_third_party_id; + private $policy_mobile_id; + + public function __construct(ObjectManager $om, $policy_promo, + $policy_third_party, $policy_mobile) { $this->em = $om; + $this->policy_promo_id = $policy_promo; + $this->policy_third_party_id = $policy_third_party; + $this->policy_mobile_id = $policy_mobile; + parent::__construct(); } @@ -35,16 +43,8 @@ class SetCustomerPrivacyPolicyCommand extends Command protected function execute(InputInterface $input, OutputInterface $output) { - // get the policy ids from .env - $dotenv = new Dotenv(); - $dotenv->loadEnv(__DIR__.'/../../.env'); - - $policy_promo_id = $_ENV['POLICY_PROMO']; - $policy_third_party_id = $_ENV['POLICY_THIRD_PARTY']; - $policy_mobile_id = $_ENV['POLICY_MOBILE']; - // get third party policy - $third_party_policy = $this->em->getRepository(PrivacyPolicy::class)->find($policy_third_party_id); + $third_party_policy = $this->em->getRepository(PrivacyPolicy::class)->find($this->policy_third_party_id); // get customers on third party $third_party_customers = $this->em->getRepository(Customer::class)->findBy(['priv_third_party' => true]); @@ -54,7 +54,7 @@ class SetCustomerPrivacyPolicyCommand extends Command } // get promo policy - $promo_policy = $this->em->getRepository(PrivacyPolicy::class)->find($policy_promo_id); + $promo_policy = $this->em->getRepository(PrivacyPolicy::class)->find($this->policy_promo_id); // get customers on promo $promo_customers = $this->em->getRepository(Customer::class)->findBy(['priv_promo' => true]); @@ -66,7 +66,7 @@ class SetCustomerPrivacyPolicyCommand extends Command $this->em->flush(); // get mobile policy - $mobile_policy = $this->em->getRepository(PrivacyPolicy::class)->find($policy_mobile_id); + $mobile_policy = $this->em->getRepository(PrivacyPolicy::class)->find($this->policy_mobile_id); // get mobile sessions $mobile_sessions = $this->em->getRepository(MobileSession::class)->findAll();