Added MongoDB support.

I've opened issue #81 related to this PR
Done!

19.06.2014 9:52, Markus Bachmann пишет:
>
> In src/Ddeboer/DataImport/Writer/DoctrineWriter.php:
>
> > @@ -231,10 +239,16 @@ public function writeItem(array $item)
> >       */
> >      protected function truncateTable()
> >      {
> > -        $tableName = $this->entityMetadata->table['name'];
> > -        $connection = $this->entityManager->getConnection();
> > -        $query = $connection->getDatabasePlatform()->getTruncateTableSQL($tableName);
> > -        $connection->executeQuery($query);
> > +        if ($this->objectManager instanceof \Doctrine\ORM\EntityManager) {
> > +            $tableName = $this->objectMetadata->table['name'];
> > +            $connection = $this->objectManager->getConnection();
> > +            $query = $connection->getDatabasePlatform()->getTruncateTableSQL($tableName);
> > +            $connection->executeQuery($query);
> > +        } elseif ($this->objectManager instanceof \Doctrine\ODM\MongoDB\DocumentManager) {
> > +            $this->objectManager->getDocumentCollection($this->objectName)->remove(array());
> > +        } else {
> > +            throw new UnsupportedDatabaseTypeException();
>
> Please add a message
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/ddeboer/data-import/pull/83/files#r13955428>.
>