Questions tagged [doctrine]

The Doctrine Project is a collection of open source libraries and tools for dealing with database abstraction and Object-Relational Mapping written in PHP.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Is there way in Doctrine2 ORM to track changes of nested entities of aggregate?

For example, we have the following entity: class Post { ... /** * @var Photo|null * @ORM\ManyToOne(targetEntity="Photo", cascade={"persist"}) */ public $lede; /** ...
0
votes
1answer
16 views

Symfony 4 - ChoiceType field null when form submitted

I'm trying to pass associative array as options for a ChoiceType field in my OrdreMissionType form : $typeJour = ['Travaillée(s)' => "T", 'Calendaire(s)' => "C"]; $form = $this->createForm(...
0
votes
0answers
12 views

Test symfony doctrine UnitOfWork error only during tests

I have a problem during testing a symfony App with phpunit. I created a service and it works well but when I execute the service in my tests doctrine throw me an exception A new entity was found ...
-2
votes
0answers
12 views

Duplicate definition of column class inherence mapping doctrine

My project contains multiple type of 'Computed'. I try to setup the first one like this: AbtractComputed: <?php namespace App\Entity; use App\Repository\ComputedRepository; use Doctrine\DBAL\...
1
vote
0answers
27 views

How to keep a pre-existing table unchanged when using migrations in Symfony?

I need that Symfony/migration/Doctrine to leave my table untouched. Don't touch her structure at all! I have a pre-existing table (a legacy database) with the id field defined like this: "id bigint ...
0
votes
1answer
22 views

Run Symfony Console Command on Codeception test not persisting changes on db, no errors are thrown

I'm having a weird issue with a test that I'm trying to run. I'm consuming a sqs message subscribe to a topic. The message gets processed and the test pass, but there are no changes on the database ...
0
votes
0answers
13 views

Is there way in Doctrine2 ORM or tool to track changes of nested entities of aggregate? [closed]

For example, we have the following entity: class Post { ... /** * @var Photo|null * @ORM\ManyToOne(targetEntity="Photo", cascade={"persist"}) */ public $lede; /** ...
0
votes
1answer
20 views

Symfony 4, get Logger, get Doctrine, get Rabbit out of the controller

In Symfony 3.3 on the controller I could do: $sendEmailManager = new SendEmailManager($this->container); And in the Manager: private $ container; public function __construct(ContainerInterface $ ...
-1
votes
1answer
33 views

Apply multiples conditions with Doctrine Query Language

In my database, i have a column "refused", she can have 0 or 1 or NULL value. I want to get only rows with 0 and NULL values. I tried this : ->andWhere('b.refused IS NULL') It's okay, but if i ...
0
votes
1answer
41 views

Fetching data from Symfony Doctrine DB

I have just started my first symfony project and im a little bit confused. I would like to query database for Shelfs which have no products on them. I have come up with such sql query which seems to ...
0
votes
0answers
15 views

Doctrine OneToMany - How to get number of entries

I have an entity which contains a OneToMany Relation. /** * @ORM\OneToMany(targetEntity="App\Entity\BookingItem", mappedBy="bookingGroup", orphanRemoval=true) */ private $bookingItems; I create a ...
-1
votes
1answer
31 views

Understanding Symfony 5 Doctrine ManyToOne relation concepts with Users and Roles

I'm trying to understand Doctrine ORM relationship concepts, because I spent lot of time to create, according to me, a very simple use case, but, I didn't manage to do it because I've got a slack of ...
-3
votes
0answers
20 views

Array of bills does not get included when i fetch an Invoice from my database [closed]

Im using symfony, and doctrine for database requests. My invoice entity contains an array of bills, which when i fetch is just empty. It is an ORM/OneToMany relation to the bill entity. bills in the ...
0
votes
1answer
23 views

Eroneous migration file from Symfony

Something weird just happened to me with Symfony. I'm adding a Picture entity with a ManyToOne relation to an existing Article entity. The wizard gave me those modified entities: #App/Entity/Picture....
0
votes
0answers
45 views

DOCTRINE ManyToMany orphanRemoval not working as expected?

i have some problem with manyToMany relation and orphanRemoval. I have two Entities with relations like: class Issuer { /** * @var string * * @ORM\Id * @ORM\Column(type="...
0
votes
1answer
14 views

Object not returning all elements with doctrine

I am dumping this loop variable $document_id: foreach($onboarding_data as $user_id => $document_id) { var_dump($document_id); } and returns an array of elements like it's supposed to: array(4)...
1
vote
1answer
32 views

what's the “ compatibility between ObjectManager and EntityManagerInterface ” in Symfony after update Doctrine?

I have an error after having tried an update ( composer update ) in my Symfony project. I looked for a solution and I found it was necessary to modify the use and the type-hint in the entity and the ...
2
votes
1answer
28 views

How to monitor and to log slow queries in Symfony + Doctrine

I am working on a Symfony 3.4 based project using Doctrine 2.6. Is it somehow possible to automatically monitor all Doctrine queries and log those with an execution time above some threshold? I ...
0
votes
0answers
25 views

Doctrine / SQL Server: Group by YEAR and MONTH

I'm using Symfony 4.4.1 with Doctrine and DoctrineExtensions and I'm trying to retrieve data which is grouped by YEAR and MONTH. The code works on Apache with mySQL but does not on a Windows Server ...
-1
votes
0answers
22 views

Is there a way how to override/implement own update/insert algorithm for doctrine?

Let's say that I have own PDO wrapper, which can handle update/insert/delete actions with rows in database. Their implementation provides some basic logging which I would like to not change at all. Is ...
0
votes
0answers
18 views

nested array element count based on index

my documents are like this {"_id":"5de7fdb37d444b7a49236c83","list_id":[[3,2,4]]} {"_id":"5de7fdb37d444b7a49236c83","list_id":[[2,4]]} {"_id":"5de7fdb37d444b7a49236c83","list_id":[[3,2]]} how can i ...
0
votes
1answer
32 views

Doctrine Associations in symfony

so I have been working with Symfony for a while but there is one thing that bothers. It's about Doctrine Associations. The thing is that I am trying to achieve a user friend invites and relations and ...
0
votes
0answers
9 views

in operator in doctrine mongo odm to find element in array

how do use i use of in operator in doctrine mongo odm to find element in array my collection is like {"_id":"5de65ff03c2a4568e73090aa","list_id":[[2,3]]} i tried and got some result , but not ...
0
votes
1answer
19 views

why i got error inspite of that correctly set value to entity?

Hello my website is made by symfony and mysql. Now im stuck in this error. publisher_id cannot be null. this errror means that publisher_id column of volume table can not be null. this error is ...
0
votes
1answer
26 views

how not to auto increment id after realod fixture?

I'm looking for a way to not increment the id after relaunching my Fixtures. I explained, i made Fixtures, and when I run them the first time the id are for example between 1 and 6 ( its normal ) but ...
0
votes
0answers
12 views

Symfony Restricting The Number of Documents for Multi File Uploads

I'm trying to figure out the most appropriate way to accomplish this. This is a Symfony 3.4 project. It uses a fairly standard multi-file upload, using doctrine's baked in upload functionality, and I ...
0
votes
1answer
37 views

Symfony 1.4 / problem with Doctrine when add new table to schema.yml

I add two tables to db with this schema: Receiptjob: columns: charity_id: integer sf_guard_user_id: integer created_at: timestamp finished_at: timestamp job_type: ...
0
votes
0answers
32 views

prevent the deletion or edition of entity with a listener

I'm using easy-admin in a Symfony application. My entity are managed through Doctrine. I have an entity fieldTemplate linked to entity Field and Position through a Many-To-One relationship. // App\...
0
votes
0answers
17 views

Getting only ID from entity ManyToMany relations without fetching whole object in Doctrine

Say we have the following database structure. The entity Product has ManyToMany associations for the entity Category. I want to make the query for selecting products with identifiers of categories. I ...
0
votes
0answers
13 views

Get domain from email address doctrine?

Got answers for getting domain from email address as sql.But couldn't convert it in doctrine language. The below query works in mysql. SELECT (SUBSTRING_INDEX(SUBSTR(email, INSTR(email, '@') + 1),'.'...
0
votes
1answer
19 views

How to use CASE and SUBSTRING_INDEX in doctrine query?

I have a sql query which is succesfully running in the mysql server and got the output. But I couldn't able to convert this query in the doctrine format. Query is as below SELECT (CASE WHEN seqnum &...
-2
votes
3answers
43 views

How can I update an entity where $id is NOT autogenerated in Doctrine (Symfony 4)?

My Symfony 4 entity has a non-autoincrement ID: /** * @ORM\Entity(repositoryClass="App\Repository\PropertyRepository") */ class Property { /** * @ORM\Id() * @ORM\Column(type="integer")...
-1
votes
0answers
13 views

Symfony Doctrine one Entity with Sortable and Nested

Is possible to use in one entity NestedTree and Sortable ? both require repository extend NestedTreeRepository SortableRepository there is no traits. I see that both setup (in contructor) ...
0
votes
1answer
24 views

Parent-Child order ORM DOCTRINE

I searched the internet and found a few solutions, but none of them worked in ORM Doctrine, it was a bug. I want to achieve the effect as below. Result: Table schema:
0
votes
1answer
15 views

Doctrine use operators in select fields

I try to convert this SQL query to QueryBuilder code : SELECT invoice.id, COALESCE(invoice.remainingAmount, 0) = 0 AS fullyPaid FROM invoice I got that : $qb = $this->createQueryBuilder('invoice'...
0
votes
2answers
20 views

Getting a Syntax error on Doctrine CreateQueryBuilder with multiple SELECT

I have this query below which returns everything as expected. However, when run I get a doctrine syntax error but I cant pintpoint it. Is there a special way to add multiple selects in Doctrine? ...
1
vote
0answers
128 views

How to inject Doctrine Repositories into Symfony 3.4 test cases

I've been following the directions at https://www.tomasvotruba.cz/blog/2017/10/16/how-to-use-repository-with-doctrine-as-service-in-symfony/ to turn my repositories into services that can be injected ...
0
votes
0answers
24 views

Doctrine migration is not respecting entity

I made a new entity in symfony ... class MenuDay { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="...
0
votes
1answer
104 views

Doctrine commands not showing up in Symfony 3.4 console even though doctrine/doctrine-bundle is installed

I have an old Symfony 3.4 app (https://github.com/opencfp/opencfp) that needs to have Doctrine added to it so I can replace an existing auth/acl solution with Symfony Guard and then get moving towards ...
0
votes
1answer
27 views

Getting results with a primary key column showing null in my web-app, but the same SELECT statement in SQL Workbench works fine

When I execute the following mySQLi query statement in mySQL Workbench, it works fine with all the rows having a non-null id values -- which is be because users.id is a primary key column, that may ...
-1
votes
0answers
63 views

Symfony/doctrine cache performance

I am maintaining a symfony 4.3 project which uses doctrine. I have the following caches in use: doctrine metadata and query cache doctrine second level cache a custom tagged cache pool I have ...
0
votes
0answers
26 views

Pagination in an API-Platform project with SQL-Server

I'm trying to create a REST API using API Platform. My API use Doctrine to request data from an SQL Sever 2014 database. I have following the documentation to implement the default item collection ...
0
votes
0answers
16 views

correct way to user document manager commands

I am looking for correct way to user document manager commands (count) in doctrine mongo odm my mongo document is { "_id": "5dde88cd97e54f7c1a38da40", "list_id": [ [ 2 ] ] } ...
0
votes
1answer
23 views

Find in Double Nested Array MongoDB based on index

i want to get count in nested array by index i found one solution but that work if array key has name db.mycollection.find({ "someArray.someNestedArray.name": "value" }) But my double nested ...
0
votes
0answers
18 views

Dynamically creation of index in mongodb using doctrine

Through mongodb I am able to create index using db.collectionName.createIndex({ "$**": "text" },{ name: "TextIndex",language_override: "dummy" }) I want to create index using doctrine in mongodb. ...
1
vote
1answer
50 views

Symfony 4 doctrine use cache even in development environment

I am in development mode (APP_ENV=dev in .env), and everytime I change entities and run the 'make:migration' command, it returns me that there is no database changes. After I run the 'cache:clear' ...
-1
votes
0answers
22 views

How to restore a doctrine database with a cronjob

I have a quite complex web app build with the symfony stack and doctrine. A school has rooms and lessons and so on ... . Now since the app is finished an ready to sell to consumers I want to make ...
0
votes
0answers
17 views

Symfony Doctrine - Delete one of two sub-entities via Ajax and submit form afterwards doubles leftover one

I have a strange behaviour in symfony-doctrine and don't know the reason: I have a form with an entity A with sub-entities RESULT like this: --ENTITY [A] -- attr 1-x -- ADD RESULT -> add Result(s) ...
0
votes
0answers
52 views

foreach query PHP OOP Doctrine Codeigniter

I have 3 tables, one contains document list (id, document, url), one contains onboarding status (user_id, document_id, status) and one contains user list (id, name). In my controller, I have declared ...
1
vote
1answer
28 views

Symfony 4 make entity regenerate : no changes

I updated from symfony 4.3 to symfony 4.4 and since (i think), when i regenerate an entity, the new field added is not regenerated. I add a $new_field in my entity: namespace App\Entity; use ...