Category: doctrine-odm

getUser method from Symfony Security can’t get my User Repository

My problem is the $this->getUser(); method (called from Controller) from Symfony Security can’t get my User Repository. The "AppModelODMRepositoryUserRepository" document repository implements "DoctrineBundleMongoDBBundleRepositoryServiceDocumentRepositoryInterface", but its service could not be found. Make sure the service exists and is tagged with "doctrine_mongodb.odm.repository_service"….

Doctrine ODM Unique constraint not validating property

I can’t figure out why Doctrine’s ODM Unique constraint isn’t working for me. Below is a Page Class with the property “title”, that needs to be unique amongst all Pages. namespace AppDocument; use SymfonyComponentValidatorConstraints as Assert; use DoctrineBundleMongoDBBundleValidatorConstraintsUnique as MongoDBUnique;…

Best approach for getting one specific record from an ArrayCollection

I have a “Customer” entity which has a OneToMany relation with “Phones”. Phones has a “IsMain” field to identify which record is the main phone and a “category” field for the type (i.e. mobile, landline, fax). I’m attempting to use…

How to add multiple "AND" conditions in a JOIN

I’m trying to add a “AND” condition to the join query but haven’t been able to figure it out (not sure if it’s even possible via Doctrine/Symfony). I’d appreciate any help with this. ->select(‘c, p’) ->from(Customer::class, ‘c’) ->leftJoin(‘c.phones’, ‘p’) Example:-…

Attempted to call an undefined method named "allowDiskUse" of class "DoctrineODMMongoDBAggregationBuilder

I am trying to get last purchases with item, location and batch. So I tried to get ids of each by grouping. I can’t use group command because it is huge data and can not be handle by group command….