Le 29/03/2011 04:50, César Hernández a écrit :
Even I have problems with ODM


src/MiEmpresa/MiPrimerNOSQLBundle/Document/Personas.php

<?php
/**
* Personas Document
*/
namespace MiEmpresa\MiPrimerNOSQLBundle\Document;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\PersistentCollection;

/**
   @mongodb:Document(collection="Personas")
 */
class Personas
{
    /**
       @mongodb:Id
     */
    protected $id;

    /**
      @mongodb:Field(type="string")
     */
    protected $nombre;

    /**
     * Get id
     *
     * @return integer $id
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nombre
     *
     * @param string $nombre
     */
    public function setNombre($nombre)
    {
       $this->nombre = $nombre;
    }

    /**
     * Get nombre
     *
     * @return string $nombre
     */
    public function getNombre()
    {
       return $this->nombre;
    }
}

src/MiEmpresa/MiPrimerNOSQLBundle/DataFixtures/MongoDB/MisDatosIniciales.php

<?php

namespace MiEmpresa\MiPrimerNOSQLBundle\DataFixtures\MongoDB;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

use MiEmpresa\MiPrimerNOSQLBundle\Document\Personas;
use RuntimeException;

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

      $user2 = new User();
      $user2->setName('May-lhing Sanchez');
      $manager = $this->get('doctrine.odm.mongodb.document_manager');
This line is weird. The manager is passed as a parameter so why changing it ?
      $manager->persist($user);

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

      $manager->flush();
    }
}

but when I run ...
php app/console doctrine:mongodb:data:load

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

Fatal error: Class 'Doctrine\ODM\MongoDB\Tools\Console\Command\ClearCache\MetadataCommand' not found in /var/www/sf2-pr8-04/vendor/symfony/src/Symfony/Bundle/DoctrineMongoDBBundle/Command/ClearMetadataCacheDoctrineODMCommand.php on line 27
You need to update your ODM vendor to have this class.

--
Christophe | Stof

--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to