|
After setting up the ZF2 DoctrineMongoODMModule and successfully
creating documents. I'm unable to retrieve http://stackoverflow.com/questions/10417400/zf2-with-doctrine-mongo-odm A sample Entity class is show below. I'm also having trouble using the CLI commands i.e.: ./vendor/DoctrineModule/bin/doctrine odm:generate:documents ./module/Application/src/Application/ produces following error: PHP Notice: Trying to get property of non-object in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php on line 48 Notice: Trying to get property of non-object in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php on line 48 PHP Fatal error: Uncaught exception 'Exception' with message ' Doctrine could not be autoloaded - ensure it is in the correct path. ' in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php:62 Stack trace: #0 [internal function]: DoctrineMongoODMModule\Module->modulesLoaded(Object(Zend\Module\ModuleEvent)) Any help is appreciated. ----------------- sample doc ----------------- namespace Application\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; /** * @ODM\Document * @ODM\DiscriminatorField(fieldName="type") * @ODM\DiscriminatorMap({"page"="Page", "product"="Product"}) * */ class Page { /** @ODM\Id */ private $id; /** * @ODM\Field(type="string") */ private $name; /** * @return the $id */ public function getId () { return $this->id; } /** * @param field_type $id */ public function setId ($id) { $this->id = $id; } /** * @return the $name */ public function getName () { return $this->name; } /** * @param field_type $name */ public function setName ($name) { $this->name = $name; } } -- ======================= Ron Dyck President Webbtech [hidden email] www.webbtech.net twitter.com/pulpfree ======================== |
|
I'm still struggling with the CLI issue even after pulling latest. I'm
using the modules DoctrineModule and DoctrineMongoODMModule. Error: PHP Notice: Trying to get property of non-object in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php on line 48 Notice: Trying to get property of non-object in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php on line 48 PHP Fatal error: Uncaught exception 'Exception' with message ' Doctrine could not be autoloaded - ensure it is in the correct path. ' in /var/www/SiteTpl/vendor/DoctrineMongoODMModule/Module.php:62 Stack trace: #0 [internal function]: DoctrineMongoODMModule\Module->modulesLoaded(Object(Zend\Module\ModuleEvent)) -- ======================= Ron Dyck Webbtech [hidden email] www.webbtech.net twitter.com/pulpfree ======================== |
|
Weird!
Can you please report it at https://github.com/doctrine/DoctrineMongoODMModule ? Anyway, Row 48 ( https://github.com/doctrine/DoctrineMongoODMModule/blob/master/Module.php#L48 ) also reports that it is looking for a config key. Did you copy the config file from https://github.com/doctrine/DoctrineMongoODMModule/blob/master/config/module.doctrine_mongodb.config.php.dist and put it in your config/autoload dir in your application (removing ".dist")? Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 3 May 2012 14:48, Ron Dyck <[hidden email]> wrote: I'm still struggling with the CLI issue even after pulling latest. I'm |
|
This post has NOT been accepted by the mailing list yet.
On Thu, May 3, 2012 at 8:59 AM, Marco Pivetta [via Zend Framework
Community] <[hidden email]> wrote: > Weird! > Can you please report it at > https://github.com/doctrine/DoctrineMongoODMModule ? I will. > Anyway, Row 48 ( > https://github.com/doctrine/DoctrineMongoODMModule/blob/master/Module.php#L48 > ) also reports that it is looking for a config key. > Did you copy the config file from > https://github.com/doctrine/DoctrineMongoODMModule/blob/master/config/module.doctrine_mongodb.config.php.dist > and put it in your config/autoload dir in your application (removing > ".dist")? Yes, I'm able to connect to db and create records however I cannot retrieve them. > Marco Pivetta -- ======================= Ron Dyck President Webbtech [hidden email] www.webbtech.net twitter.com/pulpfree ======================== |
|
In reply to this post by Marco Pivetta
It sounds like your autoloader isn't set up right. Make sure you've correctly registered the namespaces for both libraries...
I have a ZF1 / DoctrineMongoODM integration all up and running ok. My autoloader is set up like so;
$loaders = array( 'Doctrine\ODM\MongoDB' => realpath(APPLICATION_PATH . '/../library'), 'Doctrine\MongoDB' => realpath(APPLICATION_PATH . '/../library'),
.... other libs .... ); foreach ($loaders as $namespace => $path) { $classLoader = new Doctrine\Common\ClassLoader($namespace, $path); $classLoader->register();
} I also have a small application resource class for firing up the mongoDB ODM. There are a number of things yet to be added (event manager / custom types / hydrators etc) but works fine for what I need it to do for now.
Maybe there are a few things in there that can help you with your set up.
____application.ini ____ resources.mongodb.proxy.dir = APPLICATION_PATH "/models/Documents/Proxies" resources.mongodb.proxy.autoGenerateClasses = false resources.mongodb.proxy.namespace = "Documents\Proxies"
resources.mongodb.hydrators.dir = APPLICATION_PATH "/models/Documents/Hydrators" resources.mongodb.hydrators.autoGenerateClasses = false resources.mongodb.hydrators.namespace = "Documents\Hydrators"
resources.mongodb.documents.dir = APPLICATION_PATH "/models" resources.mongodb.documents.namespace = "Documents" resources.mongodb.repositories.dir = APPLICATION_PATH "/models/Documents"
resources.mongodb.repositories.namespace = "Documents\Repositories" resources.mongodb.metadata.driver = "annotation" resources.mongodb.metadata.paths[] = APPLICATION_PATH "/models/Documents"
resources.mongodb.cache.metadata = "\Doctrine\Common\Cache\ApcCache" resources.mongodb.params.configpath = APPLICATION_PATH "/configs/mongodb.ini" ; development overrides..
resources.mongodb.cache.metadata = "\Doctrine\Common\Cache\ArrayCache" resources.mongodb.hydrators.autoGenerateClasses = true On Thu, May 3, 2012 at 1:58 PM, Marco Pivetta <[hidden email]> wrote: Weird! |
|
Hey lee, this is about Zend Framework 2 :) Not about ZF1!
The module should handle this, so I'm gonna dig in it as soon as possible ;) Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 3 May 2012 16:40, Lee Davis <[hidden email]> wrote: It sounds like your autoloader isn't set up right. Make sure you've correctly registered the namespaces for both libraries... |
| Powered by Nabble | Edit this page |
