Ejemplo n.º 1
0
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // this up() migration is auto-generated, please modify it to your needs
     $em = $this->container->get('doctrine')->getManager();
     $dataSet = ['A.P. Moller–Maersk Group' => ['MAEU' => 'Maersk Line'], 'CMA CGM S.A.' => ['CGMU' => 'CMA-CGM']];
     foreach ($dataSet as $k => $v) {
         $organization = $em->getRepository('CoreBundle:Organization')->findOneBy(['name' => $k]);
         foreach ($v as $i => $j) {
             $subcontractor = new Subcontractor();
             $subcontractor->setOrganization($organization);
             $subcontractor->setCode($i);
             $subcontractor->setName($j);
             $em->persist($subcontractor);
         }
     }
     $em->flush();
     $em->clear();
 }
Ejemplo n.º 2
0
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     $em = $this->container->get('doctrine')->getManager();
     $dataSet = ['APL' => ['APL' => 'American President Lines']];
     foreach ($dataSet as $k => $v) {
         $organization = new Organization();
         $organization->setName($k);
         $em->persist($organization);
         foreach ($v as $i => $j) {
             $subcontractor = new Subcontractor();
             $subcontractor->setOrganization($organization);
             $subcontractor->setCode($i);
             $subcontractor->setName($j);
             $em->persist($subcontractor);
         }
     }
     $em->flush();
     $em->clear();
 }
Ejemplo n.º 3
0
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // this up() migration is auto-generated, please modify it to your needs
     $em = $this->container->get('doctrine')->getManager();
     $dataSet = ['Sogeco' => ['SOGECO' => 'Sogeco'], 'CAI (Container Applications International)' => ['CAI' => 'CAI (Container Applications International)'], 'Textainer' => ['TEXTAINER' => 'Textainer'], 'TAL International Container Corporation' => ['TAL' => 'TAL International Container Corporation'], 'Beacon Intermodal' => ['BEACON' => 'Beacon Intermodal'], 'Triton Container International Limited' => ['TRITON' => 'Triton Container International Limited']];
     $service = $em->getRepository('CoreBundle:SubcontractorService')->findOneBy(['code' => 'CONTAINERLEASING']);
     foreach ($dataSet as $k => $v) {
         $organization = $em->getRepository('CoreBundle:Organization')->findOneBy(['name' => $k]);
         foreach ($v as $i => $j) {
             $subcontractor = new Subcontractor();
             $subcontractor->setOrganization($organization);
             $subcontractor->setCode($i);
             $subcontractor->setName($j);
             $subcontractor->setService($service);
             $em->persist($subcontractor);
         }
     }
     $em->flush();
     $em->clear();
 }
Ejemplo n.º 4
0
 /**
  * @param Schema $schema
  */
 public function up(Schema $schema)
 {
     // this up() migration is auto-generated, please modify it to your needs
     $em = $this->container->get('doctrine')->getManager();
     $dataSet = ['MAGELLAN MARITIME SERVICES GMBH' => ['MAGELLAN' => 'MAGELLAN MARITIME SERVICES GMBH'], 'UES INTERNATIONAL (HK) HOLDINGS LIMITED' => ['UES' => 'UES INTERNATIONAL (HK) HOLDINGS LIMITED'], 'SEACO SRL' => ['SEACO' => 'SEACO SRL'], 'FLORENS CONTAINER SERVICES CO LTD' => ['FLORENS' => 'FLORENS CONTAINER SERVICES CO LTD'], 'SEACUBE CONTAINER LEASING' => ['SEACUBE' => 'SEACUBE CONTAINER LEASING'], 'TOUAX' => ['TOUAX' => 'TOUAX'], 'GRAND VIEW CONTAINER TRADING (HK) CO LTD' => ['GRANDVIEW' => 'GRAND VIEW CONTAINER TRADING (HK) CO LTD']];
     $service = $em->getRepository('CoreBundle:SubcontractorService')->findOneBy(['code' => 'CONTAINERLEASING']);
     foreach ($dataSet as $k => $v) {
         $organization = $em->getRepository('CoreBundle:Organization')->findOneBy(['name' => $k]);
         foreach ($v as $i => $j) {
             $subcontractor = new Subcontractor();
             $subcontractor->setOrganization($organization);
             $subcontractor->setCode($i);
             $subcontractor->setName($j);
             $subcontractor->setService($service);
             $em->persist($subcontractor);
         }
     }
     $em->flush();
     $em->clear();
 }
 /**
  * add vehicle if not exist
  * @param string $vessel
  *
  * @return Vehicle|null
  */
 protected function addVehicle($vessel, Subcontractor $subcontractor)
 {
     $vehicle = null;
     if ($vessel) {
         $vehicle = $this->_em->getRepository('CoreBundle:Vehicle')->findOneBy(['subcontractor' => $subcontractor->getId(), 'name' => $vessel]);
         if (!$vehicle) {
             $vehicle = new Vehicle();
             $vehicle->setName($vessel)->setSubcontractor($subcontractor);
             $this->_em->persist($vehicle);
         }
     }
     return $vehicle ?: null;
 }