doctrine-orm

How to override bundled Doctrine repository in Symfony

大城市里の小女人 提交于 2021-02-07 14:35:13
问题 I have an independent Symfony bundle (installed with Composer) with entities and repositories to share between my applications that connect same database. Entities are attached to every applications using configuration (yml shown): doctrine: orm: mappings: acme: type: annotation dir: %kernel.root_dir%/../vendor/acme/entities/src/Entities prefix: Acme\Entities alias: Acme Well, it was the easiest way to include external entities in application, but looks a bit ugly. Whenever I get repository

How to override bundled Doctrine repository in Symfony

≯℡__Kan透↙ 提交于 2021-02-07 14:34:49
问题 I have an independent Symfony bundle (installed with Composer) with entities and repositories to share between my applications that connect same database. Entities are attached to every applications using configuration (yml shown): doctrine: orm: mappings: acme: type: annotation dir: %kernel.root_dir%/../vendor/acme/entities/src/Entities prefix: Acme\Entities alias: Acme Well, it was the easiest way to include external entities in application, but looks a bit ugly. Whenever I get repository

How to override bundled Doctrine repository in Symfony

北城以北 提交于 2021-02-07 14:34:30
问题 I have an independent Symfony bundle (installed with Composer) with entities and repositories to share between my applications that connect same database. Entities are attached to every applications using configuration (yml shown): doctrine: orm: mappings: acme: type: annotation dir: %kernel.root_dir%/../vendor/acme/entities/src/Entities prefix: Acme\Entities alias: Acme Well, it was the easiest way to include external entities in application, but looks a bit ugly. Whenever I get repository

How to override bundled Doctrine repository in Symfony

被刻印的时光 ゝ 提交于 2021-02-07 14:34:20
问题 I have an independent Symfony bundle (installed with Composer) with entities and repositories to share between my applications that connect same database. Entities are attached to every applications using configuration (yml shown): doctrine: orm: mappings: acme: type: annotation dir: %kernel.root_dir%/../vendor/acme/entities/src/Entities prefix: Acme\Entities alias: Acme Well, it was the easiest way to include external entities in application, but looks a bit ugly. Whenever I get repository

PDO bindValue with \PDO::PARAM_BOOL causes statement execute to fail silently

痴心易碎 提交于 2021-02-07 12:11:38
问题 In one server setup I experience very strange error. There's PHP 5.3.6 with PDO Driver for MySQL, client library version 5.1.61. Everything is compiled by hand. When I bind params with bindValue and set third parameter as \PDO::PARAM_BOOL then statement execute return false and nothing happens (no data inserted to MySQL, even no exception at all). When I don't use third parameter it goes well. In fact I can't ommit third parameter, bacues Doctrine2 DBAL sets it while converting parameters...

How to execute Stored Procedures with Symfony2, Doctrine2

♀尐吖头ヾ 提交于 2021-02-07 07:32:14
问题 I am using the following code: use Doctrine\ORM\Query\ResultSetMapping; ... ... ... ... $em = $this->get( 'doctrine.orm.entity_manager' ); $rsm = new ResultSetMapping(); $query = $em->createNativeQuery( 'CALL procedureName(:param1, :param2)', $rsm ) ->setParameters( array( 'param1' => 'foo', 'param2' => 'bar' ) ); $result = $query->getResult(); //$result = $query->execute(); // Also tried $em->flush(); die(var_dump($result)); I am not getting any thing in the $result parameter. Can anyone

Symfony 5 (Including 4) using Gedmo Doctrine Extension for SoftDelete

前提是你 提交于 2021-02-05 09:26:29
问题 I have tried to use soft delete (Using gedmo/doctrine-extensions) for some Entities in Symfony 5, and got some troubles: Listener "SoftDeleteableListener" was not added to the EventManager! Compile Error: App\Entity\Admin and Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity define the same property ($deletedAt) in the composition of App\Entity\Admin. However, the definition differs and is considered incompatible. Class was composed This is what I tried, and it runs well Install gedmo/doctrine

How to stipulate a range of years using the date field type in doctrine2

て烟熏妆下的殇ゞ 提交于 2021-02-05 06:47:45
问题 I need a date drop down in a Symfony2 site form, and am using the 'date' field type in my form builder. Here is my declaration: $builder->add('date', 'date', array( 'label' => 'Date', 'format' => 'dd MM yyyy', 'required' => true )); By default this will display 5 years in the past and 5 years in the future (i.e. 2010 - 2020) but I need it to start from this year and only show a couple of years in the future, as for this particular form there is no need for a past date or a date too far in the

Doctrine composite primary key as part of the primary key of another entity

最后都变了- 提交于 2021-02-05 05:52:08
问题 I have specific situation where composite primary key of one entity is part of the primary key of another entity. This is case of specialization, but it doesn't matter now. I use Doctrine to generate entities from database, but Doctrine doesn't support composite foreign key as primary key: It is not possible to map entity 'XXXXX' with a composite primary key as part of the primary key of another entity 'YYYYYY#id_xxxxx' Does anyone know solution for this situation? It can be Doctrine solution

How to delete rows from join-table (ManyToMany) in Doctrine?

老子叫甜甜 提交于 2021-02-04 14:23:58
问题 I have a join-table which is created by using @ORM\ManyToMany annotation in Symfony2/Doctrine. It joins Category and Parameter table. Now I want to delete all parameters from the Parameter table. Because there are foreign key constraints defined on join-table I can't just delete rows from Parameter table. First I have to delete child rows from join-table. But Dotrine's DQL syntax require to give a name of the entity, like: DELETE Project\Entity\EntityName But what is the name of the join