Example #1
0
 /**
  * Constructeur
  *
  * @param Conf    $conf       Configuration for the csv parse (length,
  * delimiter, enclosure)
  * @param Columns $columns    Configuration des colonnes
  * @param string  $connection Chemin du fichier csv
  *
  * @throws Exception Si le fichier source n'existe pas ou n'est pas lisible
  */
 public function __construct(Conf $conf, Columns $columns, $connection)
 {
     parent::__construct($conf, $columns, $connection);
     if (!file_exists($this->connection)) {
         throw new Exception('No csv file founed : "' . $connection . '"');
     }
     if (!is_readable($this->connection)) {
         throw new Exception('Csv file not readable : "' . realpath($connection) . '"');
     }
     if (!isset($this->conf->length)) {
         $this->conf->length = 0;
     }
     if (!isset($this->conf->delimiter)) {
         $this->conf->delimiter = ',';
     }
     if (!isset($this->conf->enclosure)) {
         $this->conf->enclosure = '"';
     }
 }
Example #2
0
 /**
  * Constructor
  *
  * @param Conf               $conf       The configuration
  * @param Columns            $columns    The columns configuration
  * @param DoctrineConnection $connection The connection
  */
 public function __construct(Conf $conf, Columns $columns, DoctrineConnection $connection)
 {
     parent::__construct($conf, $columns, $connection);
     $this->buildQuery();
 }
Example #3
0
 /**
  * Prepare the fetch
  *
  * @return self
  */
 public function fetch()
 {
     return $this->driver->getResponse($this['format']->format($this->source->getData()), $this->source->getCount(), $this->source->getFilteredCount());
 }
Example #4
0
 /**
  * Constructor
  *
  * @param Conf          $conf       The configuration
  * @param Columns       $columns    The columns configuration
  * @param EntityManager $connection The entity manager
  */
 public function __construct(Conf $conf, Columns $columns, EntityManager $connection)
 {
     parent::__construct($conf, $columns, $connection);
     $this->buildQuery();
 }