Example #1
0
 private function initFile($fileName, $handle)
 {
     $this->importFile = new ImportFile();
     $this->importFile->setName($fileName);
     $this->importFile->setHandle($handle);
     //define new handle for line count
     $linecount = 0;
     if (($handle2 = fopen($fileName, 'r')) !== false) {
         while (($lineArray = fgetcsv($handle2, null, ';')) != false) {
             $linecount++;
         }
         fclose($handle2);
         $this->importFile->setLineCount($linecount);
     }
     $struc1 = new FileMasterStructure();
     foreach ($this->getParameter('ecortex_product_manager.structures') as $keyItem => $valuesItem) {
         $structure = new StructureItem($keyItem, $valuesItem);
         if ($keyItem != 'master') {
             $findItem = new FindItem($structure->getName());
             $this->importFile->addFindItem($findItem);
         }
         $struc1->addItem($structure);
     }
     $this->importFile->setStructure($struc1);
 }
Example #2
0
 public function addItem(StructureItem $item)
 {
     $this->items[$item->getName()] = $item;
     return $this;
 }