Category: doctrine

Doctrine Schema update not responding to ORM Mapping: [OK] No Metadata Classes to process

I’m trying to execute schema update with custom entity manager, so I can select witch entity folder to make an schema update. But with my config I cant make it work. I have this config: doctrine: orm: default_entity_manager: default entity_managers:…

How do I manage/close connections if I can’t change max_user_connections variable?

I am using shared hosting that has “max user connections” set to 30. I’ve contacted them and they said they could not change this value. By surfing through my website I get an exception thrown that says: SQLSTATE[42000]: Syntax error…

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…

Doctrine Criteria expression value : static values not seen, QueryException awaiting for parameters

I’m using Doctrine Criteria to avoid repeating some filtering business logic. Since my comparison values are static, I first passed them directly in the ->expr() conditions : /** * @return DoctrineCommonCollectionsCriteria */ public function lastContratCriteria() { $criteria = Criteria::create(); $baseCondition…

expr() method in Doctrine Criteria demand bound parameters, otherwise triggers a QueryException

I’m using Doctrine Criteria class to avoid repeating some filtering business logic. Since my comparison values are static, I first passed them directly in the ->expr() conditions : /** * @return DoctrineCommonCollectionsCriteria */ public function lastContratCriteria() { $criteria = Criteria::create();…

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:-…

Entity with DateTime won’t validate (no Form) [duplicate]

I have an Entity with the following annotations /** * @ORMColumn(type=”utcdatetime”) * @AssertDateTime() * @var DateTime */ private $approvedDate; The constructor in the entity sets the value as a DateTime object: public function __construct() { $utcTZ = new DateTimeZone(‘UTC’); $this->approvedDate…