No thanks, I figured it out. For the sake of other newbies to Doctrine, I will post my results/solutions here soon.
Serge On Friday, April 11, 2014 2:30:35 AM UTC+8, Serge Gregorio wrote: > > I'm new to Doctrine-MongoDB ODM though I know how to use the MongoDB > shell. I would like to know how to use the sample codes contained in the > ff. pages: > > > https://doctrine-mongodb-odm.readthedocs.org/en/latest/tutorials/getting-started.html > > https://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/introduction.html?highlight=Configuration > > The sample codes are listed but it does not tell me: > > 1) What file to save the code as > 2) Where to save them. > > As a result, I occasionally get errors running sample code (e.g. class not > found). It would be nice to have a complete example downloadable as a > single archive file but in its absence, I guess I'll be happy if anyone can > answer my questions below. > > Let's list them down. > > GETTING STARTED PAGE EXAMPLE > > I'm using Windows 7 and I have xampp installed and I created a "project > folder" here: in c:\xampp\htdocs\docmongo. > > 1) Class User - where do I save this? > 2) Class BlogPost - where do I save this? same as User.php? > 3) Mapping information (PHP, XML, or YAML) - again, where do I save these? > under what name? > 4) What changes do I need to make to the code below (bootstrap.php)? Must > I create Proxies and Hydrators folders manually, say, via Windows Explorer? > > What do I put in place of '/path/to/document/classes'? > > > <?php > use Doctrine\MongoDB\Connection;use Doctrine\ODM\MongoDB\Configuration;use > Doctrine\ODM\MongoDB\DocumentManager;use > Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; > AnnotationDriver::registerAnnotationClasses(); > $config = new > Configuration();$config->setProxyDir('/path/to/generate/proxies');$config->setProxyNamespace('Proxies');$config->setHydratorDir('/path/to/generate/hydrators');$config->setHydratorNamespace('Hydrators');$config->setMetadataDriverImpl(AnnotationDriver::create('/path/to/document/classes')); > $dm = DocumentManager::create(new Connection(), $config); > > INTRODUCTION PAGE EXAMPLE > https://doctrine-mongodb-odm.readthedocs.org/en/latest/reference/introduction.html > > 1) The code snippet containing Abstract Class BaseEmployee - where do I save > this? what file name? > 2) The second code snippet (see below) - where do I save this? what file name? > > <?php > $employee = new > Employee();$employee->setName('Employee');$employee->setSalary(50000.00);$employee->setStarted(new > \DateTime()); > .... > > 3) This other code snippet (see below) - were do I save this? what file name? > > <?php$newProject = new Project('Another > Project');$manager->setSalary(200000.00);$manager->addNote('Gave user 100k a > year raise');$manager->incrementChanges(2);$manager->addProject($newProject); > $dm->persist($newProject);$dm->flush(); > ... > > > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
