12,028 questions
1
vote
0
answers
47
views
Doctrine ORM metadata for special id to represent no relationship on column that cannot be null in mysql [duplicate]
Hi I'm trying to improve a doctrine entity for it to be able to use doctrine relationships while still reflect the current schema in the database. As per the doctrine recommended practices it is ...
0
votes
1
answer
107
views
How do I join and select from a many-to-many relation?
I have tables Properties and Features with many-to-many relationship PropertiesFeatures (which holds their IDs):
When I select multiple features (feature IDs) as an array, I need all properties which ...
0
votes
0
answers
69
views
Symfony app crashes during Xdebug session at EntityManager proxy, but manual evaluation works
I'm experiencing a strange debugging issue with my Symfony web application where Xdebug causes a crash, but manually evaluating the same code works fine.
Problem Description
When debugging my Symfony ...
0
votes
0
answers
73
views
Loading subcollection of relation entity records in Doctrine
I stumbled upon a problem I would never though I can have, since its trivial to solve using SQL, but since I want to keep things code-oriented, I've tried DQL, QueryBuUildder and Repository approach. ...
1
vote
2
answers
96
views
Doctrine migration ignores UniqueConstraint
Tech stack: Symfony 7.3 + Doctrine 2 + PostgreSQL.
I would like to create unique index for two columns - app_id and user_id - for user_mobile_apps table.
Entity:
declare(strict_types=1);
namespace ...
0
votes
1
answer
120
views
How to configure Doctrine Naming Strategy
I have imported a database to PGSQL that I would like to read from for various things across a site I'm working on, the database uses camel case for tables and columns so while trying to read from the ...
0
votes
2
answers
70
views
PostLoad event listeners don't trigger as expected
I need to have ProductEventListener load ProductVariants and trigger ProductVariantEventListener which will execute some logic and then the ProductEventListener will continue with it's logic. As far ...
0
votes
0
answers
47
views
How create relation one-to-one for doctrine entities in this case?
I want store meta data of products and categories in separated table i.e. creates tables:
meta_data (id, title, description, ...)
products (id, ..., meta_data_id)
categories (id, ..., meta_data_id)
I ...
0
votes
2
answers
107
views
Gedmo/Doctrine Tree Extension Cannot use object as array
I've created an entity with a closure table and a repository alongside. I'm trying a basic example of building a tree but am seeing the error Cannot use object of type App\Entity\Discussion\Comment as ...
0
votes
0
answers
29
views
Symfony 6.4 multiple connections, update not always working
I'm using Symfony 6.4 with multiple connections.
I have 2 databases (P2223 and P2324) with the same datatables struct, but with different data.
My .env:
DATABASE_URL="mysql://root:[email protected]....
2
votes
1
answer
67
views
Symfony Doctrine - How to pass data into a foreign key using fixture?
I recently started learning Symfony, and I've been passing integer values to foreign keys in other projects before, but this is different with Doctrine, as the foreign key methods accept an object, ...
1
vote
1
answer
94
views
Skip a statement in Doctrine migration if there if there is a certain value in a table
I'm in the process of rolling out a feature to all clients, but some clients already have existing data, and I cannot override the content present in their meal_moment table.
I need to create a ...
0
votes
0
answers
20
views
How to get the referencedColumnName for a OneToMany association in Symfony 6?
I need to get the join table column name (ex: underscored_entity_id) for a OneToMany association in Symfony 6.
The metadata associationMappings for a OneToOne has joinColumns which has ...
0
votes
1
answer
118
views
Connect Microsoft Fabrics Warehouse from PHP (here using Doctrine DBAL)
My company is moving all our data to Microsoft Fabrics, which is great, however we have some PHP app who needs to access those datas.
All those apps are using Doctrine DBAL, and we can't find how to ...
1
vote
0
answers
37
views
Table Name in Doctrine QueryBuilder
if I use
$TR = $entityManager->getRepository(Transaction::class);
$cb = $TR->createQueryBuilder('t')
->select('DATE_FORMAT(t.time, "%d. %m. %y") AS date')
->...
0
votes
0
answers
112
views
Symfony 7.2 and Doctrine Migrations with two different databases
I have troubles to execute properly the migrations between two different databases with Doctrine.
Here my Doctrine debug information:
Current configuration for extension with alias "...
0
votes
1
answer
55
views
How to keep selected value in Symfony EntityType if value was deleted by softdeletable?
First of all, I use Gedmo's softdeletable to manage deleted entities. Also I have my own EntityField:
namespace App\Form\Fields;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\...
0
votes
0
answers
48
views
Will Doctrine ORM load the entity in WHERE clause even though it's marked as Extra Lazy?
I have the following table definition for Doctrine ORM:
<entity name="My\Namespace\User" table="users" >
//some fields here, not important
<many-to-one field=&...
-1
votes
1
answer
34
views
Doctrine returns Entity deleted via onDelete: 'cascade'
I'm struggling with a strange issue using a relation having onDelete: 'cascade'.
In a nutshell, I delete the parent object, the cascade works fine in the database, deleting the children too.
Then if I ...
1
vote
1
answer
373
views
Doctrine ghost/proxy objects still getting after disabling enable_lazy_ghost_objects and auto_generate_proxy_classes
In my doctrine configuration I have disabled the auto_generate_proxy_classes and enable_lazy_ghost_objects, but still I am getting ghost objects.
The ghost object which I got is as follows
...
0
votes
1
answer
83
views
Doctrine/Foundry: is it an indicator of bad ORM Entity design, if I mark reverse associations as non nullable?
Just diving deeper into writing Tests for PHP applications and now I'm familiarizing with zenstruck/foundry.
Foundry offers diverse ways of creating entity instances. What causes me problems is the ...
2
votes
1
answer
96
views
Migration error while renaming table in Symfony Doctrine ORM
I have a 'table' that has some constraints, for example that 'table' is referenced by table 'table1'. Then renaming 'table' with #[ORM\Table(name: 'new_table_name')] in PHP class file, making a new ...
-2
votes
1
answer
53
views
Doctrine field is null despite calling the setter
I have a Review Entity that is related to a User Entity through
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'reviews')]
private User $user;
and when trying to save it like this:
$review = ...
1
vote
1
answer
93
views
Doctrine Migrations: Repeatedly Generating the Same ALTER TABLE Statement
I recently upgraded my Symfony project from 5.4 to 6.4.13. Now, I am encountering an issue with Doctrine Migrations in my Symfony project. When I run the doctrine:migrations:diff command, it generates ...
0
votes
0
answers
52
views
DQL query : LOWER function suddenly stopped working [duplicate]
Recently updated a backend service from a Symfony 5.4 / php 7 to a Symfony 6.4 / php 8.3 config.
The database is using Postgresql 14.
Since the doctrine queries I have that include LOWER stopped ...