private function importInitialData($entityName, $csvDirectory)
    {
        $tableName = $this->entityDefinitions[$entityName]->storage['table'];
        $dataFile  = $csvDirectory . '/' . $tableName . '.csv';

        if (!file_exists($dataFile)) {
            return;
        }

        $entityClass = $this->entityDefinitions[$entityName]->class;
        $repo        = $this->repositoryFactory->forEntity($entityClass);

        foreach ($this->loadData($dataFile) as $row) {
            $entity = $repo->createFromArray($row);
            $repo->add($entity);
        }
    }
private function importInitialData($entityName, $csvDirectory)
    {
        $tableName = $this->entityDefinitions[$entityName]->storage['table'];
        $dataFile  = $csvDirectory . '/' . $tableName . '.csv';

        if (!file_exists($dataFile)) {
            return;
        }

        $entityClass = $this->entityDefinitions[$entityName]->class;
        $repo        = $this->repositoryFactory->forEntity($entityClass);

        foreach ($this->loadData($dataFile) as $row) {
            $entity = $repo->createFromArray($row);
            $repo->add($entity);
        }
    }
private function importInitialData ( $ entityName , $ csvDirectory ) { $ tableName = $ this -> entityDefinitions [ $ entityName ] -> storage [ 'table' ] ; $ dataFile = $ csvDirectory . '/' . $ tableName . '.csv' ; if ( ! file_exists ( $ dataFile ) ) { return ; } $ entityClass = $ this -> entityDefinitions [ $ entityName ] -> class ; $ repo = $ this -> repositoryFactory -> forEntity ( $ entityClass ) ; foreach ( $ this -> loadData ( $ dataFile ) as $ row ) { $ entity = $ repo -> createFromArray ( $ row ) ; $ repo -> add ( $ entity ) ; } }
Import data, if present

@param   string $entityName   The name of the entity
@param   string $csvDirectory The directory containing the sample data

@return  void
Import data if present