doctrine-odm

How to update embedded document in MongoDB with Doctrine ODM

孤街浪徒 提交于 2019-12-08 12:22:32
问题 I'm unable to find how to update embedded documents with Doctrine Mongo ODM in Symfony2. I have a class called Page with many embedded documents "Comments" and I want to use createQueryBuilder to update specific comment. Here is a simple class that I have: class Page { protected $id; /** @MongoDB\EmbedMany */ private $pageComment = array(); } I searched the whole internet, but I don't see to find any info on how to update subdocuments of a document with Doctrine ODM query builder. I will be

example working config for Doctrine ODM zf2 Module? [closed]

你离开我真会死。 提交于 2019-12-08 09:58:25
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . can anyone please provide an example of driver configuration for reading annotation of documents in Application/src/Application/Document/.... created this but still doctrine-module odm:schema:create said all

SonataDoctrineORM - Model extends

本小妞迷上赌 提交于 2019-12-08 08:15:00
问题 I'm using Sonata with SonataAdmin & SonataOrm as told in several tutorials. I simply would like to remove some default method of DoctrineOrmBundle- ModelManager.php I tried to override the ModelManager by putting <?php namespace Project\AdminBundle\Model; use Sonata\DoctrineORMAdminBundle\Model\ModelManager as ModelManager; class ModelManager extends ModelManager { /** * {@inheritdoc} */ public function getSortParameters(FieldDescriptionInterface $fieldDescription, DatagridInterface $datagrid

Symfony2 dynamic forms mongodb

不想你离开。 提交于 2019-12-08 06:20:47
问题 Following the example as documented in the following http://symfony.com/doc/current/cookbook/form/dynamic_form_generation.html I need to populate subcategory field according to the category selection. I don't understand why this error at /article/create: FatalErrorException: Error: Call to a member function getSubCategories() on a non-object the Form : namespace Cc\HitoBundle\Form\Type; … class ArticleType extends AbstractType { private $registrationArticleListener; public function _

Doctrine ODM / MongoDB not retrying queries?

主宰稳场 提交于 2019-12-08 06:17:35
问题 I'm using Doctrine ODM to connect to MongoDB. I have a three node replica set: two fulls and one arbiter. Replication is solely for higher availability, I don't seek to distribute reads across nodes. My application is logging MongoCursorException s every so often with the message not master and slaveok=false . I don't see any evidence that a failover event occurred in the mongodb logs and the primary didn't change. CORRECTION: failover had indeed occurred , but the exception with not master

Weird Doctrine ODM exception when using references together with inheritance

▼魔方 西西 提交于 2019-12-06 07:58:02
I've got three classes. The File-Class has a reference to Foobar and Game inherits from Foobar. There are some other Classes which also inherit from Foobar but i left them out as they aren't relevant here. I also left out some unrelevant fields and their getters and setters. The plan is that every Game has two images, the mainImage and the secondaryImage. I've put those fields into a seperate class from which Game inherits because i need them for a few other classes too. My problem is that if I load the games from the database as soon as i try to iterate over them I get the following exception

MongoDB/doctrine: can't nest $or in $and

别等时光非礼了梦想. 提交于 2019-12-04 06:15:01
I'm having trouble nesting multiple two-operand $or operations within an $and operation. The conclusion of this discussion sounds similar what I need, but I'm unable to get it to work. Here's JavaScript of what I'm trying to do: db.Business.find( { $and: [ { $or: [{nm: /American/}, {dsc: /American/}] }, { $or: [{nm: /Mega/}, {dsc: /Mega/}] } ] } ) That works in the MongoDB interactive shell. And here's some PHP that looks ok to me but doesn't work (causes infinite recursion where indicated): $q = $doctrineOdm->createQueryBuilder('Business'); foreach (array('American','Mega') as $keyword) { $r

how to show data from document to index.phtml in zf2?

喜你入骨 提交于 2019-12-04 05:53:12
问题 i make index action in which i want to get data of calender and show this data using index.phtml but always no calendar shown,how i show calendar data? here is my indexaction: public function indexAction() { $dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default'); $qb = $dm->createQueryBuilder('Calendar\Document\Calendar')->select('title', 'description'); $query = $qb->getQuery(); $calendars = $query->execute(); return array('calendars' => $calendars); } and here is my

JMS Serializer Deserialize with abstract parent class

蹲街弑〆低调 提交于 2019-12-04 03:28:39
I have an abstract parent (mapped super-)class which has several children with different properties which I'd like to deserialize. I'm storing the data using MongoDB and Doctrine ODM, so I also have a discriminator field which tells doctrine which subclass is used (and also have a custom "type" property ontop which is used elsewhere to determine which class is currently processed). When deserializing my model, I get an exception telling me that its impossible to create an instance of an abstract class (ofcourse) - now I'm wondering how I can tell the JMS Deserializer which inherited class it

Doctrine undefined function apc_fetch

我怕爱的太早我们不能终老 提交于 2019-12-03 23:32:34
I'm using this tutorial , which gives a detail explanation about how to set up CodeIgniter and Doctrine. I'm using CodeIgniter 2.1.0 and Doctrine 2.2.1, but I get this error: Fatal error: Call to undefined function Doctrine\Common\Cache\apc_fetch() in /Applications/XAMPP/xamppfiles/htdocs/emma_watson_shrine/application/libraries/Doctrine/Common/Cache/ApcCache.php on line 52 Can you help me out? You need to enable the APC extension for PHP. Follow this guide. Alternatively, you could use a different caching driver, like memcache, and change the Doctrine config in accordance to that. Check the