Remove dotenv implementation from setting of customer privacy policy. #275

This commit is contained in:
Korina Cordero 2019-11-22 03:27:16 +00:00
parent 3babcd765f
commit e462570d9d
3 changed files with 20 additions and 14 deletions

View file

@ -91,6 +91,12 @@ 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)%"
Catalyst\APIBundle\Security\APIKeyUserProvider:
arguments:
$em: "@doctrine.orm.entity_manager"

View file

@ -34,7 +34,7 @@ class ImportPartnersCommand extends Command
protected $em;
public function __construct(Objectmanager $om)
public function __construct(ObjectManager $om)
{
$this->em = $om;

View file

@ -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();