Beispiel #1
0
 function load(ObjectManager $manager)
 {
     foreach ($this->models as $index => $item) {
         /** @var CeModel $strategy */
         $strategy = $this->getReference('strategy-' . $item['parent_index']);
         $model = new CeModel();
         $model->setName($item['name']);
         $model->setParent($strategy);
         $model->setRiskRating($item['risk_rating']);
         $model->setType($strategy->getType());
         $manager->persist($model);
         $this->addReference('model-' . ($index + 1), $model);
         foreach ($item['entities'] as $entityItem) {
             /** @var SecurityAssignment $securityAssignment */
             $securityAssignment = $this->getReference('model-security-assignment-' . $entityItem['security_assignment_index']);
             $entity = new CeModelEntity();
             $entity->setModel($model);
             $entity->setSubclass($securityAssignment->getSubclass());
             $entity->setAssetClass($securityAssignment->getSubclass()->getAssetClass());
             $entity->setSecurityAssignment($securityAssignment);
             $entity->setPercent($entityItem['percent']);
             $model->addModelEntity($entity);
         }
     }
     $manager->flush();
 }
Beispiel #2
0
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param \Doctrine\Common\Persistence\ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     foreach ($this->strategyModels as $index => $value) {
         $ceModel = new CeModel();
         $ceModel->setName($value);
         $ceModel->setType(CeModel::TYPE_CUSTOM);
         $ceModel->setRiskRating(0);
         $manager->persist($ceModel);
         $this->addReference('strategy-' . ($index + 1), $ceModel);
     }
     $manager->flush();
 }