in ORM with the command:
php app/console doctrine:data:load

y initial data in the database
that I have defined in the folder ...Bundle/DataFixtures/ORM /

My question is, how do the same with ODM?
en route
MiEmpresa\MiPrimerNOSQLBundle\DataFixtures/ODM
I have the following code

<?php

namespace MiEmpresa\MiPrimerNOSQLBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use MiEmpresa\MiPrimerNOSQLBundle\Document\User;

class Loadclientes implements FixtureInterface
{
    public function load($em)
    {
      $user1 = new User();
      $user1->setName('Cesar Hernandez');
      $dm = $this->get('doctrine.odm.mongodb.document_manager');
      $dm->persist($user);

      $user2 = new User();
      $user2->setName('May-lhing Sanchez');
      $dm = $this->get('doctrine.odm.mongodb.document_manager');
      $dm->persist($user);

      $user3 = new User();
      $user3->setName('Sebastian Hernandez Sanchez');
      $dm = $this->get('doctrine.odm.mongodb.document_manager');
      $dm->persist($user);

      $dm->flush();
    }
}

but when I run
php app/console doctrine:data:load
me the following error

PHP Fatal error:  Class
'Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand' not found in
/var/www/sf2-pr8-02/vendor/symfony/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/DropSchemaDoctrineODMCommand.php
on line 27

Fatal error: Class
'Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand' not found in
/var/www/sf2-pr8-02/vendor/symfony/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/DropSchemaDoctrineODMCommand.php
on line 27


An additional comment
to prepare my portfolio work
run the following commands

git clone https://github.com/symfony/symfony-standard.git sf2-pr8-01
cd sf2-pr8-01
./bin/vendors.sh
./bin/build_bootstrap.php
php app/console assets:install web/
cd vendor
git clone https://github.com/doctrine/mongodb.git doctrine-mongodb
git clone https://github.com/doctrine/mongodb-odm.git  doctrine-mongodb

Some oriención about ....?
data: load only for ORM?
if not with "data: load" there is a "best practice" to load initial data in
ODM?

Waiting for their comments on
Greetings ...!
-- 
César Hernández
Anzoátegui - Venezuela
dpce...@gmail.com

LinuxCounter: 285.345
CIV: 122.539

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to