function load(ObjectManager $manager) { /** @var User $riaUser */ $riaUser = $this->getReference('user-ria'); $billingSpec = new BillingSpec(); $billingSpec->setMaster(1); $billingSpec->setName('Flat spec'); $billingSpec->setOwner($riaUser); $billingSpec->setType(BillingSpec::TYPE_FLAT); $billingSpec->setMinimalFee(35); $manager->persist($billingSpec); $this->setReference('ria-flat-spec', $billingSpec); $billingSpec = new BillingSpec(); $billingSpec->setMaster(0); $billingSpec->setName('Tier spec'); $billingSpec->setType(BillingSpec::TYPE_TIER); $billingSpec->setOwner($riaUser); $billingSpec->setMinimalFee(20); $manager->persist($billingSpec); $this->setReference('ria-tier-spec', $billingSpec); $weboUserRia = $this->getReference('user-wealthbot-io-ria'); $billingSpec = new BillingSpec(); $billingSpec->setMaster(false); $billingSpec->setName('Webo Flat Spec'); $billingSpec->setType(BillingSpec::TYPE_FLAT); $billingSpec->setOwner($weboUserRia); $billingSpec->setMinimalFee(10); $manager->persist($billingSpec); $this->setReference('wealthbot-ria-flat-spec', $billingSpec); $billingSpec = new BillingSpec(); $billingSpec->setMaster(true); $billingSpec->setName('Webo Tier Spec'); $billingSpec->setType(BillingSpec::TYPE_TIER); $billingSpec->setOwner($weboUserRia); $billingSpec->setMinimalFee(20); $manager->persist($billingSpec); $this->setReference('wealthbot-ria-tier-spec', $billingSpec); $manager->flush(); /** @var User $client */ $client = $this->getReference('clientN1'); $client->setAppointedBillingSpec($billingSpec); /** @var User $client */ $client = $this->getReference('clientN2'); $client->setAppointedBillingSpec($this->getReference('wealthbot-ria-flat-spec')); /** @var User $client */ $client = $this->getReference('clientN3'); $client->setAppointedBillingSpec($this->getReference('wealthbot-ria-tier-spec')); /** @var User $client */ $client = $this->getReference('clientN4'); $client->setAppointedBillingSpec($this->getReference('wealthbot-ria-tier-spec')); $manager->flush(); }
protected function createAdminBillingSpec($name) { $fee = new Fee(); $fee->setFeeWithoutRetirement(500); $spec = new BillingSpec(); $spec->setMaster(true); $spec->setMinimalFee(300); $spec->setName($name); $spec->setOwner(null); $spec->setType(BillingSpec::TYPE_FLAT); $spec->setFees(array($fee)); $fee->setBillingSpec($spec); $this->em->persist($spec); $this->em->persist($fee); return $spec; }
private function createAdminFees(ObjectManager $manager, User $adminUser) { $fees = array(array('fee_with_retirement' => 0.004, 'fee_without_retirement' => 0.0025, 'tier_top' => Fee::INFINITY)); $adminBillingSpec = new BillingSpec(); $adminBillingSpec->setName('Admin Billing Spec for new RIA'); $adminBillingSpec->setMinimalFee(0); $adminBillingSpec->setType(BillingSpec::TYPE_TIER); $adminBillingSpec->setMaster(true); $adminBillingSpec->setOwner(null); foreach ($fees as $feeRow) { $fee = new Fee(); $fee->setFeeWithRetirement($feeRow['fee_with_retirement']); $fee->setFeeWithoutRetirement($feeRow['fee_without_retirement']); $fee->setTierTop($feeRow['tier_top']); $adminBillingSpec->addFee($fee); } $manager->persist($adminBillingSpec); }