Category: doctrine-orm

Symfony 4 quiz style form, embedded collection types

I’m trying to display a quiz style form where end-user gets presented with questions that can have one or multiple correct answers. Entities: Exam Question <?php namespace AppEntity; use DoctrineCommonCollectionsArrayCollection; use DoctrineCommonCollectionsCollection; use DoctrineORMMapping as ORM; use GedmoTimestampableTraitsTimestampableEntity; use RamseyUuidUuidInterface;…

Is it possible to filter the user through roles (a JSON array) in EasyAdmin?

I use EasyadminBundle for the Backend of a Symfony application. I’d like to filter my users through their $roles with 1 table with only the ROLE_WEBMASTER, another on with the ROLE_ADMIN and the final one with the loosers (ROLE_UER). Unfortunately…

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

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();…

Symfony cmd error "The target-entity..cannot be found in.."

I’m starting with Symfony Framework and I am trying to make ManyToMany relationship. But when I try this commandline php bin/console doctrine:schema:update I am getting this error: The target-entity C:xampphtdocssymfony-tpsrcEntityCompetetence cannot be found in ‘AppEntityStagiaire#competencies’. Stagiaire.php <?php namespace AppEntity; use…

What might be causing Doctrine to generate different class aliases in SELECT clause and WHERE clause? Ex: SELECT e0_.id …WHERE u1_.object_id

What might be causing different class aliases to be generated in a simple query? DQL: SELECT log FROM corebasebundleentityuserlog log WHERE log.objectid = :objectId AND log.objectclass = :objectClass ORDER BY log.version DESC SQL SELECT e0_.id AS id_0, e0_.action AS action_1,…