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.
11,980
questions
-1
votes
0
answers
33
views
Postgres enumerated types on Doctrine, with native PHP enums
I am trying to generate database schema using Symfony Doctrine. I want to assign enum type to a column called action which I am unable to do. I have tried two different approaches but both of them ...
0
votes
1
answer
28
views
I get a count() error when I use the greater than, less than or equal to filter
On the books page, I added a filter by the number of authors of books, where I can specify (=n | >n | <n).
public function findPaginated(InterpretationTranslationSourceFilter $filter): ...
0
votes
1
answer
26
views
Symfony database connection to CockroachDB
after several attempts I still don't understand what's happening, I'm trying to connect my database to a CockroachDB database, so I have this in my .env:
DATABASE_URL=postgresql://user:password@...
-2
votes
1
answer
32
views
Can't install Sylius starter project
I'd like to create a Sylius project but I can't install the initial project following the instructions in the documentation.
the command compose
compose create-project sylius/sylius-standard ...
0
votes
0
answers
19
views
Unexpected Doctrine ORM Behavior During Upgrade: Foreign Keys Deleted and Recreated in One-to-Many Relationship with Join Table
I am currently in the process of upgrading my project from Doctrine ORM version 2.13 to version 2.17. During the upgrade, I've noticed a behavior change in the SQL generated by Doctrine schema update ...
0
votes
0
answers
31
views
Symfony error DoctrineMigrationsBundle requires DoctrineBundle to be enabled
I am starting to use Symfony migrations into existing Symfony applications. As mentioned in the documentation I started by installing orm-pack as follows
https://symfony.com/doc/current/doctrine.html
...
-1
votes
0
answers
9
views
how join Entity for two database in Doctrine ORM QueryBuilder?
how join 2 database is joinColumn?
ex code)
class ReportA << datbase 'report'
{
#[Id, Column(options: ['unsigned' => true]), GeneratedValue]
private int $id;
#[ManyToOne(...
-1
votes
0
answers
33
views
Design problem, solve relations implementation between entities with no relationship between them
I'm trying to solve a design issue that I never had with the Symfony framework.
I have an entity named : SimpleAd (with a startdate and a enddate DateTime attributes).
I have an entity named : Event (...
0
votes
1
answer
51
views
Symonfy 6.4 #[AsEntityListener] PostFlush doesn't work
Working now with symfony 6.4 I'm trying to convert some on my service definition (.yml) into php attributes.
What I'm doing is deleting the service definition of an EntityListener and replacing it ...
1
vote
2
answers
39
views
Symfony Doctrine Migrations - Use transactions to wrap migrations
What I want to do : For every migrations executed with php bin/console doctrine:migrations:migrate to be wrapped in a proper transaction (START TRANSACTION / BEGIN / ROLLBACK / ...).
My config/...
0
votes
0
answers
23
views
Setting timeout attribute in Doctrine / mysql PDO does not work
I'm trying to set a timeout for queries to my MySql database. I'm using Doctrine in Symfony normally, but even when creating a plain PDO connection it's not working. I've already seen several ...
0
votes
0
answers
10
views
FOSElastica "Cannot find corresponding Doctrine objects for all Elastica results" - delete the missing one
I have a big cms project done in symfony+doctrine+foselastica.
Sometimes, if a db persistence is missing I get an exception like "Cannot find corresponding Doctrine objects for all Elastica ...
1
vote
0
answers
100
views
Symfony 6.3 is not reading my .env-file, what do I need to do?
I created a Symfony 6.3 application and just came across the issue, that ENV-variables will not be loaded from the local ".env"-file
I have a file ".env" in the projects root ...
1
vote
0
answers
39
views
Id not found when changing a OneToMany relation to a ManyToMany relation
I have a working OneToMany relation between my class Devis and my class Dossier.
This is my class Devis:
/**
* @ORM\Entity
* @ORM\Table(name="devis")
* @ORM\Entity(repositoryClass="...
1
vote
1
answer
24
views
Easy admin 4 AssociateField doctrine ($object) must be of type object, string given
When creating an easy admin association field I get the following error
TypeError:
get_class(): Argument #1 ($object) must be of type object, string given
at
vendor\doctrine\common\src\Util\...
0
votes
0
answers
24
views
Symfony 6: Doctrine Retains Old Database Values After Switching – How to Disable Caching?
I have set up a configuration in my Symfony 6 application that uses multiple SQLite databases. To switch between databases, I change the symbolic link of the file , which works well except in the ...
0
votes
1
answer
90
views
Add filters to api request in Symfony 6
some time ago I saw one symfony project that allows frontend to make filtered api requests using a syntax I like: property[operator]=value for example date[gte]=value etc..
I'm sure they don't use api ...
1
vote
1
answer
42
views
Symfony API search for localized products
Sorry if the title is not clear I don't know how to say it.
I use doctrine translatable to translate a Product in different languages like fr and en.
And I want to add a basic search functionality to ...
0
votes
1
answer
33
views
Bad database name configuration on symfony
I must take back a little website for an association but i have trouble setting up my development environment.
I successfully retrieved the code
I just have to launch a docker-compose up inside to ...
0
votes
1
answer
87
views
Symfony: A cycle has been detected, so a topological sort is not possible
When trying to delete a user in my Symfony 6.3 app, I got the following message: A cycle has been detected, so a topological sort is not possible. The getCycle() method provides the list of nodes that ...
-1
votes
0
answers
17
views
How to use a secured workflow with command
I'm using a workflow to update the statuses of Doctrine entities, and it works like a charm. My workflows are secured with voters, and some transitions can only be applied by users with a specific ...
0
votes
0
answers
11
views
Failed to create object: error for Sonata_admin in Symfony 4
I get a very strange error when trying to create a new user using UserBundle with sonata-admin :
Failed to create object: App\Application\Sonata\UserBundle\Entity\User
with this error too when ...
0
votes
1
answer
33
views
manager's remove function delete two object
Symfony 6.4
Here is my architecture is :
PROPOSITION : PK(TESTID,RUBRIQUEID,QUESTIONID,PROPOSITIONID)
I'm trying to delete a proposition with Symfony's EntityManagerInterface but two propositions are ...
0
votes
0
answers
71
views
Access denied to create a test database
I don´t understand why user is allowed to create a dev database while he is not to create a test one.
At the root of my project :
docker-compose
db:
image: mysql:5.7
environment:
- ...
-1
votes
0
answers
26
views
Doctrine: Cascade persists for OneToOne does not persist associated data
I'm trying to persist a new user together with a user profile, for some reason only the user record is saved but no user profile at all. To be honest, I struggle to understand how to configure the ...
0
votes
1
answer
23
views
Symfony 4: entity relation cascade "remove" Doctrine doesn't detect change
I have an entity which had this relation:
/**
* @ORM\OneToOne(targetEntity="App\Entity\Contract", inversedBy="childContract", cascade={"persist", "remove"})
*/...
0
votes
1
answer
117
views
How to make EntityManager's flush to flush only certain entity instances?
My issue is that EntityManager's flush method is writing in the database all the operations buffered by the persist method. No problem with that, BUT sometimes changes get written in other context ...
0
votes
1
answer
55
views
Laravel upgrade 5 to 10 after update getDoctrineColumn getType query takes too long to execute
Laravel upgrade 5 to 10 after update getDoctrineColumn getType query takes too long to execute
DB::connection()
->getDoctrineColumn(self::getTableName(), $col)
->getType()
->getName()
above ...
0
votes
0
answers
23
views
Cannot save new record in join table with DOCTRINE
I have tree tables: delivery_providers, delivery_cost_schemas and delivery_cost_schemas_providers that joins them. I created classes for each of them but I need to exclude delivery_providers from ...
0
votes
0
answers
30
views
Symfony, Doctrine and Oracle Date field
I have a Symfony 6 project with a Doctrine Entity that is tied to an Oracle database and I've listed the column definition and setter/getters below. The Oracle column type is Date and is formatted as ...
1
vote
1
answer
92
views
Unwanted query triggered when using a composite key on a self-referencing entity
I am encountering a strange issue and cannot understand why this is happening.
I have an entity that is using a composed primary key on the instance and rid fields.
I also have parent as a self ...
0
votes
1
answer
52
views
(Symfony project) Doctrine error: A new entity was found through the relationship. Ecountered when running messageBus async (sync works fine)
I know many people asked this type of question but I believe mine is different because I only encouter the error when trying to run the message async.
This is just a project for personal use to try to ...
1
vote
0
answers
24
views
How to add views to exception doctrine
When I run the composer command test:prepare I get an error
An exception occurred while executing 'TRUNCATE v_my_views CASCADE'
SQLSTATE[42809]: Wrong object type: 7 ERROR: "v_my_views" is ...
0
votes
1
answer
82
views
How to implement One To Many (Polymorphic) in symfony
Hi I have three entities User, Admin, Log
Both the admin and user have many logs.
Each log has one owner might be Usermight be Admin.
In this case, I was searching for a similar system as Laravel ...
0
votes
0
answers
44
views
Symfony doctrine Redis Cache not working as expected
I have an issue in symfony, with Redis cache. For some purposes I set that Doctrine cache goes into Redis. This is setting:
doctrine:
orm:
auto_generate_proxy_classes: false
...
0
votes
0
answers
22
views
Unable to reverse value for property path "meeting": The choice "340" does not exist or is not unique
My question is in title. I have had read the same case but doesn't help me.
I want to display a sion click field on a radio button. If a match is made, then there is a fill. If there is no match, then ...
0
votes
1
answer
14
views
Fetch Doctrine entities which have no relations
I have two Doctrine Entities (Entry and File) which are connected with a ManyToMany relation:
An entry can have many files and vice versa.
Now I want to retrive all files which don't belong to any ...
0
votes
0
answers
44
views
Symfony, doctrine JoinTable condition
I have encountered a problem with JoinTable attribute in doctrine.
#[JoinTable(
name: 'table_name',
joinColumns: [
new JoinColumn(name: 'join_id', ...
3
votes
1
answer
64
views
php vendor/bin/doctrine [Warning] The use of this script is discouraged. - Why?
I'm using Doctrine ORM in my PHP project and I ran the following command to validate my schema:
php vendor/bin/doctrine orm:validate-schema
After running the command, I received a warning that says:
[...
0
votes
1
answer
52
views
How to change updatedAt value without Doctrine lifecycle callback updating it just after?
Some entities have an updatedAt field which value is well updated through prePersist and preUpdate Doctrine lifecycle callbacks.
But when setting up my project, I populate my db with AliceDataFixtures ...
0
votes
0
answers
129
views
"App\Entity\Groups" object not found by "Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver"
I have a Repository function that gets called via AJAX that updates a field in the database that throws the error ""App\Entity\Groups" object not found by "Symfony\Bridge\Doctrine\...
0
votes
1
answer
26
views
how to handle morph relation with doctrine
i have an Entity that contains morph relation to represent relation with different Entities.
for example
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class BinderContent
{
/**
* @...
-1
votes
1
answer
53
views
Why is this Code broke the rules of Doctrine Symfony?
AssetId is always the same on the apple item
$items = ['apple', 'banana', 'orange', 'strawberry', 'apple', 'apple', 'banana', 'orange', 'banana'];
$itemRepository = $this->entityManager->...
0
votes
1
answer
43
views
Implementing custom OrderBy for ManyToOne relation
Unfortunately, the OrderBy attribute is not supported for ManyToOne relations.
Is there a way to implement a custom one? Similar to the Attributes approach?
I already tried SQLFilter but as it turns ...
0
votes
3
answers
138
views
symfony doctrine orm mappings wildcard
Symfony 6.3
I want to place entities in multiple subfolders, for now i have a config like this:
doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm....
1
vote
1
answer
124
views
Symfony Doctrine: check connection to a database
Since a while checking a connection to a database in a controller was working fine doing the following:
$em->getConnection()->connect();
$connected = $em->getConnection()->isConnected();
...
0
votes
1
answer
43
views
How to save two relation entities in Doctrine?
I'm doing a user registration. I have two entities: User, UserCredential
#[Entity, Table(name: 'user')]
#[HasLifecycleCallbacks]
class UserEntity implements JsonSerializable
{
const INACTIVE = 0;
...
0
votes
0
answers
48
views
Static functions in Symfony Entities, while passing EntityManagerInterface?
I'm currently designing my own service using Symfony, Doctrine and MySQL. I have several Entities, which allow fast database interaction. The project is for creating and managing sports tournaments ...
0
votes
1
answer
47
views
Get last 10 rows with query builder and order them by another column
I have a table called Invoice. It has 3 fields. id, createdAt and amount.
I am developing with Symfony PHP framework.
I want to create a query builder which returns the 10 last created rows and order ...
0
votes
1
answer
21
views
Doctrine cascade "remove" doesn't delete rows after emptying ManyToOne owner's collection
I have the following two entities:
/** @Entity @Table(name="invoice") */
class Invoice {
/** @Id @Column(type="integer") @GeneratedValue */
protected $id;
...
/** @...