I am relatively new to using Doctrine, particularly when it comes to creating a MongoDb Model/Collection. I have a field called languages that needs to be an array structured like this: $var = [ array("fname"=>"test","lname"=>"test"), ...
Imagine we have a collection of entities: $entities = $em->getRepository('MyBundle:Entity')->findBy(array('cat' => 1)); What is the most efficient way to retrieve a single entity from this collection by its ID? While iteratin ...
Working with Symfony2, I have a requirement to pass a parameter from the Controller to the FormType. Here is my Action snippet: public function addAction(Request $request) { $employee = $this->getUser(); if (null === $employee) { ...
This code functions properly when used in controllers, but it encounters issues when injected into a command. public function execute(InputInterface $input, OutputInterface $output) { $em = $this->getDoctrine()->getManager(); try { $t ...
This question has been asked multiple times before: Symfony 3.4 and Fixtures Bundle issue with bundle version 3.0 Symfony 3.4.0 Could not find any fixture services to load Symfony Doctrine can't find fixtures to load Could not find any fixture servi ...
I am encountering an issue with the single table inheritance mapping for Doctrine ORM, also known as STI. It appears that having a one-to-many association from the STI entity to another entity is not possible. I have two entities named Customer and Suppl ...
In my database, there is a column named "refused" which can have values of 0, 1, or NULL. I am trying to retrieve rows that only have values of 0 and NULL. My attempt so far has been using the following code: ->andWhere('b.refused IS NULL') While th ...
Currently, I am in the process of importing users from an excel file. To manage this task effectively, I have established an entity manager: $em = $this->getDoctrine()->getManager(); Here is a snippet of the loop I am using for this operation: .. ...
Having an issue in my current project with the TaggableInterface. This interface includes methods for adding, deleting, and retrieving tags. interface TaggableInterface { public function addTag(TagInterface $tag); public function deleteTag(TagInterf ...
I'm encountering a problem that I can't seem to resolve. Ever since updating my dependencies, I've been facing an error related to the ArrayCache in Doctrine. An issue arises at ContainerBuilder.php line 1103: The class "DoctrineCommonCacheArr ...
After following a tutorial, I developed my own custom DQL function. Now I want to write tests for it, but the intricacies of DQL make it challenging. Is there a method available for testing DQL functions? It seems that even the Doctrine project itself do ...
While working on the development of my CMS, I encountered a specific issue that I need assistance with. The error message I am facing is as follows: [Semantical Error] The annotation "@Doctrine\ORM\Mapping\Entity" in class ScyLabs\G ...
What are the benefits of using Doctrine to construct queries like this: <?php // $qb instanceof QueryBuilder $qb->select('u') ->from('User u') ->where('u.id = :identifier') ->orderBy('u.name ASC& ...
After following the instructions provided in https://symfony.com/doc/current/form/embedded.html, I encountered an issue when trying to submit a form containing three entities - Patient, PatientSample, and PatientOrder. The error message stating that patien ...
I have a Symfony 2 project where I've used Doctrine to generate CRUD's for certain entities in my database. Specifically, I have entities named TariffMc and TariffMcServiceMcRelation. A single TariffMc entity can be associated with multiple TariffMcService ...
Within my EntityDefinition, there is an association: ... class ParentEntityDefinition extends EntityDefinition { ... protected function defineFields(): FieldCollection { return new FieldCollection([ (new OneToOn ...
Managing a user database involves storing user information such as name, age, and address. However, one crucial field in the database is created_at, which records the registration time of the user. In traditional PHP code, this can be achieved using: INSE ...
I've been attempting to integrate Doctrine ORM with Silex, but I'm encountering a frustrating challenge due to the inconsistent documentation provided. Upon running vendor/bin/doctrine in the console, the following message is displayed: output: ...
I am facing an issue with fetching notifications for a user entity, specifically UserUser and MiscNotification. I want to be able to retrieve the user's notifications within the User entity by using $user->getNotifications(). Normally, I don't encount ...
When attempting to create my database structure in DB2 using Doctrine, I encountered the following response: >php app/console doctrine:database:create Could not create database "monng" for connection named default Notice: Undefined index: dbname Howev ...
I am facing a challenge in updating specific fields during a save operation, but only when one particular field is being modified. I'm unsure of how to achieve this. Additional information: If a user is editing the 'is_activated' field in m ...
Is there a way to dynamically generate a Doctrine ORM query that mimics the following SQL statement, considering that the number of values in the 'OR' clause may vary with each execution? SELECT * FROM table1 WHERE table1.group = 1 OR 2 OR 3 For in ...
Within my entity, I have a field named linkedDocuments: class Documents { /** * @ORM\ManyToMany(targetEntity="App\Entity\Documents") * @ORM\JoinTable(name="documents_documents", * joinColumns={@JoinColumn(name="link_origi ...