[DDC-1201] DQL Example about count(*) related entity is wrong Created: 10/Jun/11 Updated: 10/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
DQL Example about count |
| Comments |
| Comment by Aigars Gedroics [ 10/Oct/11 ] |
|
Also similar DQL in documentation URL http://www.doctrine-project.org/docs/orm/2.1/en/reference/dql-doctrine-query-language.html#pure-and-mixed-results fails parsing stage: $dql = "SELECT u, 'some scalar string', count(u.groups) AS num FROM User u JOIN u.groups g GROUP BY u.id";
with error [Doctrine\ORM\Query\QueryException] [Semantical Error] line 0, col 40 near 'localizations)': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected. Should be "count(g.id)" instead of "count(u.groups)". |
[DDC-1025] Please repalce 'Doctrine\XXX\YYY' with '\Doctrine\XXX\YYY' in code and document Created: 09/Feb/11 Updated: 13/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, DQL, Mapping Drivers, ORM, Tools |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | ben yan | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | None | ||
| Description |
|
It will help us use the namespace and code autocomplete in some IDE. |
| Comments |
| Comment by Matthieu Napoli [ 08/Apr/11 ] |
|
Hi, do you have any more information about this ? I'm confused because the php documentation uses the Doctrine\XXX way, and everywhere I've seen, it is used like that. Thanks |
| Comment by Karsten Dambekalns [ 11/Apr/11 ] |
|
The issue is simple and logical. When an IDE (I am using PhpStorm and it does it like this) sees a namespace in a file, upon seeing namespaces afterwards, it sees them as absolute if they have a leading backslash, or relative when it does not. This affects the resolution of classes for type navigation, code inspection, ... The same rules as for actual PHP code should be used within comments. Here is an example: namespace Foo;
class Bar {
/**
* @var Baz
*/
protected $baz;
/**
* @var \Quux
*/
protected $quux;
}
The IDE will think $baz is \Foo\Baz and $quux will be seen as being \Quux. Now if you have some reference to Doctrine here, and it was relative, the IDE would assume it's \Foo\Doctrine\... |
| Comment by Benjamin Eberlei [ 11/Apr/11 ] |
|
Well yes, but since all our code examples have no leading namespace argument this means the code is in the default namespace, making Doctrine\XXX\YY a relative namespace that is actually valid. |
| Comment by Karsten Dambekalns [ 11/Apr/11 ] |
|
Yes, but the source code docblocks are what is meant here as far as I am concerned. |
| Comment by Andrey Kolyshkin [ 13/May/11 ] |
|
Example (Entitymanager.php): namespace Doctrine\ORM; and /** * The used Configuration. * * @var Doctrine\ORM\Configuration */ private $config; Result: Should be: /** * The used Configuration. * * @var Configuration */ private $config; Or /** * The used Configuration. * * @var \Doctrine\ORM\Configuration */ private $config; |
| Comment by Miha Vrhovnik [ 27/May/11 ] |
|
Why don't you take this to the PhpStorm tracker as it surely is a bug in IDE? |
| Comment by Karsten Dambekalns [ 27/May/11 ] |
|
Miha, what makes you think it's an IDE bug? In a class in namespace Foo another class named Bar is \Foo\Bar, but \Bar is \Bar. Why is it a bug if the IDE follows the namespace resolution rules? |
| Comment by Michael Ridgway [ 11/Jul/11 ] |
|
The issue is that PHPStorm and NetBeans have different class resolution rules. I also use PHPStorm and most of Doctrine does not resolve auto-completion correctly because of this issue. I'd be willing to work on this if it would be accepted. |
| Comment by Andrew Mackrodt [ 29/Sep/11 ] |
|
I've been evaluating PhpStorm and also came across this issue; I believe the problem is due to Doctrine rather than being a bug with the IDE although it would be nice if PhpStorm would assume namespaces are absolute if they're not resolved upon an initial lookup. I created a quick c# app to append the beginning forward slash to any @var or @return attributes within Doctrine's source. It's working for me with Doctrine 2.1.2 and PhpStorm (IntelliJ): http://pastebin.com/4HxiWvJA - hopefully this will be of use for anyone else using these IDEs;. Note: the application doesn't detect multiple line annotations although the only one I'm aware of is the getAST method in Doctrine\ORM\Query.php. |
| Comment by Benjamin Eberlei [ 13/Dec/11 ] |
|
This issue is referenced in Github Pull-Request GH-215 |
| Comment by Benjamin Eberlei [ 13/Dec/11 ] |
|
This issue is referenced in Github Pull-Request GH-216 |
[DDC-1011] Finding out if a model is persist Created: 02/Feb/11 Updated: 02/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Ronny Deter | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
To find out if a model is persist, is missing in the documentation of doctrine 2. To become the state of an model you must call the entitymanager->getUnitOfWork()->getEntityState(model) |
[DDC-993] Cookbook: Overriding the ID Generator during a database migration Created: 19/Jan/11 Updated: 28/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Timo A. Hummel | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
If you need to override the ID Generator, e.g. during a migration, you can do that in your migration script as follows: Overriding the ID generator $em->getClassMetadata('foo\bar\Entity')->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator()); Make sure that both calls equal to the same generator type. You can now modify the @Id fields in your entities. Additionally, make sure that you set the IdGenerator after you created the database using e.g. SchemaTool->create(). |
| Comments |
| Comment by Endre Kósa [ 27/Oct/12 ] |
|
Hi, this doesn't seem to work for me. I have written a small database export / import utility. As long as I use the automatic ID generation, everything works flawlessly, but I'm trying to preserve the existing IDs. I do exactly what you've suggested in your post. It works for @OneToOne relations, but I get the following error messages when persisting entities that are parts of @ManyToOne relations: |
| Comment by Endre Kósa [ 28/Oct/12 ] |
|
Never mind. I've upgraded to Doctrine 2.3.0 and it works as expected. |
[DDC-948] incorrect link from the types page to known vendor issues Created: 25/Dec/10 Updated: 25/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Lukas Kahwe | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
http://www.doctrine-project.org/docs/dbal/2.0/en/reference/types.html links to http://www.doctrine-project.org/docs/dbal/2.0/en/known-vendor-issues instead of http://www.doctrine-project.org/docs/dbal/2.0/en/reference/known-vendor-issues.html Also noticed that the documentation still says "Doctrine DBAL v2.0.0-BETA4 documentation" |
| Comments |
| Comment by Lukas Kahwe [ 25/Dec/10 ] |
|
err sorry .. this is of course a DBAL doc issue not and ORM issue. |
[DDC-923] Add note about DateTime Query Parameter Type Hint Created: 10/Dec/10 Updated: 10/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
[DDC-919] subselect Created: 08/Dec/10 Updated: 20/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Mungiu Dragos | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
i'd like to see more example in documentation with this subselects |
| Comments |
| Comment by Alberto [ 20/Mar/11 ] |
|
Subselect as columns or FROM clause should have mor examples. |
[DDC-1475] Documentation for One-To-Many, Bidirectional Association does not have YAML example Created: 07/Nov/11 Updated: 07/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Christian Stoller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When you are looking for a config example for the bidirectional mapping of an one-to-many association you will just find an example with XML, but not with YAML or PHP. It would be nice if somebody could add an example or a link to the bidirectional one-to-one association, because it should be the same, right? Here the link to the example: http://www.doctrine-project.org/docs/orm/2.0/en/reference/association-mapping.html#one-to-many-bidirectional |
[DDC-1645] Paths to Annotations classes are not considered Created: 10/Feb/12 Updated: 10/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, Mapping Drivers |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | feathers and down | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
openSUSE 12.1 x86, Apache/2.2.21, mysql 5.5.16, PHP 5.3.8 (modules: Core, ctype, curl, date, dom, ereg, filter, gd, hash, http, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, pcre, PDO, pdo_mysql, pdo_sqlite, Reflection, session, SimpleXML, SPL, SQLite, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib ) |
||
| Attachments: |
|
| Description |
|
Hi, my battle is described here: http://groups.google.com/group/doctrine-user/browse_thread/thread/db9c77b6bc000f13 When I follow bugtracker tutorial I think that there is an error when working with Annotations, see these examples: Start a new bugtracker project as described in tutorial from scratch, create folders and files as tutorial expose, then do following changes: 1) put Product, Bug, User class files at root level, same level as bootstraps files and create_xxxxx files 1) YAML so Setup method path argument is considered correctly, Doctrine engine must know where yaml files for classes are. 2) XML so Setup method path argument is considered correctly again, Doctrine engine must know where xml files for classes are. 3) Annotations so Setup method path argument IS NOT CONSIDERED, Doctrine engine use already defined classes to get Annotations docblocks using php reflexion classes, methods and functions. How to deal with this? I mean... a) Erase path argument from Setup::createAnnotationMetadataConfiguration methos (and similar functions for Annotations) because is not needed, classes and annotations must be defined before. I know that is easy to follow tutorial guidelines to develop applications in Annotations point of view, load them before Doctrine script start (with require/include or autoloaders, etc) and will work, but I think that is wrong how tutorial and functional logic are given, so a) and b) are my proposed solutions. I think b) should be right, get dockblocks from a class already defined and if are not defined it follow XML and YAML logic: read metadata from other files. Attachment: My bugtracker Netbeans project. Sorry by my english |
[DDC-1513] Missing documentation for using references in Docs Created: 28/Nov/11 Updated: 29/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Thomas Gray | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I am in the process of switching over from Doctrine 2.0.7 to Doctrine 2.1 and one of the major missing components in my entities was the new use of using the mapping entity. Example:
<?php
namespace My\Project\Entities;
use Doctrine\ORM\Mapping\Entity as ORM;
/**
* @ORM\Entity(...)
*/
class Something
{
// Doctrine annotations here
}
The nessecity for this to be included in the entities is (as far as I can tell) nowhere to be found in the docs, so I am a little curious as to how people are supposed to know. I have also had a look here: http://www.doctrine-project.org/blog/doctrine-2-1-beta-release and can see no references too it. Am I missing something; or is it really just missing from the docs? |
| Comments |
| Comment by Erik Bernhardson [ 28/Nov/11 ] |
|
I also glanced through the docs and didn't find it. I would suggest it be added to the Annotations Reference page: http://www.doctrine-project.org/docs/orm/2.1/en/reference/annotations-reference.html |
| Comment by Thomas Gray [ 29/Nov/11 ] |
|
Ahh, so there are some docs about it; http://www.doctrine-project.org/docs/common/2.1/en/reference/annotations.html however they do not seem to be that clear; nor well linked too. |
[DDC-1947] Update EBNF with arbitrary joins Created: 26/Jul/12 Updated: 26/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.3, Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Marco Pivetta | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Arbitrary joins need to be documented in EBNF |
[DDC-1894] Cannot view Doctrine 2.2 QueryBuilder documentation Created: 27/Jun/12 Updated: 27/Jun/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Major |
| Reporter: | Douglas Teoh | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Chrome, Firefox, Safari on OS X |
||
| Description |
|
Visiting the following page: http://www.doctrine-project.org/api/orm/2.2/class-Doctrine.ORM.QueryBuilder.html always redirects back to http://www.doctrine-project.org/api/orm/2.2/ |
[DDC-2185] Better explain DQL "WITH" and implications for the collection filtering API Created: 04/Dec/12 Updated: 17/Dec/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, DQL |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Matthias Pigulla | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | collection, documentation, dql, filtering | ||
| Description |
|
Available documentation is a bit thin regarding the "WITH" clause on JOIN expressions. Only a single example is provided in WITH seems to allow to only "partially" load a collection, so the collection in memory does not fully represent the associations available in the database. The resulting collection is marked as "initialized" and it seems there is no way to tell later on whether/how (with which expression) the collection has been initialized. When using the collection filtering API, the "initialized" flag on the collection will lead to in-memory processing. If a collection has been loaded WITH a restricting clause and another filter is applied later, results may not be what one might expect. I assume this is by design (no idea how the collection could be "partially" loaded and behave correctly under all conditions), so filing it as a documentation issue. |
| Comments |
| Comment by Matthias Pigulla [ 17/Dec/12 ] |
|
An additional observation: If you eager-load a collection using WITH, for the resulting entities that collection is marked as initialized as described above. Should you happen to come across the same entity during hydration in another (later) context where you explicitly eager load the same association without the WITH restriction (or with another one), the collection on that (existing) entity won't be re-initialized and still contains the associated objects found during the first query. |
[DDC-1099] Tutorial :: Getting started code sample entity manager Created: 04/Apr/11 Updated: 11/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Gordon Franke | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
see pull request 24 on github.com |
| Comments |
| Comment by Michael Ridgway [ 11/Jul/11 ] |
|
This issue should be closed: https://github.com/doctrine/orm-documentation/pull/24 |
[DDC-1088] Description for SequenceGenerator annotation options is wrong Created: 30/Mar/11 Updated: 30/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.x |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Alexandre Mathieu | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
N/A |
||
| Description |
|
On paragraph 4.8.1.1 SequenceGenerator, the correct example should be: <?php
|
[DDC-1089] Annotations reference examples are inaccurate and confusing Created: 30/Mar/11 Updated: 30/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Maarten van Leeuwen | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
N.A. |
||
| Description |
|
In chapter 19 of the reference guide some coding examples seem to be inaccurate or incorrect. Especially when it comes to the bidirectional many-to-many associations, this might be confusing. Example:
Some other code fragments in chapter 19 have similar issues. I think they could easily be replaced by the examples from the earlier chapters, like for the bidirectional man-to-many association the example from chapter 5: |
[DDC-1072] Private property mapping can cause issues, suggest changing to protected Created: 17/Mar/11 Updated: 17/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Kevin Bradwick | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
not applicable |
||
| Description |
|
The documentation recommends using private variables in entities. This can be problematic on entities with relations when using caching drivers as the proxy objects cannot access private variables and so the caching driver can throw notices like ...apc_store(): "_id" returned as member variable from __sleep() but Making member variables protected resolves this issue when caching is enabled. This information would be helpful on the documentation so others can be made aware of this issue. We spent a few days trying to debug the issue before understanding exactly what was going on. |
[DDC-1702] EBNF for IN expressions should be updated for 2.2 Created: 13/Mar/12 Updated: 13/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Patrick Schwisow | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Following the changes made for |
| Comments |
| Comment by Patrick Schwisow [ 13/Mar/12 ] |
|
I marked this as "Major" because this change represents a BC break. Because EBNF was not updated, I initially believed this to be a bug in ORM and wasted a lot of time debugging Doctrine code before I discovered this change was intentional. |
[DDC-682] ORACLE CHARSET DOCUMENTATION Created: 10/Jul/10 Updated: 10/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | fernando guerrero | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ORACLE db SYMFONY |
||
| Description |
|
Openning an Oracle Database with Doctrine and Symfony doesn't support by default utf8 charset. To support it, it is necessary to specify charset=AL32UTF8 in the dsn of the database in config/databases.yml. Analogous to the example shown at oracle:dbname=//192.168.2.9:1521/nomina_dev;charset=AL32UTF8 Documentation by Alexia Velásquez (alexia.velasquez@hotmail.es, Vladimir Tàmara (vtamara@pasosdeJesus.org) and Fernando Guerrero |
[DDC-1605] No documentation about the usage of indexes with YAML and XML Created: 16/Jan/12 Updated: 08/Apr/13 |
|
| Status: | In Progress |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | Christian Stoller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | documentation | ||
| Description |
|
I am missing documentation about how to handle indexes in YAML and XML definition files. I had to search in the code to learn how to do that. This issue is related to # EDIT:
User:
type: entity
fields:
id:
id: true
type: integer
generator:
strategy: IDENTITY
email:
type: string
length: 150
unique: true
active:
type: boolean
indexes:
indexActiveField: { name: idx_user_active, columns: [ active ] }
indexActiveField is the name of the index used by doctrine and idx_user_active is the name of the index in the database. The rest should be clear. |
| Comments |
| Comment by Christian Stoller [ 27/Sep/12 ] |
|
Hi. I got an email notification that arbuscula has changed the status to "Awaiting Feedback". Do you need any feedback from me? |
[DDC-2401] INDEX BY not working on multiple columns Created: 16/Apr/13 Updated: 18/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, ORM |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Quintenvk | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
According to the docs on this page: The following "multi-dimensional index" should be perfectly possible, with a default hydration mode: However, b.id is completely ignored (it is a numeric primary key). I tried to go further, giving 2 products a matching barcode and indexing by barcode and then a (unique, numeric) productid. Only the barcode worked as a key and only one of the products with a matching barcode was selected. I used this query to test: I also flagged the docs, because I don't think a userid should/could be starting from 0. |
| Comments |
| Comment by Fabio B. Silva [ 18/Apr/13 ] |
|
Hi Quintenvk Could you please try to write a failing test case ? Thanks |
| Comment by Quintenvk [ 18/Apr/13 ] |
|
I added a testcase. Please note that the database settings are to be configured in Core/simplys/simplys.php, and that the dump is in dummy.sql. Apart from that all should run well immediately. |
| Comment by Quintenvk [ 18/Apr/13 ] |
|
Fabio, Please check the zip I just attached. I hope this helps you in finding the problem. Thanks, |
| Comment by Fabio B. Silva [ 18/Apr/13 ] |
|
Thanks Quintenvk, SELECT p.barcode, p.id, p.name FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id In this DQL you are trying to index by scalar values, Also the INDEX BY documentations seems wrong to me. The given DQL : SELECT u.id, u.status, upper(u.name) nameUpper FROM User u INDEX BY u.idJOIN u.phonenumbers p INDEX BY p.phonenumber Show the following result : array
0 =>
array
1 =>
object(stdClass)[299]
public '__CLASS__' => string 'Doctrine\Tests\Models\CMS\CmsUser' (length=33)
public 'id' => int 1
..
'nameUpper' => string 'ROMANB' (length=6)
1 =>
array
2 =>
object(stdClass)[298]
public '__CLASS__' => string 'Doctrine\Tests\Models\CMS\CmsUser' (length=33)
public 'id' => int 2
...
'nameUpper' => string 'JWAGE' (length=5)
Which IMHO represents another DQL, something like : SELECT u, p , upper(u.name) nameUpper FROM User u INDEX BY u.id JOIN u.phonenumbers p INDEX BY p.phonenumber |
| Comment by Quintenvk [ 18/Apr/13 ] |
|
Thanks for your reply Fabio. Thanks, |
| Comment by Fabio B. Silva [ 18/Apr/13 ] |
|
Not sure if it's exactly the result you need but you can try Something like : SELECT p, b FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id or something like : SELECT PARTIAL p.{id, barcode, name}, b.{id, attributesYouNeed} FROM \core\Simplys\Entity\Products p INDEX BY p.barcode JOIN p.businessid b INDEX BY p.id
And than : $result = $query->getArrayResult(); |
| Comment by Quintenvk [ 18/Apr/13 ] |
|
Both produce the same result as the query I had. I think i'll move on to loops after a bit more research, too bad it can't be done (at least for now) though... Would've been nice. Thanks for your help though! |
[DDC-2254] Exporting and restoring a query. Created: 23/Jan/13 Updated: 04/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, DQL, ORM |
| Affects Version/s: | Git Master, 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Dries De Peuter | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql, rebuild, restore, save | ||
| Environment: |
OSX |
||
| Description |
|
When you have a queryBuilder and you want to break it down using getDQLParts, You can't restore it by looping over the parts and adding them. This is what I am doing:
$parts = $qb->getDQLParts();
// save the parts and use them in a different environment.
$newQb = $em->createQueryBuilder();
foreach ($parts as $name => $part) {
$newQb->add($name, $part);
}
|
| Comments |
| Comment by Dries De Peuter [ 23/Jan/13 ] |
|
I wrote a test showing the issue. https://github.com/NoUseFreak/doctrine2/commit/8574b79fd3d245532bbe7e310c5cbe083892057a |
| Comment by Benjamin Eberlei [ 04/May/13 ] |
|
This is not a bug, because restoring queries is not yet a feature of the QueryBuilder. Marking as possible improvement for future. |
[DDC-1248] Documentation regarding prePersist and postPersist events a bit lacking Created: 04/Jul/11 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Helmer Aaviksoo | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Browser |
||
| Description |
|
Please make it more clear that prePersist and postPersist events are called only when creating new entity (that is, prior and after a database insert). IRC log: Pastie code (probably expired by now): $entity->setSomething('xxx'); $entity->setSomething('yyy'); |
[DDC-1015] @DiscriminatorColumn is not required anymore Created: 03/Feb/11 Updated: 03/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Karsten Dambekalns | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Since |
[DDC-987] How to register lifecycle callbacks from YAML is not done correctly in the Events section of the documentation. Created: 14/Jan/11 Updated: 14/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Amir | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html The above URL has an example of how to register lifecycle callbacks from YAML, but actually it does not work. The correct way of doing it is mentioned on the page: http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html |
[DDC-986] bad cli commands in ORM introduction Created: 14/Jan/11 Updated: 15/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Stepan Tanasiychuk | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I read mini tutorial http://www.doctrine-project.org/docs/orm/2.0/en/reference/introduction.html#mini-tutorial and try run command "doctrine orm:schema-tool --drop"
It's not worked for me:
But command "doctrine orm:schema-tool:drop --force" and "doctrine orm:schema-tool:create" is worked. |
[DDC-1405] Define semantics of comparison operators, particularly with regard to null values Created: 06/Oct/11 Updated: 12/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Daniel Alvarez Arribas | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The Doctrine 2 reference documentation defines the comparison operators syntactically, as: ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!=" Now, without experimentation, it is pure guesswork to tell whether e. g. null = null, or e. g. null <> null, or null = 0, or null <> 0 are considered true statements in DQL. In SQL semantics, all four statements would be false (or more precisely, null). In PHP semantics, both null == null and null == 0 would be true, while null != null and null != 0 would be false. It would be helpful to have the semantics of the comparison operators defined. While comparisons with non-null values behave in a common-sense way, it is hard to guess how queries involving comparison operators on fields allowing null values or null query arguments will filter the results, without knowing the exact semantics of the comparison operators with regard to null values. It would be great if this could be clarified in the docs. Thanks. |
[DDC-1329] Documentation for @JoinColumn may be incorrect Created: 13/Aug/11 Updated: 13/Aug/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Damon Jones | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The Documentation for @JoinColumn annotation states: However, this seems not to be correct. If you have non-standard name for the @Id columns for a @OneToMany/@ManyToMany the name and referencedColumnName are not correctly inferred. https://gist.github.com/e61bf8f4462870ffd4f3 |
[DDC-1983] Incorrect use statement in 25.1.3. Configuration example (Doctrine Console) Created: 15/Aug/12 Updated: 15/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Atli Thor Jonsson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Cli, documentation | ||
| Description |
|
The code example here: In the second "use" statement it references a "EntityManagerHelper" from the "Doctrine\DBAL\Tools\Console\Helper\" package. However, it does not exist there. It does exist in the "Doctrine\ORM\Tools\Console\Helper\" package though, and replacing it seems to work. |
[DDC-1555] Reference. 8 Work. with obj. Making "see "Transitive Persistence"" as link Created: 22/Dec/11 Updated: 22/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Yaroslav Kiliba | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
8. Working with Objects: |
[DDC-1511] Suggestion on the docs for batch processing Created: 25/Nov/11 Updated: 25/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Jamie Wong | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
br0wser |
||
| Description |
|
I am refering to the examples on http://www.doctrine-project.org/docs/orm/2.0/en/reference/batch-processing.html Let's say you want to process a bulk of 25 objects and have a batchsize of 20. This is probably very clear to any experienced Doctrine developer but maybe it is also confusing for beginners like me (some internet sources say, that flush is executed automatically at the end of the request, but obviously it is not). Maybe this could be mentioned somewhere? |
[DDC-1921] Clarify Identifier definition for CTI entities Created: 11/Jul/12 Updated: 11/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Ludek Stepan | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hello, Reference Guide topic 4.8 Identifers/Primary Keys(http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#identifiers-primary-keys) states that: "Every entity class needs an identifier/primary key." However, example in topic 7.3. Class Table Inheritance (http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/inheritance-mapping.html#class-table-inheritance) doesn't contain any definitions for Ids. Consider following code: /** * @Entity * @InheritanceType("JOINED") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"person" = "Person", "employee" = "Employee"}) */ class Person { /** @Id @Column(type="integer") */ private $id; public function getId() { return $this->id; } } /** @Entity */ class Employee extends Person { /** @Id @Column(type="integer") */ private $id; // Overrides parent to retrieve private public function getId() { return $this->id; } } // create instances and $em->persist(...) // $person instanceof Person $person->getId(); // Returns id. // $employee instanceof Employee $employee->getId(); // Returns null. Private $id in subclass isn't assigned. Please clarify correct use of identifiers in CTI subclass entities. Should subclasses contain any definitions of identifiers? Thank you! Ludek |
[DDC-2286] Update documentation for collation Created: 08/Feb/13 Updated: 08/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Rickard Andersson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | collation, documentation | ||
| Description |
|
The documentation at http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/faq.html#how-do-i-set-the-charset-and-collation-for-mysql-tables clearly states that the collation should be set at database level and then inherited for all tables created. Digging through the code and reading this issue http://www.doctrine-project.org/jira/browse/DDC-2139 it's clear that this is no longer the case. |
[DDC-2227] Add details about developer being responsible of inverse side of an association Created: 09/Jan/13 Updated: 09/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Marco Pivetta | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As far as I know, docs don't explain that it is up to the developer to keep the object graph consistent instead of relying on Doctrine ORM for everything. For example, for many to many, examples like following may be used: |
[DDC-1058] Documentation on orphan removal in XML Mapping is incorrect Created: 04/Mar/11 Updated: 04/Mar/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Josh Freed | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The XML Mapping documentation indicates that "orphan-removal" is an attribute on One-to-One or Many-to-One elements, but in DoctrineORM version 2.0 that does not work. It seems I have to make "orphan-removal" a child attribute of those elements to turn it on. Just to be clear: Documentation says to do this, but it does not work: This does work: |
[DDC-473] Inadequate description for @MappedSuperclass in Annotations Reference Created: 25/Mar/10 Updated: 26/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0-ALPHA4 |
| Fix Version/s: | 2.0 |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | David Abdemoulaie | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
This doesn't adequately communicate how to use it. It took me several minutes of failing before I downloaded the PDF and did a search for @MappedSuperclass to find an example of how it's used. Specifically the following were unclear:
|
| Comments |
| Comment by David Abdemoulaie [ 25/Mar/10 ] |
|
Apparently it's also incompatible with several other tag as well. I thought it made sense to try the following and see if the @InheritanceType and @Discriminator___ tags would apply to the children classes: /**
* @MappedSuperclass
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="type", type="string")
* @DiscriminatorMap({"User" = "User", "Group" = "Group"})
*/
abstract class Principal
But apparently this flags D2 to treat it as an Entity anyway, resulting in the following error: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sentact5.principal' |
| Comment by Benjamin Eberlei [ 28/Mar/10 ] |
|
I updated the documentation, the question is if we should check for the mapped superclass attribute and throw exceptions if other entity level annotations are specified. |
| Comment by Roman S. Borschel [ 15/Apr/10 ] |
|
A mapped superclass has not many restrictions and these are mentioned in the docs (i.e. only unidirectional associations), what David mentions above should work, if it doesnt its a bug, I think |
| Comment by Roman S. Borschel [ 15/Apr/10 ] |
|
David, @"Is this defined on the superclass or on the children classes?" It doesnt matter. A @MappedSuperclass can be anywhere in an inheritance hierarchy and it always does the same thing, inherit its mapping information to subclasses (but its not itself an entity). The docs say: Mapped superclasses, just as regular, non-mapped classes, can appear in the middle of an otherwise mapped inheritance hierarchy (through Single Table Inheritance or Class Table Inheritance).
as well as Entities support inheritance, polymorphic associations, and polymorphic queries. Both abstract and concrete classes can be entities. Entities may extend non-entity classes as well as entity classes, and non-entity classes may extend entity classes.
So entities, mapped superclasses and plain non-mapped classes can appear mixed in an inheritance hierarchy. Nevertheless all the classes in a hierarchy that are entities must use 1 inheritance strategy, you can not mix inheritance mapping strategies in a single class hierarchy. @"If it's defined on the child classes, does it take parameters? The name of the super class?" No, it doesnt. The docs dont mention any parameters either which is correct. @"It was not at all apparent to me that it was mutually exclusive with the @Entity tag" OK, that needs to be made clearer in the docs then. |
[DDC-740] Mantain a list of DQL reserved keywords Created: 09/Aug/10 Updated: 09/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Guilherme Blanco | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should keep a list of DQ reserved keywords, so users can check out what they can use or not. |
[DDC-823] Errors in 2.0 Cookbook Documentation Created: 01/Oct/10 Updated: 11/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Task | Priority: | Trivial |
| Reporter: | Ralfas Jegorovas | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Paragraph 1: Paragraph 2: What would be the best way to note other errors? |
| Comments |
| Comment by Benjamin Eberlei [ 04/Oct/10 ] |
|
The best way for us would be if you fork the docs on github, change the stuff and commit it. Then issue a pull request. It sounds complicated, but should be minimal overhead of ~5 minutesn on your end, but then we can merge it with a mouse-click, so we dont need to duplicate the whole correction effort on our end. |
| Comment by Joel Clermont [ 27/Jan/11 ] |
|
I have fixed the typos from this ticket that were still present in the docs and issued a pull request on Github. |
| Comment by Michael Ridgway [ 11/Jul/11 ] |
|
This issue should be closed: https://github.com/doctrine/orm-documentation/pull/17 |
[DDC-1003] Documentation refers to EAGER loading as FETCH Created: 26/Jan/11 Updated: 26/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Trivial |
| Reporter: | jared fraser | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Throughout the documentation found in the following link (http://www.doctrine-project.org/docs/orm/2.0/en/reference/xml-mapping.html) when mentioning eager or lazy loading the documentation says FETCH instead of EAGER. E.G. content says "fetch - Either LAZY or FETCH" which should read "fetch - Either LAZY or EAGER" This occurs in a few different areas on this page. |
[DDC-940] Entities can / can not have private properties Created: 15/Dec/10 Updated: 15/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | 2.0-RC2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Trivial |
| Reporter: | Ray Rehbein | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP 5.3.3 (cli) (built: Nov 14 2010 16:54:26) |
||
| Description |
|
In the note in If this is the only reason entities can't have private properties, then this restriction is no longer valid, or possibly be reconsidered. <?php
class A {
private $a = null;
public function setValue($value) {
$this->a = $value;
}
}
class B extends A {}
$b = new B();
$b->setValue("B");
var_dump($b);
$c = unserialize(serialize($b));
var_dump($c);
The output suggests private variables are serialized, and are restored fine |
[DDC-1611] Tools Reference example is apparently wrong Created: 19/Jan/12 Updated: 20/Jan/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Trivial |
| Reporter: | Tarcísio Fischer | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I was reading http://www.doctrine-project.org/docs/orm/2.1/en/reference/tools.html The example seems to be wrong. use Doctrine\DBAL\Tools\Console\Helper\EntityManagerHelper; That's all. |
| Comments |
| Comment by craz [ 20/Jan/12 ] |
|
Yes, this is a real problem. fixation and helped me |
[DDC-2441] Incorrect SQL Query being generated Created: 09/May/13 Updated: 09/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Paul Mansell | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Using Doctrine in Symfony 2.2.1 on Windows Platform |
||
| Description |
|
The following DQL : SELECT s,ba,c,mno,ss,sws,ccs,cns,cws FROM WLCoreBundle:SIM s INNER JOIN s.billingAccount ba LEFT JOIN s.connection c INNER JOIN s.status ss LEFT JOIN s.workflowStatus sws INNER JOIN c.customerStatus ccs INNER JOIN c.networkStatus cns LEFT JOIN c Produces the following SQL : SELECT * FROM (SELECT c0_.id AS id0, c0_.iccid AS iccid1, c0_.created AS created2, c0_.updated AS updated3, c0_.spreference AS spreference4, c1_.id ASid5, c1_.account_number AS account_number6, c1_.name AS name7, c1_.address1 AS address18, c1_.address2 AS address29, c1_.address3 AS address310, c1_.address4 AS address411, c1_.address5 AS address512, c1_.address6 AS address613, c1_.email_address AS email_address14, c1_.spreference AS spreference15, c2_.id AS id16, c2_.msisdn AS msisdn17, c2_.local AS local18, c2_.imsi AS imsi19, c2_.data AS data20, c2_.fax AS fax21, c2_.api AS api22, c2_.activation_date AS activation_date23, c2_.contract_end_date AS contract_end_date24, c2_.created AS created25, c2_.updated AS updated26, c2_.spreference AS spreference27, c3_.id AS id28, c3_.ident AS ident29, c3_.label AS label30, c3_.description AS description31, c4_.id AS id32, c4_.ident AS ident33, c4_.label AS label34, c4_.description AS description35, c4_.customer_label AS customer_label36, c4_.customer_description AS customer_description37, c5_.id AS id38, c5_.ident AS ident39, c5_.label AS label40, c5_.description AS description41, c6_.id AS id42, c6_.ident AS ident43, c6_.label AS label44, c6_.description AS description45, c7_.id AS id46, c7_.ident AS ident47, c7_.label AS label48, c7_.description AS description49, c7_.customer_label AS customer_label50, c7_.customer_description AS customer_description51, c8_.id AS id52, c8_.name AS name53, c8_.email_address AS email_address54, c8_.is_active AS is_active55, c8_.spreference AS spreference56, c0_.billing_account AS billing_account57, c0_.customerHierarchy AS customerHierarchy58, c0_.mno AS mno59, c0_.status AS status60, c0_.workflow_status AS workflow_status61, c1_.customer_hierarchy AS customer_hierarchy62, c1_.country AS country63, c1_.tax_rate AS tax_rate64, c1_.currency AS currency65, c1_.status AS status66, c1_.priority AS priority67, c2_.sim AS sim68, c2_.customer_status AS customer_status69, c2_.network_status AS network_status70, c2_.workflow_status AS workflow_status71, ROW_NUMBER() OVER (ORDER BY msisdn17 ASC) AS doctrine_rownum FROM core_sim c0_ WITH (NOLOCK) INNER JOIN core_billing_account c1_ ON c0_.billing_account = c1_.id LEFT JOIN core_connection c2_ ON c0_.id = c2_.sim INNER JOIN core_sim_status c3_ ON c0_.status = c3_.id LEFT JOIN core_sim_workflow_status c4_ ON c0_.workflow_status = c4_.id INNER JOIN core_connection_customer_status c5_ ON c2_.customer_status = c5_.id INNER JOIN core_connection_network_status c6_ ON c2_.network_status = c6_.id LEFT JOIN core_connection_workflow_status c7_ ON c2_.workflow_status = c7_.id INNER JOIN core_mno c8_ ON c0_.mno = c8_.id) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 10 Which returns an error : SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'msisdn17'. Same query works fine in Doctrine 2.3 |
[DDC-1465] Fetching partial objects doesn't work if HINT_FORCE_PARTIAL_LOAD is not explicitly used Created: 02/Nov/11 Updated: 11/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Julien Pauli | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Using the DQL "partial" keyword is not enough to get a partial entity as a result. $q = $em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3');
$r = $q->getResult() /* HYDRATE_OBJECT is the default hydration mode */
Here, $r contains the full Entity, a SELECT * has been sent $q = $em->createQuery('SELECT partial r.{id,comment} FROM Entities\Rating r WHERE r.id=3');
$q->setHint(Doctrine\ORM\Query::HINT_FORCE_PARTIAL_LOAD, 1);
$r = $q->getResult() /* HYDRATE_OBJECT is the default hydration mode */
Here, $r contains only the selected fields, hence a true partial Entity |
[DDC-2021] Array Data in Member OF Created: 09/Sep/12 Updated: 09/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | vahid sohrabloo | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | array, dql | ||
| Description |
|
Hi. |
[DDC-1995] "Query Exception: Invalid parameter number: number of bound variables does not match number of tokens" when using an "Instance Of" expression Created: 22/Aug/12 Updated: 29/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | Git Master |
| Fix Version/s: | Git Master |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Craig Marvelley | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Similar to this issue I think, but triggered when performing a query on entities modelled with Class Table Inheritance, e.g. $qb = $repository->createQueryBuilder('entity'); Seems that there isn't a corresponding entry in the parameter mapping array for this clause, which triggers the exception at line 254 of Doctrine\ORM\Query: if (count($paramMappings) != count($this->parameters)) { throw QueryException::invalidParameterNumber(); } |
| Comments |
| Comment by Craig Marvelley [ 22/Aug/12 ] |
|
Pull request with a potential fix: https://github.com/doctrine/doctrine2/pull/429 |
| Comment by Benjamin Eberlei [ 29/Aug/12 ] |
|
Assigned to Guilherme |
[DDC-1602] Executors for Class Table Inheritance (JOINED) are extremely slow on MySQL Created: 15/Jan/12 Updated: 27/Jun/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2-BETA2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Michael Moravec | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
Debian, MySQL 5.5.17 |
||
| Description |
|
Update and delete executors for Class Table Inheritance (JOINED) are extremely slow on MySQL platform. It is most probably due to use of subselect on the temporary table. /** * @Entity * @InheritanceType("JOINED") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"root" = "Root", "a" = "SubA"}) */ class Root { /** * @Column(type="integer") * @Id * @GeneratedValue */ private $id; /** * @Column(type="integer") */ private $xyz; } /** * @Entity */ class SubA extends Root { /** * @Column(type="integer") */ private $foo; } Now lets perform a simple DQL UPDATE: UPDATE Entities\Root r SET r.xyz = 123 WHERE r.id > ? (note: always the upper half of entries) CREATE TEMPORARY TABLE Root_id_tmp (id INT NOT NULL) INSERT INTO Root_id_tmp (id) SELECT t0.id FROM Root t0 LEFT JOIN SubA s0_ ON t0.id = s0_.id WHERE t0.id > 25000 UPDATE Root SET xyz = 123 WHERE (id) IN (SELECT id FROM Root_id_tmp) DROP TEMPORARY TABLE Root_id_tmp The time spent on this on MySQL 5.5.17 and PostgreSQL 9.1 is:
As you can see, MySQL is drastically slower on even relatively small tables. This currently makes Doctrine unusable for this type of inheritance on MySQL. The solution probably would be to avoid subselect in WHERE clause in Doctrine\ORM\Query\Exec\MultiTableUpdateExecutor and Doctrine\ORM\Query\Exec\MultiTableDeleteExecutor. Feel free to try/modify the test script yourself, it's here. |
| Comments |
| Comment by Benjamin Eberlei [ 15/Jan/12 ] | ||||||||||||||||
|
Its not a bug as it works. The performance drawback of JTI is discussed in the manual http://www.doctrine-project.org/docs/orm/2.1/en/reference/inheritance-mapping.html. Changing this would be an improvement where we would hint if databases prefer subselects or joins for different operations. This would increase complexity of the SQL generation since now we are getting along with just one SQL generation strategy. | ||||||||||||||||
| Comment by Michael Moravec [ 11/May/12 ] | ||||||||||||||||
|
Any chance to get this implemented before 2.3? | ||||||||||||||||
| Comment by Michael Moravec [ 11/May/12 ] | ||||||||||||||||
|
I've made a change in DBAL and ORM code to implement a solution issue. It's currently more likely a proof of concept. With the change, my results are (approximately):
Currently only update executor was changed. Looking forward for your opinions. | ||||||||||||||||
| Comment by Michael Moravec [ 27/Jun/12 ] | ||||||||||||||||
|
bump |
[DDC-1806] DQL with and without fetch join cause Created: 01/May/12 Updated: 01/May/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | 2.2, 2.2.1, 2.2.2, Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Marco Pivetta | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
When running following DQL in newly cleared EntityManager, with the provided entities (see attached archive or gist at https://gist.github.com/2473775 ), results in different fetched association: DQL without join: SQL without join: Result without join: DQL with fetch join: SQL with fetch join: Result with fetch join: The problem seems to be strictly related with how the `@JoinColumn` is configured. |
| Comments |
| Comment by Marco Pivetta [ 01/May/12 ] |
|
Attaching failing test from https://github.com/Ocramius/doctrine2/compare/DDC-1806 |
[DDC-2223] unable to use scalar function when a scalar expression is expected Created: 04/Jan/13 Updated: 04/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexis Lameire | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql | ||
| Environment: |
(not affected by this bug) |
||
| Description |
|
the DQL Parser don't parse properly functions when a ScalarExpression is needed like of all case functions. In fact first function token is interpreted as a T_IDENTIFIER and enter on line 1663 of Doctrine\ORM\Query\Parser class. in search of math operator, when not found this case considere that the token is a row element with no considération of the functions procession treated after. fix of this bug consist to enclose the line 1672 by a if (!$this->_isFunction()). |
[DDC-2208] CASE WHEN ... WHEN doesn't work Created: 19/Dec/12 Updated: 08/Jan/13 |
|
| Status: | Reopened |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.3.1 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Miha Vrhovnik | Assignee: | Fabio B. Silva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Having the following part in select DQL throws an exception.
SUM(CASE
WHEN c.startDate <= :start THEN c.endDate - :start
WHEN c.endDate >= :end THEN :end - c.startDate
ELSE 0
END)
exception: [Syntax Error] line 0, col 124: Error: Expected Doctrine\ORM\Query\Lexer::T_ELSE, got '-' It seems that it's failing inside the second THEN This one also seems to fail:
SUM(CASE
WHEN c.startDate <= :start THEN (c.endDate - :start)
WHEN c.endDate >= :end THEN (:end - c.startDate)
ELSE 0
END)
exception:
[Syntax Error] line 0, col 60: Error: Unexpected '('
Another one:
SUM(CASE
WHEN c.startDate <= :start THEN c.endDate - :start
WHEN c.endDate >= :end THEN :end - c.startDate
ELSE 0
END) = :result FROM ...
exception: [Syntax Error] line 0, col 60: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '=' |
| Comments |
| Comment by Miha Vrhovnik [ 20/Dec/12 ] |
|
I've added two more cases where the parsing fails. Do you want a separate tickets for that? |
| Comment by Fabio B. Silva [ 20/Dec/12 ] |
|
Don't worry, I'll spend some time over this... |
| Comment by Miha Vrhovnik [ 20/Dec/12 ] |
|
The 3rd case seems work just fine as a part of a HAVING clause. |
| Comment by Miha Vrhovnik [ 08/Jan/13 ] |
|
Fabio I have two more...
->addSelect('CASE
WHEN po.quantity IS NULL THEN NULL
ELSE po.quantity -
COALESCE(0, (
SELECT COUNT(rd.product) FROM xxxx rd
WHERE (rd.startDate <= :end) AND (rd.endDate >= :start) AND
rd.product = c.product)))
END
AS po.quantity
')
:edit replaced with real query |
| Comment by Miha Vrhovnik [ 08/Jan/13 ] |
|
addon: well the subquery part can be full query with joins .... |
[DDC-1728] There is no exact alternative function like MONTH in mysql Created: 27/Mar/12 Updated: 27/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | 2.2.0-RC1, 2.2, 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Sudheesh MS | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 11.10 |
||
| Description |
|
i am not able to extract only month from the date field using doctrine2 using 'MONTH' function |
[DDC-726] DQL should deal correctly with composite primary keys Created: 30/Jul/10 Updated: 04/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Guilherme Blanco | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
DQL should deal correctly with composite primary keys: SELECT u FROM User u WHERE u.CompositeAssocEntity = ?1
Should be converted to:
SELECT ... FROM users u WHERE (u.cae_id1, u.cae_id2) = (?, ?) // or something similar
It also supports IN expressions: SELECT u FROM User u WHERE u.CompositeAssocEntity IN (?1, ?2)
Should be converted to:
SELECT ... FROM users u WHERE (u.cae_id1, u.cae_id2) IN ((?, ?), (?, ?)) // or something similar
MySQL, SQLite and PgSQL works smoothly. |
[DDC-138] Allow for mixed inheritance mapping Created: 12/Nov/09 Updated: 24/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Reinier Kip | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Requesting implementation of mixed inheritance mapping (class table inheritance and single table inheritance). This would be especially handy when the difference between certain classes is only "implementational" (i.e. a subclass only functions differently/implements abstract methods and does not specify any additional fields). Using class table inheritance would result in tables only containing an id column. |
[DDC-2313] Deep clone for DBAL QueryBuilder Created: 21/Feb/13 Updated: 21/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Tim Mundt | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is basically a duplicate of another issue I stumbled across lately but cannot find here again. It added a __clone() function to the ORM QueryBuilder to allow this use case: I adopted the code for the DBAL QueryBuilder which is suffering the same issue (e.g. expressions were not cloned but shared between instances). The code is tested at least for my limited use case. /**
$params = array(); foreach ($this->params as $param) { $params[] = clone $param; } $this->params = $params; |
[DDC-1858] LIKE and IS NULL operators not supported in HAVING clause Created: 07/Jun/12 Updated: 20/Mar/13 |
|
| Status: | In Progress |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | PETIT Yoann | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
Win7, Mysql |
||
| Description |
|
The LIKE and IS NULL operators are not supported in HAVING clause. Work: Don't work: |
| Comments |
| Comment by Marco Pivetta [ 08/Jun/12 ] |
|
I think this has already been fixed in latest master and 2.1.7. Could you just give it a try and eventually confirm? |
| Comment by PETIT Yoann [ 08/Jun/12 ] |
|
Already try with 2.17, 2.20 and 2.2.2. This hasn't been fixed. |
| Comment by Bdiang [ 04/Jul/12 ] |
|
I'm also having this issue (2.2.2). Is there any workaround for this? Column aliases also are not supported in HAVING clause: $qb->select('p', 'COUNT(p.field) as FieldCount')
->from('Entity', 'p')
->groupBy('p.id')
->having('FieldCount IS NULL')
Above code causes error "FieldCount is not pointing to class" and IS NULL causes "Expected =, <, <=, <>, >, >=, !=, got 'IS'" |
| Comment by Benjamin Eberlei [ 29/Aug/12 ] |
|
Its not a bug as the EBNF says that this is not possible. Guilherme Blanco Is this something we should support or not? |
| Comment by Christophe Coevoet [ 29/Aug/12 ] |
|
Another place where it is not supported is in the CASE clause. I would vote +1 for supporting it |
[DDC-2119] Problem with inheritance type: INHERITANCE_TYPE_NONE and INHERITANCE_TYPE_TABLE_PER_CLASS Created: 03/Nov/12 Updated: 08/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, Tools |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | SergSW | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql, schematool | ||
| Attachments: |
|
| Description |
|
I tried to create inheritance entities with save policy table per class. I had found a solution. In Doctrine\ORM\Tools\SchemaTool private function _gatherRelationsSql($class, $table, $schema) { foreach ($class->associationMappings as $fieldName => $mapping) { // if (isset($mapping['inherited'])) { // - old version /** * SSW * It's the solution */ if (isset($mapping['inherited']) && !$class->isInheritanceTypeNone() && !$class->isInheritanceTypeTablePerClass() ) { continue; } $foreignClass = $this->_em->getClassMetadata($mapping['targetEntity']); ... But it was enough. In DQL query a simple query was made wrong. I had found a solution again. public function walkSelectExpression($selectExpression) ... // original => if (isset($mapping['inherited'])){ // It's the solution if (isset($mapping['inherited']) && !$class->isInheritanceTypeNone() && !$class->isInheritanceTypeTablePerClass()) { $tableName = $this->_em->getClassMetadata($mapping['inherited'])->table['name']; } else { $tableName = $class->table['name']; } ... This problems are topical for inheritance type: INHERITANCE_TYPE_NONE and INHERITANCE_TYPE_TABLE_PER_CLASS. I don't know, may be my solutions are wrong. But some programmers want to correctly work with INHERITANCE_TYPE_TABLE_PER_CLASS. Sorry for my english. |
| Comments |
| Comment by Fabio B. Silva [ 05/Nov/12 ] |
|
Hi SergSW Could you try to write a failing test case ? Thanks |
| Comment by SergSW [ 06/Nov/12 ] |
|
SSW/TestBundle with the problem |
| Comment by SergSW [ 07/Nov/12 ] |
|
I install the Symfony v2.0.18. and made small TestBundle. |
| Comment by SergSW [ 07/Nov/12 ] |
|
MySQL dump |
| Comment by Benjamin Eberlei [ 12/Nov/12 ] |
|
Adjusted example formatting, don't apologize for your English, thanks for the report! |
| Comment by Benjamin Eberlei [ 24/Dec/12 ] |
|
What version of 2.1 are you using? We don't actually support 2.1 anymore. Inheritance has always worked as used in hundrets of unit-tests, this changes look quite major a bug to have been missed before. I can't really explain whats happening here. |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
SergSW news? |
[DDC-1940] Doctrine DQL: erroneous sql generation from dql join with "WITH" or "WHERE" clause Created: 23/Jul/12 Updated: 14/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Enea Bette | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
LAMP, debian squeeze |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
I'm having big troubles while developing a quietly advanced DQL query for a tiny DMS: The schema: DmsObject is a superclass for which two subclasses exist (document and folder) UserRights and GroupRight (which are associative entities in the db, pointing respectively to user and group tables). User and Group represent (obvious) the dms "actors". SELECT o, ur, gr from module\EDMS\business\DmsObject o join o.userRights ur join o.groupRights gr WHERE o.ownerUser=ur.user AND o.ownerGroup=gr.group The WHERE condition is WRONG! Doctrine switches the two tables. I've already checked the mapping (it's ok!) and checked also where the fk's point in the database (ok!).
...
LEFT JOIN dms_folder d1_
ON d0_.id = d1_.id
LEFT JOIN dms_document d2_
ON d0_.id = d2_.id
INNER JOIN dms_user_object_rights d3_
ON d0_.id = d3_.document_id
INNER JOIN dms_group_object_rights d4_
ON d0_.id = d4_.document_id
WHERE d0_.sys_group_owner = d3_.user_id
AND d0_.sys_user_owner = d4_.group_id
...
This seems to be a bug in the DQL translator. |
| Comments |
| Comment by Benjamin Eberlei [ 29/Jul/12 ] |
|
Enea Bette Can you attach the entities (stripped down to the fields we need here)? Can you check guilherme? This looks really weird. It should be: WHERE d0_.sys_user_owner = d3_.user_id AND d0_.sys_group_owner = d4_.group_id |
| Comment by Guilherme Blanco [ 29/Jul/12 ] |
|
Enea Bette Can you please provide your entities? |
| Comment by Hugo Henrique [ 11/Apr/13 ] |
|
I'm having a similar problem with the query: SELECT um, p FROM Ciwwic\AppBundle\Entity\Provider p LEFT JOIN Ciwwic\UserBundle\Entity\UserMeta um WITH um.user = p.id WHERE p.id = 30 When you run this query DQL she returns an empty array. SELECT p, um FROM Ciwwic\AppBundle\Entity\Provider p LEFT JOIN Ciwwic\UserBundle\Entity\UserMeta um WHERE p.id = 30 AND um.user = 30 |
| Comment by Fabio B. Silva [ 14/Apr/13 ] |
|
Hi Enea If i got it correctly /** * @ORM\ManyToOne(targetEntity="library\system\business\User", fetch="EAGER") * @ORM\JoinColumn(name="sys_group_owner", referencedColumnName="ID") */ protected $ownerUser; /** * @ORM\ManyToOne(targetEntity="library\system\business\Group", fetch="EAGER") * @ORM\JoinColumn(name="sys_user_owner", referencedColumnName="ID") */ protected $ownerGroup; It should be : /** * @ORM\ManyToOne(targetEntity="library\system\business\User", fetch="EAGER") * @ORM\JoinColumn(name="sys_user_owner", referencedColumnName="ID") */ protected $ownerUser; /** * @ORM\ManyToOne(targetEntity="library\system\business\Group", fetch="EAGER") * @ORM\JoinColumn(name="sys_group_owner", referencedColumnName="ID") */ protected $ownerGroup; |
[DDC-349] Add support for specifying precedence in joins in DQL Created: 18/Feb/10 Updated: 01/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.0-ALPHA4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Dennis Verspuij | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
This request is in followup to my doctrine-user message "Doctrine 2.0: Nested joins'. As a short example the following is a SQL statement with a nested join, where the nesting is absolutely necessary to return only a's together with either both b's and c's or no b's and c's at all: SELECT * In order for Doctrine 2 to support this the BNF should be something like: This would allow DQL like: SELECT A, B, C What further needs to be done is that the DQL parser loosly couples the ConditionalExpression to any of the previously parsed JoinAssociationPathExpression's instead of tieing it explicitely to the JoinAssociationPathExpression that preceedes it according to the old BNF notation. The new BNF should however not require any changes to the hydrator. Therefore I have the feeling that improving the DQL parser for nested joins does not require extensive work, while the benefit of running these kind of queries is considerable. As an extra substantiation here are links to (BNF) FROM clause documentations of the RDBMS's that Doctrine 2 supports, they all show support for nested joins: I surely hope you will consider implementing this improvement because it would save me and others from the hassle of writing raw SQL queries or executing multiple (thus slow) queries in DQL for doing the same. Thanks anyway for the great product so far! |
| Comments |
| Comment by Guilherme Blanco [ 13/Apr/10 ] |
|
This seems to be a valid issue to me. This implementation is the actual solution to associations retrieval that are inherited (type joined). Example: /** Joined */
class Base {}
class Foo extends Base {}
class Bar {
public $foo;
}
// This causes the CTI to link as INNER JOIN, which makes the result become 0
// il if you have no Foo's defined (although it should ignore this)
$q = $this->_em->createQuery('SELECT b, f FROM Bar b LEFT JOIN b.foo f');
|
| Comment by Roman S. Borschel [ 13/Apr/10 ] |
|
Yes, this is a possible solution for |
| Comment by Roman S. Borschel [ 13/Apr/10 ] |
|
So, no, this has nothing to do with |
| Comment by Roman S. Borschel [ 13/Apr/10 ] |
|
On a side note I would still like to know/see the following for this issue:
So far, my stance on this issue is: 1) It doesnt make sense (semantically) in DQL Thus I am currently leaning towards "Wont fix" for this issue. |
| Comment by Dennis Verspuij [ 13/Apr/10 ] |
|
Hi Roman. I understand your doubts, and I have been breaking my head over SELECT A.id, A.username, A.balance, COALESCE(SUM(B.stake), 0) AS sumstake, COUNT(B.id) AS nrbets But let's put it another way. I would also like this feature to be supported in DQL Btw, I recall to have successfully used the nested join syntax in HQL (.NET Hibernate) Furthermore, in reply to your stances: Well, this is it, can't find any more words to promote and make you enthusiastic.... lol. |
| Comment by Dennis Verspuij [ 13/Apr/10 ] |
|
Ok, I have not given up yet... Imagine a book store that sells books of various authors and keeps track of those sales. SELECT A., B., S.* In DQL it would then be something like: SELECT A., B., S.* If the database would contain thousands of books, but sales for just a I have attached a test casefor a similar query, though without the additional One last note, you shouldn't be afraid that nesting joins is not in the P.S. I had a hard time finding out how to run the test cases, I could not find |
| Comment by Dennis Verspuij [ 13/Apr/10 ] |
|
Test case as SVN patch using a parenthesized join. |
| Comment by Roman S. Borschel [ 29/May/10 ] |
|
@"The need for native queries partly reverts the benefits Doctrine offers in the first place." That is something I hugely disagree with. Neither SQL abstraction, nor database vendor independence is the main purpose of an ORM like Doctrine 2. We could rip out DQL and any other querying mechanism except a basic find() (and lazy-loading, of course), only providing the native query facility and even only supporting MySQL and would still retain all the core ORM functionality. NativeQuery is one of the best and core "features" of the project. It is even the foundation for DQL. A DQL query is nothing more than an additional (beautiful) abstraction but what comes out is a native query + a ResultSetMapping, the same thing you can build yourself in the first place, even using the mapping metadata to construct the query. Nothing forces you to hardcode table and column names in native queries if you don't want that. Just use the mapping metadata, DQL does the same. SQL abstraction and database vendor independence is icing on the cake, not the heart of the ORM. |
[DDC-2052] Custom tree walkers are not allowed to add new components to the query Created: 02/Oct/12 Updated: 14/May/13 |
|
| Status: | Reopened |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.3 |
| Fix Version/s: | 2.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Łukasz Cybula | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql | ||
| Description |
|
Custom tree walkers have freedom in modifying the AST but when you try to add a new query component (i.e. new join in walkSelectStatement() ) to the AST then the SqlWalker throws an exception because it does not has the new component in its _queryComponents array. I see two possible ways to resolve this: |
| Comments |
| Comment by Benjamin Eberlei [ 06/Oct/12 ] |
|
Ok this is much more complicated to allow then i thought. The problem is that the QueryComponents are passed by value, as an array, not by reference. That prevents changing them because this change wouldn't be visible in the output walker. I can add a method to allow this in the OutputWalker for now, but generally this requires a bigger refactoring on the Query Components. |
| Comment by Benjamin Eberlei [ 06/Oct/12 ] |
|
Added setQueryComponent() in SQL Walker to allow modification in output walker. |
| Comment by Łukasz Cybula [ 08/Oct/12 ] |
|
I'm afraid that this doesn't solve the initial problem at all. I'll try to describe it in more details to show what I mean. Suppose we have two doctrine extensions each of which contain its own tree walker. Each of these tree walkers need to modify AST and add new component to it (joined with some component already existing in the query). The first problem is that each tree walker has its own queryComponents array which is not passed between them, although they not necessary need to use queryComponents - they could use only AST. The second, bigger problem is that the Parser class does not know anything about modifications of queryComponents in tree walkers and cannot pass modified version to the OutputWalker. The goal of submitting this issue was to allow adding new components to the query in tree walkers which is not achievable by your fix. I think it may be the first step in the right direction. Maybe TreeWalkerAdapter should have public method getQueryComponents() which would be used by the Parser to pass modified queryComponents between different tree walkers and finally to the OutputWalker ? This would not break backward compatibility and solve this issue. What do you think about it? |
| Comment by Łukasz Cybula [ 08/Oct/12 ] |
|
I've tried to implement the solution mentioned in previous comment but it's also not so clean and easy as I thought. Each tree walker (including TreeWalkerChain) would have to implement getQueryComponents() and setQueryComponent($alias, array $component) methods. The same with SqlWalker, so the TreeWalker interface should have these methods, which would break BC in some way (walkers that do not inherit from SqlWalker or TreeWalkerAdapter will fail to compile). So maybe my first solution (PR #464) is not so bad for now? In the future queryComponents could be replaced by a special object or could be passed by a reference to allow modifications. |
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
Marked as improvement as its not a bug. A solution might probably implement an object holding all the QueryComponent, implementing ArrayAccess. So that way the state can be shared. |
| Comment by Marco Pivetta [ 14/May/13 ] |
|
Just hit this while developing an ast walker... Will look into it too since I need it more than soon. |
| Comment by Marco Pivetta [ 14/May/13 ] |
|
As a VERY UGLY workaround, I used a static variable and a custom sql walker in combination with my AST walker. namespace Comcom\Versioning\ORM\Query; use Doctrine\ORM\Query\SqlWalker; class WorkaroundSqlWalker extends SqlWalker { public function __construct($query, $parserResult, array $queryComponents) { parent::__construct($query, $parserResult, $queryComponents); foreach (VersionWalker::$additionalAliases as $alias => $value) { $this->setQueryComponent($alias, $value); } } } |
[DDC-2444] NULL IN CASE WHEN Created: 12/May/13 Updated: 14/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | vahid sohrabloo | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi |
| Comments |
| Comment by Miha Vrhovnik [ 14/May/13 ] |
|
We could say a duplicate of: DDC-2208 |
[DDC-2452] Additional `WITH` condition in joins between JTI roots cause invalid SQL to be produced Created: 16/May/13 Updated: 16/May/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Marco Pivetta | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql, sql-walker | ||
| Environment: |
irrelevant |
||
| Description |
|
Given a simple Joined Table Inheritance like following: /** * @Entity @Table(name="foo") @InheritanceType("JOINED") * @DiscriminatorColumn(name="discr", type="string") * @DiscriminatorMap({"foo" = "DDC2452Foo", "bar" = "DDC2452Bar"}) */ class DDC2452Foo { /** @Id @Column(type="integer") @GeneratedValue */ public $id; } /** @Entity @Table(name="bar") */ class DDC2452Bar extends DDC2452Foo { } Following DQL SELECT foo1 FROM DDC2452Foo foo1 JOIN DDC2452Foo foo2 WITH 1=1 Will produce broken SQL: SELECT
f0_.id AS id0, f0_.discr AS discr1
FROM
foo f0_
LEFT JOIN bar b1_
ON f0_.id = b1_.id
LEFT JOIN foo f2_
LEFT JOIN bar b3_
ON f2_.id = b3_.id
ON (1 = 1)
(please note the duplicate `ON` in the SQL) That is caused because of the SQL walker producing the JTI filter with already the `ON` clause in it. That happens because the JTI join conditions are added in https://github.com/doctrine/doctrine2/blob/2.4.0-BETA2/lib/Doctrine/ORM/Query/SqlWalker.php#L823-L825 (`walkRangeVariableDeclaration`), while the additional defined `WITH` conditions are considered in `walkJoinAssociationDeclaration` later on. Added a test case and fix at https://github.com/doctrine/doctrine2/pull/668 |
[DDC-2076] Optimization for MEMBER OF Created: 14/Oct/12 Updated: 14/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Christophe Coevoet | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | dql | ||
| Description |
|
Currently, using MEMBER OF for a ManyToMany collection does a join on the table of the related entity, whereas all it needs is in the join table. Using the following DQL: SELECT p FROM Player p WHERE NOT :team MEMBER OF p.targetedBy Here is the current generated SQL: WHERE NOT EXISTS (SELECT 1 FROM player_team p1_ INNER JOIN Team t2_ ON p1_.team_id = t2_.id WHERE p1_.player_id = p0_.id AND t2_.id = ?) whereas it could drop the join: WHERE NOT EXISTS (SELECT 1 FROM player_team p1_ WHERE p1_.player_id = p0_.id AND p1_.team_id = ?) |
[DDC-1916] Centralize the Cache mechanism simplifying the query creation Created: 09/Jul/12 Updated: 09/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | liuggio | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi all, in a big project if you have queries spread out in different the idea: see the code for a better explanation the pro: a better handling of the cache mechanism Do you think is a good approach? Thanks liuggio |
[DDC-1754] Allow use of Foregin Keys in DQL LIKE condition Created: 03/Apr/12 Updated: 09/Apr/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Tim Roediger | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Php 5.3 |
||
| Description |
|
When using a LIKE condition in a WHERE clause, I would like to be able to use the foreign key of a single value association. For example: Imagine Product and Department are both entities. Department has the field Name with a unique index. Product is has a ManyToOne association called Department with the Department entity, referencing the field Name. I would like to write: However, at present I need to write: The issue is one of performance. On large record sets the first query runs several magnatudes more quickly than the second, particularly when four or five joins are involved. Looking at the DQL grammar from the online docs, the relveant lines are: LikeExpression ::= StringExpression ["NOT"] "LIKE" string ["ESCAPE" char] The problem is the StateFieldPathExpression in StringPrimary. When used with a LikeExpression a SingleValuedAssociationField should be allowed also. |
| Comments |
| Comment by Benjamin Eberlei [ 07/Apr/12 ] |
|
This would only work if Department#Name is the primary key. Is it? DQL is not about optimized performance in very single edge case. We need to keep some parts open to keep the code simple. This is at best a feature request, not a bug. |
| Comment by Tim Roediger [ 09/Apr/12 ] |
|
Thanks for your reply Benjamin, I agree with your assesment that this is more accurately an improvement request than a bug. My appologies it was placed in the wrong category. No, Department#Name is not the primary key, but it does have a unique index. I've worked a little more to understand the DQL grammar. It appears that only one small, simple change is required: FROM: TO: This would improve consistancy with other aspects of DQL. For example, AggregateExpression COUNT, NullComparisonExpression , GroupByItem, and ArithmeticPrimary all allow a SingleValuedPathExpression rather than the more strict StateFieldPathExpression. Bascially my frustration is that as DQL currently stands, foregin keys which are already existant in a db table cannot be used in a LIKE expression without doing an unnessessary JOIN. Foreign keys can already be used in DQL for BETWEEN, IS NULL and comparison expressions, so why not LIKE expressions also? It appears the only thing holding this back is an unrequired restriction in the DQL grammar. Cheers, Tim |
[DDC-2260] Partial DQL query doesn't respect given order of columns Created: 26/Jan/13 Updated: 27/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Alexander Grimalovsky | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When executing partial DQL queries it may be important to keep given order of columns e.g. for "pairs" hydrator when first column of a pair is used as a key and second - as value. For example query like this: select partial u.{id,name} from my:User u will expect "id" to be first in resulted set and "name" to be second and not vice versa. However Doctrine parses this part of statement via iterating over fields mapping from entity's class metadata (as can be seen in Doctrine\ORM\Query\SqlWalker::walkSelectExpression()): foreach ($class->fieldMappings as $fieldName => $mapping) {
if ($partialFieldSet && ! in_array($fieldName, $partialFieldSet)) {
continue;
}
...
and hence given columns order preserving is not guaranteed. |
| Comments |
| Comment by Marco Pivetta [ 26/Jan/13 ] |
|
What is the advantage in respecting the order given in the DQL query? |
| Comment by Alexander Grimalovsky [ 27/Jan/13 ] |
|
Currently the only practical reason for it that I found is "pairs" hydrator. However it is, of course, possible to implement it without such change too. Generally speaking this behavior (getting result set with same order of columns that was given in a query) is something that is feeling "natural" for operations with database since it is how you normally get results from SQL queries. Maybe it will be enough to mention in documentation for Doctrine that given columns order is not guaranteed to be kept. |
| Comment by Marco Pivetta [ 27/Jan/13 ] |
|
@Alexander Grimalovsky I don't think it's worth mentioning it. Also, including a fix for this is quite complex. If you prefer to document it, go for it! |
[DDC-1675] PDO::FETCH_GROUP Created: 01/Mar/12 Updated: 01/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Henrik Bjornskov | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
PDO supports grouping by a field when doing a fetchAll() by using PDO::FETCH_GROUP. This can in many places be useful. http://blog.stealth35.com/2011/08/17/pdo-fetch-group.html desribes the behavior quite well. |
[DDC-712] allow RIGHT JOIN or specifying the root class of the hydratation tree Created: 21/Jul/10 Updated: 22/Jul/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Mihai Ilinca | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi! Let me start by saying you guys did a great job with Doctrine 1 and that I can't wait to start using Doctrine2 I will explain this feature request with an example. I have a User entity wich relates one to many to a Picture entity. Picture has a " is main picture" boolean field. Not all users have a main picture. I would like to be able to select all Users, each with their main picutre, if that exists, or some Null value, if it does not exists, in one query, using join. I would also like for the result collection to contain Picture entities on the first level, with the User beinng accessible as an aggregate of Picture. The way I can think doing this is by using a RIGHT or LEFT join (not INNER) as to also select Users that don't have a main picture. I can do this by selecting SELECT Picture p, p.User u FROM p RIGHT JOIN u WITH p.main=1 but right joins afik are not available atm in either version of Doctrine, or by selecting SELECT User u, u.Picture p FROM u LEFT JOIN p WITH p.main=1 and somehow instructing the hydrator to consider Picture as the root object for the generated object tree and User as a "child" of Picture. For users without a picture, the Picture object would somehow indicate it is NULL, while still holding a refference to the User. Makes sense? |
| Comments |
| Comment by Benjamin Eberlei [ 22/Jul/10 ] |
|
Why don't you model that as ManyToOne for the Main Picture and OneToMany for all pictures? Makes much more sense from an ORM perspsective, you would have your own property "User::$mainPicture" |
| Comment by Mihai Ilinca [ 22/Jul/10 ] |
|
Thanks for the suggestion. However, this was just an example to demonstrate some lack of flexibility, I am not strictly looking for a solution to this example, but to the concept behind it. Also, how would I get the result with Picture on the top level and User aggregated to Picture with the model you suggested? Unless I am missing something, wouldn't I end up in the same situation? I can post-process the results myself and create a new collection easily, ofc, but it would be better (and more optimal) if I could tell the hydrator to do this, similar to how INDEXBY is passed as an option to the hydrator. |
Add the notion of read-only entities
(DDC-209)
|
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL, ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Sub-task | Priority: | Minor |
| Reporter: | Roman S. Borschel | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 5 |
| Labels: | None | ||
| Description |
|
Setting such a query hint to TRUE should result in all entities being retrieved by that query to be read-only for the purposes of change-tracking. Note that the entities themselves need not necessarily be read-only in general. This feature is a flush performance tweak that can be used to query for objects but not let the returned objects run through change-tracking on flush. Any other managed objects are tracked as usual so you can do a read-only query for 100 entities and persist a new entity in the same unit of work with optimal flushing performance. |
| Comments |
| Comment by Konstantin [ 26/Dec/11 ] |
|
Any news? |
| Comment by Gigi Largeanus [ 31/May/12 ] |
|
Any news on this? I think this is a must have feature. Thanks for all your work. |
[DDC-1466] Entity ID hash generation improvement in UnitOfWork Created: 03/Nov/11 Updated: 03/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Aigars Gedroics | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently ID hash is generated using implode function with space character. I would like to point out that problems may raise if the ID column values are allowed to contain the space themselves - different objects could return equal ID hash values. The trivial one-line solution would be to serialize the array instead. Cheaper solution from performance perspective would be escaping the space character for ID values. |
[DDC-1761] Small error on DQL documentation page Created: 03/Apr/12 Updated: 03/Apr/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Trivial |
| Reporter: | Tim Roediger | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
On this document page: The following lines are present: There is an error in: It should read |
[DDC-1285] Select by multiple ids Created: 22/Jul/11 Updated: 11/Jan/13 |
|
| Status: | In Progress |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Serge Smertin | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
How do you look at adding findByIds(array $ids) to EntityManager and UnitOfWork? This would allow fetching multiple entities from a database at one request and would be very useful for caching - there would be even some kind of IdentityMap kept in memcached or any other caching engine, that supports multiple id retrieval: i've been using such an architecture in multiple projects and it turned out to be very effective. There were two basic methods - findIdsByFilter(array $filter) and findEntitiesByIds(array $ids). The latter one had a caching proxy, replicating entities to a cache storage. If this idea proceeds - I'd be glad to cover it with more details. This topic on StackOverflow could also help: |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-1178] Have access to "original" metadata in events subscribed to loadClassMetadata Created: 27/May/11 Updated: 27/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.x |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Miha Vrhovnik | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If you subscribe to loadClassMetadata you will usually modify the metadata for some classes. My proposal would be to add function get(Original|Raw)MappingData into interface Doctrine\ORM\Mapping\Driver\Driver which would either return raw data or data in a object specific for that Driver or null if it doesn't make sense for that driver. Please note, that when loading from e.g XmlDriver we should return simplexmlnode or dom node as loadClassMetadata should be in its own namespace and not pollute the Doctrine one. |
| Comments |
| Comment by Gediminas Morkevicius [ 27/May/11 ] |
|
Sounds logic, each driver would expect NULL or data (wrapped specifically for the driver used) |
[DDC-972] MySql MyISAM support Created: 07/Jan/11 Updated: 13/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | nicolas isnardi | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Environment: |
All |
||
| Description |
|
We can not set MySql Engine for MyISAM. MySqlPlatform has a _getCreateTableSQL where you can pass some options with the engine param. |
| Comments |
| Comment by Cédric Tailly [ 19/May/11 ] |
|
I have the same problem and I didn't found documentation to select the engine for a given table. I tried to understand the code by myself and made modifications of my Doctrine v2.0.5, perhaps this is not the best one but here is a beginning of a solution : ------------------------------------------------------------------------------- @ ORM\Mapping\Driver\DoctrineAnnotations.php:100 final class Table extends Annotation { public $name; public $schema; public $indexes; public $uniqueConstraints; public $engine; }@ ORM\Mapping\Driver\AnnotationDriver.php:144 $primaryTable = array( @ ORM\Tools\SchemaTool.php:133 $table = $schema->createTable($class->getQuotedTableName($this->_platform)); if ( isset($class->table["engine"]) ) ------------------------------------------------------------------------------- ...and to define for instance the MyISAM engine in annotations : /**
Because there is no foreign key on MyISAM tables, there are still problems on the schema creation/update when Doctrine executes the corresponding "alter table" SQL commands. |
| Comment by gabriel sancho [ 12/Jul/12 ] |
|
in Doctrine 2.2.2 will be Doctrine/ORM/Tools/SchemaTool.php-149- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1719- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/ClassMetadataInfo.php-1723- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Table.php-42- /// PATCH ------------------------------------ Doctrine/ORM/Mapping/Driver/AnnotationDriver.php-181- /// PATCH ------------------------------------ i found a problem in ManyToMany relations, the intermediate table will be InnoDB |
| Comment by Benjamin Eberlei [ 13/Jul/12 ] |
|
You can do all tables as MyISAM already through metadata using @Table(options= {"engine": "MyISAM"}) except Many-To-Many Join Tables. But you could create a listener to the "postSchemaGenerate" event and accept the schema instance there, modify everything accordingly. |
| Comment by Christophe Coevoet [ 13/Jul/12 ] |
|
should we add the support of the options for the @JoinTable annotation ? |
| Comment by Benjamin Eberlei [ 13/Jul/12 ] |
|
Yes, that is probably what this ticket boils down to |
[DDC-930] A table cannot have more than one many to many relationship with the same table when using reverse engineer Created: 13/Dec/10 Updated: 13/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0-RC2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Jiri Helmich | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
FreeBSD, PostgreSQL 8.4 |
||
| Description |
|
This is caused by taking the join column name as the identifier while generating a property name for annotation. The mapping driver detects that the same property is already defined and ends the convert process. A little bit smarter approach for me was to take the local table name. But this assumes a specific style of join table naming convention. Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass() Replace: $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower(current($otherFk->getColumns())))); With: $name = explode("_",$myFk->getLocalTableName()); $associationMapping['fieldName'] = Inflector::camelize(str_replace('_id', '', strtolower($name))); Maybe to switch to this behavior with an additional option? |
[DDC-1308] Add cache for transient information and invalidation for ClassMetadata Created: 31/Jul/11 Updated: 20/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Two different things have to be improved in the caching: 1. The information isTransient() has to be moved to the ClassMetadataFactory and cached there. |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-1957] DB -> Entity: Reverse engeniering with two relations between two tables Created: 29/Jul/12 Updated: 29/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | sky diablo | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Cli | ||
| Environment: |
windows 7, php 5.3, symfony 2.1 |
||
| Description |
|
i use the cli from the symfony 2.1 project to reverse from DB to Entity: php app/console doctrine:mapping:convert xml ./src/Acme/StoreBundle/Resources/config/doctrine/metadata/orm --from-database --force and i get tis error: [Doctrine\ORM\Mapping\MappingException] so i have a table "radUser" with two m:n relations to the same table "radAttributes": Table radUser: so doctrine reverse mapping try to generate the radAttribute entity with two mapping to radUser with the same field name "radUser", what can i do to prevent this issue ? |
[DDC-1817] Allowing to specify MySQL Collation on Field Basis Created: 08/May/12 Updated: 08/May/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, Tools |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Johannes Schmitt | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It would be nice to be able to specify which collation to use on a field basis. This would for example be useful when you have case-sensitive (utf8_bin), and case-insensitive (utf8_general_ci) values. Right now, this needs to be manually added to migration files (which is ok for projects, but it is not so nice for distributable libraries). |
[DDC-1738] Allow multiple Generators per class Created: 29/Mar/12 Updated: 20/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Guilherme Blanco | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We should be able to support multiple generators per class. Currently we only support 1 generator per class. |
[DDC-1180] Indexed Associations: foreign key (association) cannot be used as indexBy field Created: 29/May/11 Updated: 02/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Petr Sobotka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
Using Doctrine ORM 2.1.0BETA1 |
||
| Description |
|
I am trying to index a collection by its entity's column which is also a foreign key (association). It seems to me that it is not possible at the moment. For example: /**
* @Entity
*/
class Hotel
{
// $id column and other stuff
/**
* @oneToMany(targetEntity="Booking", mappedBy="hotel", indexBy="room")
* @var Booking[]
*/
private $bookings;
}
/**
* @Entity
*/
class Booking
{
/**
* @var Hotel
*
* @Id
* @ManyToOne(targetEntity="Hotel", inversedBy="bookings")
* @JoinColumns({
* @JoinColumn(name="hotel_id", referencedColumnName="id")
* })
*/
private $hotel;
/**
* @var Room
*
* @Id
* @ManyToOne(targetEntity="Room")
* @JoinColumns({
* @JoinColumn(name="room_id", referencedColumnName="id")
* })
*/
private $room;
}
Only possible workaround I found is to define another (plain) entity's property mapped to the same table column and index by it: /**
* @Entity
*/
class Hotel
{
// $id column and other stuff
/**
* @oneToMany(targetEntity="Booking", mappedBy="hotel", indexBy="roomId")
* @var Booking[]
*/
private $bookings;
}
/**
* @Entity
*/
class Booking
{
// ...
/**
* @var Room
*
* @Id
* @ManyToOne(targetEntity="Room")
* @JoinColumns({
* @JoinColumn(name="room_id", referencedColumnName="id")
* })
*/
private $room;
/**
* @var integer $roomId
*
* @Column(name="room_id", type="integer", nullable=false)
*/
private $roomId;
}
Wouldn't it be easy to support it? |
| Comments |
| Comment by Benjamin Eberlei [ 05/Jun/11 ] |
|
It is not so easy to implement from the first gimplse and it is not a bug but an improvement/feature request. |
| Comment by Benjamin Morel [ 02/Mar/13 ] |
|
Related PR: https://github.com/doctrine/doctrine2/pull/204 |
[DDC-2337] Allow an entity to use its own persister to take advantage of DB level features if necessary Created: 06/Mar/13 Updated: 06/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Nathanael Noblet | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I have a situation where I wanted a single table to use INSERT DELAYED. Its an audit log table where I expect each http request to generate many inserts for. In an effort to not over tax the system I implemented a custom Entity Persister so that it would work. This obviously doesn't work with all mapping drivers. However if this is a feature that you think is worth integrating I will fork it on github and complete the implementation alongside any changes/improvements requested... |
[DDC-2147] Custom annotation in MappedSuperclass Created: 15/Nov/12 Updated: 07/May/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | kluk | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 3.6.6-1.fc17.x86_64 |
||
| Attachments: |
|
| Description |
|
When you try use custom annotation in mappedsuperclass like here http://pastebin.com/YMxKvcLk and then i try get metadata for class i get this error |
| Comments |
| Comment by kluk [ 15/Nov/12 ] |
|
error log from orm:validate-schema |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Copying from pastebin: use \Doctrine\ORM\Mapping as ORM; use \xxx\Doctrine\Annotation\Entity as re; use \xxx\Doctrine\Annotation\Forms as rf; use \Doctrine\Common\Collections; /** * @ORM\Entity */ class EventPicture extends \Picture { /** * @ORM\ManyToOne(targetEntity="Event", inversedBy="eventPicture") * @ORM\JoinColumn(name="FK_Event", referencedColumnName="id") */ protected $event; } use \Doctrine\ORM\Mapping as ORM; use \xxx\Doctrine\Annotation\Entity as re; use \xxx\Doctrine\Annotation\Forms as rf; use \Doctrine\Common\Collections; /** @ORM\MappedSuperclass */ class Picture extends \xxx\Doctrine\Entity\BaseEntity { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="IDENTITY") * @var type */ protected $id; /** * @ORM\Column(type="string",unique=true, nullable=false) * @rf\FileUpload(fileSize="php",uploadType="local",fieldName="link",formControl="FileUploadField",image=true) * */ protected $link; } kluk does this happen also with any other simple custom annotation? For example following:
/**
* @Annotation
* @Target({"PROPERTY","ANNOTATION"})
*/
final class Entity implements Annotation
{
/**
* @var string
*/
public $value;
}
|
| Comment by kluk [ 30/Jan/13 ] |
|
the same error when using simple annotation.
<?php
use \Doctrine\ORM\Mapping as ORM;
use \xxx\Doctrine\Annotation\Entity as re;
use \xxx\Doctrine\Annotation\Forms as rf;
use \Doctrine\Common\Collections;
/** @ORM\MappedSuperclass */
class Picture extends \xxx\Doctrine\Entity\BaseEntity {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="IDENTITY")
* @var type
*/
protected $id;
/**
* @ORM\Column(type="integer")
* @rf\SetClass({"class","hide"})
*/
public $value;
/**
* @ORM\Column(type="string",unique=true, nullable=true)
* @rf\FileUpload(fileSize="php",uploadType="local",fieldName="link",formControl="FileUploadField",image=true)
*
*/
protected $link;
}
When i remove $value , $picture from class everything goes ok.
/**
* INTERNAL:
* Adds a field mapping without completing/validating it.
* This is mainly used to add inherited field mappings to derived classes.
*
* @param array $fieldMapping
*
* @return void
*/
public function addInheritedFieldMapping(array $fieldMapping)
{
if(isset($fieldMapping['fieldName'])){
$this->fieldMappings[$fieldMapping['fieldName']] = $fieldMapping;
$this->columnNames[$fieldMapping['fieldName']] = $fieldMapping['columnName'];
$this->fieldNames[$fieldMapping['columnName']] = $fieldMapping['fieldName'];
}
}
But i dont know if this fix can break another part of doctrine. |
| Comment by Benjamin Eberlei [ 04/May/13 ] |
|
Can you put the code of your annotations online? I can't seem to understand why this happens. |
| Comment by kluk [ 07/May/13 ] |
|
Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml namespace libs\Doctrine\Annotation\Entity; use Doctrine\Common\Annotations\Annotation; /** @Annotation */ class CustomMapping extends Annotation { /** * * @var string */ public $className; /** * * * @var IQueryable| string */ public $dataSource; } |
[DDC-1247] Implement AnnotationDriver::addExcludePath Created: 04/Jul/11 Updated: 19/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Filip Procházka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Hi, For example, I have my descendant of PHPUnit_Framework_TestCase in libs and the driver just dies, because PHPUnit is not loaded, and I don't want to load it, to be able to finish the process. Solution would be add method AnnotationDriver::addExcludePath, whose name speaks for itself Temporarily, I had to extend the AnnotationDriver and overload the crawling process, which is realy annoing, because I had to copy the whole method with all its exceptions and I would have to maintain it, till this will be in Doctrine. Can be viewed here https://github.com/Kdyby/Framework/blob/master/libs/Kdyby/Doctrine/Mapping/Driver/AnnotationDriver.php Thanks |
| Comments |
| Comment by Jan Dolecek [ 20/Apr/12 ] |
|
This behavior really messes with my projects, as it automatically loads all php files. Not just those with classes, but also simple scripts, which can do horrible stuff (e.g. I've got scripts to make changes in the source code!) Annotations should be read without executing the scripts, e.g. by TokenReflection library: https://github.com/Andrewsville/PHP-Token-Reflection |
| Comment by Patrik Votoček [ 27/Aug/12 ] |
| Comment by Christophe Coevoet [ 19/Sep/12 ] |
|
@Jan Tokenizing the file was the way annotations were handled in 2.0. Doctrine 2.1 switched to using Reflection to read annotation because it is faster. @Filip I'm wondering why you would have PHPUnit testcases in a path storing entities. |
| Comment by Filip Procházka [ 19/Sep/12 ] |
|
@stof > Tokenizing the file was the way annotations were handled in 2.0. Doctrine 2.1 switched to using Reflection to read annotation because it is faster. And it is obviousely the wrong one. There is no argument, that could beat the fact, that the result can and should be cached, as it does already. Correct behaviour is much more valuable than few miliseconds on first run. > I'm wondering why you would have PHPUnit testcases in a path storing entities. I don't. They are base classes for the actual tests. I agree they might (or should) be somewhere else, but the fact, that they should not be executed, when readed, stays. |
| Comment by Christophe Coevoet [ 19/Sep/12 ] |
|
@Filip The AnnotationReader is not loading any file. It simply expects a ReflectionClass. The ORM AnnotationDriver expects a path in which it should look for annotated classes, to be able to implement getAllClasses() (as it cannot expect all classes to be already loaded). And btw, the behavior was the same in 2.0 when the reader was using tokenization. |
[DDC-1198] Add PHPDocs to annotationclasses Created: 08/Jun/11 Updated: 08/Jun/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Minor |
| Reporter: | Robert Gruendler | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
If an IDE would like to support annotations, it's currently only possible to display all resolvable classes in a code-hint menu when autocompleting annotations, as To make it possible for IDEs to detect classes which are explicitly meant to be used as annotations, it would be nice to agree on some common Here's an example of what this could look like: https://github.com/pulse00/doctrine2/commit/25a14e9edc406edfd33e54fc38922a191e9cbe83 This way IDEs can prioritize annotated classes in code-hints and add additional information to the user. |
[DDC-1373] Map file with specific class Created: 13/Sep/11 Updated: 14/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Thomas Tourlourat - Armetiz | Assignee: | Fabio B. Silva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian LAMP - PHP5.3 - Apache 2 |
||
| Description |
|
Hi there, It's a cool feature because it's allow loading on-demand. It should be great to be able to manually map XML/YAML File description to a Class, like : This feature is simple to implement, just add a new array inside AbsractFileDriver to know the mapping. AbsractFileDriver->getAllClassNames () just return value of mapping array. With this new feature, it allow developers to create a pretty folder that contains entities mapping. Armetiz. |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-2053] [GH-460] added support to extend strategies for IdGenerators Created: 02/Oct/12 Updated: 03/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This issue is created automatically through a Github pull request on behalf of Powerhamster: Url: https://github.com/doctrine/doctrine2/pull/460 Message: Mapping drivers now use extended classmetadata class to find constants of generator types. |
| Comments |
| Comment by Benjamin Eberlei [ 03/Oct/12 ] |
|
A related Github Pull-Request [GH-460] was closed |
[DDC-2035] XML Mapping : add attribute "length" for tag "id" Created: 20/Sep/12 Updated: 29/Sep/12 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Erik Müller | Assignee: | Fabio B. Silva |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux, Doctrine ORM 2.3.0, MySQL |
||
| Description |
|
XML mapping : <id name="id" type="string" length="16"/> Generate SQL : id varchar(255) not null
It's not possible with XML mapping to have : id varchar(16) not null
Because tag "id" doesn't support "length" attribute. |
| Comments |
| Comment by Fabio B. Silva [ 20/Sep/12 ] |
|
Hi Erik, The atribute "id" arealdy support "length" in the current doctrine version Which version are you using ? |
[DDC-2030] better way to detect class parents Created: 13/Sep/12 Updated: 13/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Asmir Mustafic | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi! I'm trying to detect some inheritance cases, but there is a problem. Doctrine always uses PHP class inheritance to detect entity hierarchy, but generating entities starting from database, i have not yet any php class. There is a better way to detect entities hierarchy? Without php classes... The practical case is: Even if i manualy create XML mapping files, and then i try to generate php entityes. There is the same problem. XmlDriver tries to call setDiscriminatorMap method that raises the same exception. |
[DDC-1993] New method required: ClassMetadataInfo::isAssociationNullable() Created: 22/Aug/12 Updated: 22/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | gregoire_m | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, I'm working with Symfony 2.1, and I need to know if an association is nullable for a given entity (to know if a form field should be marked as 'required'). So I'd like to have a isAssociationNullable() method in the ClassMetadataInfo class, that should do the same thing that the isNullable() method does for fields. You can see more information about the problem on the Symfony issue. Thanks. |
[DDC-2308] Naming Strategy for Reverse Engeneering Created: 21/Feb/13 Updated: 21/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Andreas Prucha | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Unfortunately DatabaseDriver::getClassNameForTable() is declared as private method, which makes it quite difficult to change the naming strategy for reverse engeneering. IMO this sould be declared protected. An even better way would be to extend the interface of the Naming Strategy objects to support the reverse direction: classToTableName -> tableToClassName This way we would have a consistent name-mapping |
[DDC-2288] Schema Tool doesn't update collation on table level Created: 08/Feb/13 Updated: 08/Feb/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, Tools |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Rickard Andersson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | collation, schematool | ||
| Description |
|
In Symfony2, when updating the collation option of a table, the schema tool doesn't recognize the change: Changing from: * @ORM\Table() To:
* @ORM\Table(options={"collate"="utf8_swedish_ci"})
Results in: $ php app/console doctrine:schema:update --dump-sql Nothing to update - your database is already in sync with the current entity metadata. |
[DDC-747] Add support for table, column and indexes comments Created: 13/Aug/10 Updated: 14/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Minor |
| Reporter: | s9e | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Description |
|
It would be nice to add support for table comments, column comments and indexes comments, i.e. @Table(
name="ecommerce_products",
comment="Contains products",
indexes={@index(name="search_idx", comment="Makes finding people by name easier", columns={"name", "email"})}
)
@Column(type="integer", comment="Stores the user's age, in years")
MySQL supports comments via ALTER TABLE since 4.1. For databases that don't support those persistent comments, you could use normal SQL comments in the table definition. Of course they wouldn't be stored by the database, but at least they would appear in the generated schema, that's better than nothing. |
[DDC-957] When there is no GeneratedValue strategy on a primary key, setter function should be generated Created: 29/Dec/10 Updated: 29/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Flyn San | Assignee: | Jonathan H. Wage |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
PHP 5.3.3 |
||
| Description |
|
In the YAML/XML, if no GeneratedValue strategy is given for the primary key, a setter function is required in the generated entity class. Currently only a getter is made. |
[DDC-2281] Validation against database-first generated xml requires that the column order within a composite primary key match the order the columns are in in mapping xml Created: 06/Feb/13 Updated: 09/May/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Aaron Moore | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In using a database-first approach utilizing orm:convert-mapping to generate xml, the validation and schema-tool reports that my composite primary key (ex. Columns A, C, B) be dropped and added in the order in which the mapping appears in the xml (ex. Columns A, B, C). These columns are not auto-increment and are simply a mixture of int and varchar. |
| Comments |
| Comment by Benjamin Eberlei [ 09/May/13 ] |
|
Is the composite key a mix of association and field types? |
| Comment by Aaron Moore [ 09/May/13 ] |
|
I'm trying to remember the usage as it was a short term project but I believe it is. For example a user has a userid. The table in question might have a primary key consisting of the userid and an int representing a year.. |
[DDC-1169] Entities outside of drivers' namespaces only give 'is not a valid entity' Created: 25/May/11 Updated: 25/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Jiří Petruželka | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, |
[DDC-1614] On OneToOne mappings with Primary Key same as Foreign Key, using @Id in the foreign association does not carry over when running "generate-entities" with --generate-annotations=1 Created: 22/Jan/12 Updated: 23/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers, ORM, Tools |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Ryan Fink | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Fedora 15, php 5.3.8 |
||
| Description |
|
When having a OneToOne mapping that has a primary key that is the same as the foreign key, using the @Id attribute does not carry over when generating entities. Example code: class User
/**
class User_ExtraAttrs
When running "doctrine orm:generate-entities --regenerate-entities=1 --generate-annotations=1", the @Id in User_ExtraAttrs does not carry over. It must be manually inserted. |
[DDC-222] Create unit tests for CLI components Created: 22/Dec/09 Updated: 30/Oct/10 |
|
| Status: | Reopened |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0-ALPHA3 |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Task | Priority: | Critical |
| Reporter: | Roman S. Borschel | Assignee: | Guilherme Blanco |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Comments |
| Comment by Roman S. Borschel [ 19/May/10 ] |
|
Whats the status here? Do we have any? |
| Comment by Guilherme Blanco [ 19/May/10 ] |
|
Since we moved to Symfony Console I don't think this is needed anymore. I'm closing the ticket due to this. Reopen if you have any other comment. |
| Comment by Benjamin Eberlei [ 20/May/10 ] |
|
I think we do need some basic functional tests of our Commands, they have been subject to many bugs in the past becaues they are not tested. |
| Comment by Benjamin Eberlei [ 19/Jun/10 ] |
|
Fixed another fatal error in the command due to missing namespace dependency. We need tests for all the commands, there have been dozens of issues on these things so far. This commit shows a simple approach on how testing is easily possible for symfony commands: http://github.com/doctrine/doctrine2/commit/51e6681934a7cf4448b85c5670c04045f66c6056 |
| Comment by Roman S. Borschel [ 26/Aug/10 ] |
|
Can we expect some more tests for beta4 or is it unlikely that you find the time? Should we move this further back or does someone else want to step in? |
[DDC-2332] [UnitOfWork::doPersist()] The spl_objact_hash() generate not unique hash! Created: 05/Mar/13 Updated: 01/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Krisztián Ferenczi | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Symfony 2.1.8, php 5.4.7 and php 5.4.12, Windows 7 |
||
| Attachments: |
|
| Description |
|
I created fixtures and some data was inserted many times without calling the Task entity PrePersist event listener. I printed the used and generated hash and I saw a Proxies_CG_\Asitly\ProjectManagementBundle\Entity\User hash equal a Task entity hash! |
| Comments |
| Comment by Marco Pivetta [ 05/Mar/13 ] |
|
Please provide either a code example or a test case. As it stands, this issue is incomplete |
| Comment by Benjamin Eberlei [ 05/Mar/13 ] |
|
Are you calling EntityManager#clear() inbetween? Because PHP reuses the hashes. The ORM accounts for this. |
| Comment by Benjamin Eberlei [ 05/Mar/13 ] |
|
This is not a reproduce case, i don't want to execute your whole project. I want to know, what is the actual bug that you see? Can you just print a list of all the hashes? Because the hashes dont differ at the end, bu tjust somewhere in the middle. |
| Comment by Krisztián Ferenczi [ 05/Mar/13 ] |
|
I attached a hashlogs.txt file. The last Task class hash is 0000000050ab4aba0000000058e1cb12 ( line 3 129 ) This is not unique, view the line 2 760 . The Task is not being saved and the program don't call the prePersist listener. The "UnitOfWork" believe the entity has been saved because the isset($this->entityStates[$oid]) is true. But it is an other entity. |
| Comment by Krisztián Ferenczi [ 06/Mar/13 ] |
|
The EntityManager::clear() fix the problem, but this is not "good" and "beautiful" solution. Shows no sign of that conflicts were and this is causing the problem. I was looking for the problem 7 hours. |
[DDC-2237] oracle IN statement with more than 1000 values Created: 11/Jan/13 Updated: 02/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Marc Drolet | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If I have a query with a IN statement with more tahn 1000 values I get an sql error. I've try IN with implode: |
| Comments |
| Comment by Marc Drolet [ 11/Jan/13 ] |
|
Here is the way I've implement the solution on my side: (for oracle) into Doctrine/DBAL/Statement.php, I've add this method:
/**
* Binds a parameter value to the statement.
* This is implemented this way for oracle only. Other drivers are redirected to bindValue method.
*
* The value will be bound with to the type provided (that required to be a table type).
*
* @param String $name The name or position of the parameter.
* @param Array $value The value of the parameter.
* @param String $type The name of the type to use to bind.
* @return boolean TRUE on success, FALSE on failure.
*/
public function bindList($name, Array $value, $type)
{
if ('oracle' !== $this->platform->getName())
{
$this->bindValue($name, $value, $type);
}
else
{
return $this->stmt->bindList($name, $value, $type);
}
}
into Doctrine/DBAL/Driver/Statement.php I've add:
/**
* @TODO: docs
*/
function bindList($param, Array $values, $type);
into Doctrine/DBAL/Driver/OCI8/OCI8Statement.php I've add this method:
/**
* {@inheritdoc}
*/
public function bindList($param, Array $value, $type)
{
if (!($list = oci_new_collection($this->_dbh, $type)))
{
//throw new OCI8Exception::fromErrorInfo($this->errorInfo());
}
foreach ($value as $entry)
{
$list->append($entry);
}
if (!oci_bind_by_name($this->_sth, $param, $list, -1, OCI_B_NTY))
{
//throw new OCI8Exception::fromErrorInfo($this->errorInfo());
}
}
// NOTE: we should probably add the bindList to all driver Statement object. into your code you can use it this way:
$sql = "
SELECT *
FROM test
WHERE id IN
(
SELECT *
FROM
(
CAST (: p_ids AS list_int_type)
)
)
";
$stmt = connection->prepare($sql);
$stmt->bindList(': p_ids', $ids, 'list_int_type');
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
NOTE: create or replace type list_str_type as table of varchar2(4000); |
| Comment by Benjamin Eberlei [ 01/Apr/13 ] |
|
Hey Marc Drolet thanks for the feedback and the solution, however i would like to have something generic that is working independent of the database driver. This code is very specific. Can you point me to some documentation why oci collection works with more than 1000 elements and how it works in PHP? |
| Comment by Marc Drolet [ 02/Apr/13 ] |
|
Hi Benjamin, The limitation is not from the oci driver, it's an oracle limitation. There are a couple of possible solution/implementation that can be done but the one I've provide is the one that perform better for the test I've done and from what I can found over the blogs I've read. I can't find the exact documentation of oracle. oracle doc is so poor. I don't know if there is similar limitation with other database. With the implementation I've provided, It will be possible to implement the proper solution depending on the database limitation you face otherwise it will execute the generic IN. What's bad, we need to create the type into the database. NOTE: In my case, I can not perform a sub-query, I get the my collection from a web service call. |
[DDC-851] Automerge of detached entities passed to doctrine Created: 31/Oct/10 Updated: 30/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0-BETA4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Daniel Alvarez Arribas | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is a feature request. Currently it is not possible to assign a detached entity to a relationship. You have to manually "merge" it, and only then you are able to assign it to relationships of managed objects. This can become complicated to do. The way it is now, when assigning an entity to a relationship in a process using a large number of entities, the entity's state needs to be checked and the entity possibly merged - all in userland code. This adds a level of complexity and potential for errors, while it could be solved transparently and elegantly within the ORM. There are ways to implement it in userland code, too, with moderate effort (see below), but this does not change the fact that responsibility for implementing a purely technical feature is delegated to the user, who could be spending his time much better writing business code. And if the user actually implements it, it will clutter the application with non-problem-domain code. To keep things simple, I propose Doctrine be extended to simply auto-merge any detached entities passed to it. That would save the programmer the manual tracking of object states and merge() calls. This would be especially handy when using cascades, as keeping track of deep object graphs in userland code would duplicate substantial ORM functionality. In programs that work with massive amounts of data, it is practically impossible to keep all entities managed due to resource constraints (see e.g. the batch processing patterns documented in the Doctrine 2 reference at http://www.doctrine-project.org/projects/orm/2.0/docs/reference/batch-processing/en). In a situation like that, one would probably simply flush and clear the entity manager regularly. Doctrine 2 currently forces the user to manually "merge" all persistent objects he/she still holds references to and wants to assign e.g. to other newly created persistable objects. I can not think of any reason why Doctrine 2 should not be able to do it automatically. Below is another comment originally attached to the GitHub proposal, containing a userland implementation of the feature as a temporary fix, for whoever cares. Here is a userland implementation for the functionality I am proposing, though I feel it is technical clutter that belongs into the ORM. Changing doctrine to be able to auto-merge unmanaged entities would be ideal. I thought I'd share this, for use as long as Doctrine 2 does not provide equivalent functionality. The implementation assumes all entities inherit from a base class (named "YourEntityBaseClass here") and intercepts the assignment to ToOne-relationships in a __set() method provided in that base class. For ToMany-relationships we extend ArrayCollection to intercept calls to add() and set() to accomplish the same. As an alternative to defining a __set() method in a base class you could also implement the interception by changing any mutator methods you define in your entities. But that would bloat your code quickly as you define more and more relationship attributes on your entities. The following __set() method implementation relies on reflection to parse the DocBlock-Comment with the Annotation and determine whether or not the property to be set is a ToOne-relationship. public function __set($name, &$value) { $reflectionClass = new ReflectionClass($this); $property = $reflectionClass->getProperty($name); if ( self::isToOneRelationship($property) && $value !== null) { $value = self::mergeIfDetached($value); } $this->$name = $value; } The following is an implementation of mergeIfDetached(), that assumes there is a __get defined on the entity, to be able to access the protected mapped properties. public static function mergeIfDetached(YourEntityBaseClass $dataObject) { $doctrineEntityManager = DB::getDoctrineEntityManager(); if ($doctrineEntityManager->getUnitOfWork()->getEntityState($dataObject) == \Doctrine\ORM\UnitOfWork::STATE_DETACHED) { $dataObject = $doctrineEntityManager->merge($dataObject); } return $dataObject; } For your purposes, consider DB to be just a class holding a reference to the Doctrine entity manager. Here are the helper methods for the reflection: private static function isToOneRelationship(ReflectionProperty $property) { return self::matchDoctrineAnnotation($property, self::$doctrineToOneRelationshipAnnotation); } private static function matchDoctrineAnnotation(ReflectionProperty $property, $pattern) { return preg_match('/\@' . $pattern . '/', $property->getDocComment()) != 0; } Here is the drop-in-replacement class for use with ToMany-Relationships. It uses the static reloadIfDetached method defined in the entity base class: use Doctrine\Common\Collections\ArrayCollection; class Collection extends ArrayCollection { public function set($key, $value) { $value = YourEntityBaseClass::mergeIfDetached($value); parent::set($key, $value); } public function add($value) { $value = YourEntityBaseClass::mergeIfDetached($value); return parent::add($value); } } This approach keeps the amount of unnecessary code to a minimum, so that merges are not scattered throughout the problem-domain code. |
| Comments |
| Comment by Daniel Alvarez Arribas [ 29/Dec/10 ] |
|
I have to note that the code I listed above turned out to be broken. There is nothing that guarantees that a data object just merged will not become detached again after being merged on assignment, unless the object is immediately persisted afterwards. The correct solution would be to merge all data objects found through relationships for a given data object, right from the persistence manager, immediately before calling persist() on the data object. I am currently using this solution (save() saves a data object safely for use within long-running batch jobs): public static function save(DataObject $dataObject) { self::mergeRelatedDataObjectsIfDetached($dataObject); self::$doctrineEntityManager->persist($dataObject); } public static function merge(DataObject $dataObject) { return self::$doctrineEntityManager->merge($dataObject); } protected static function mergeRelatedDataObjectsIfDetached(DataObject $dataObject) { $reflectionClass = new ReflectionClass($dataObject); $properties = $reflectionClass->getProperties(); foreach ($properties as $property) { $propertyName = $property->getName(); $propertyValue = $dataObject->__get($propertyName); if (MetadataReader::isToOneRelationship($property)) { if ( $propertyValue !== null && ! $propertyValue instanceof Proxy && self::isDetached($propertyValue)) { $relatedDataObject = self::merge($propertyValue); $dataObject->__set($propertyName, $relatedDataObject); } } else { if (MetadataReader::isToManyRelationship($property)) { $relatedDataObjects = $propertyValue->toArray(); foreach ($relatedDataObjects as $index => $relatedDataObject) { if ( ! $relatedDataObject instanceof Proxy && self::isDetached($relatedDataObject)) { $relatedDataObject = self::merge($relatedDataObject); // Replace the entry in the collection with the merged copy. $propertyValue->set($index, $relatedDataObject); } } } } } } protected static function isDetached(DataObject $dataObject) { return self::$doctrineEntityManager->getUnitOfWork()->getEntityState($dataObject) == UnitOfWork::STATE_DETACHED; } I still wish there would be an automerge feature, kind of Hibernate's "update". |
| Comment by Daniel Alvarez Arribas [ 29/Dec/10 ] |
|
Wrapped the code sections into proper code blocks... |
[DDC-821] Consider adding Query-Join as another join method for DQL Created: 29/Sep/10 Updated: 29/Dec/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Marc Hodgins | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Some ORM systems support an alternative to fetch-join queries, called a "query-join". See http://www.avaje.org/ebean/introquery_joinquery.html. A query-join accomplishes the same as a fetch-join (hydrating a larger object graph across all associations types) but executes more than one SQL query in sequence in order to hydrate the requested portions of the graph in a result set. The first query retrieves data from the base entity/table and the next queries retrieve the data for the requested associations. In some cases this approach is more efficient to a fetch-join: (1) No data duplication in the SQL result as occurs in a fetch-join on to-many associations. Instead, this data is loaded through a second query. This saves network traffic, memory and general overhead in hydrating the returned results. In the case where large TEXT data is included in result sets, the savings here may be substantial. (2) setFirstResult() and setMaxResult() are again effective (for pagination) and more importantly more efficient on these query-joins. The current DoctrineExtension solution to enable pagination on fetch-joins requires a series of queries to determine the target primary keys of the root entity of the query. The primary key lookup query requires DISTINCT or GROUP BY – which often triggers filesorts, temporary tables, etc (at least on MySQL) and greatly slows down the query. Query joins would not require this. Possible implementation example: // existing fetch-join $query = $em->createQuery('SELECT c, o FROM Customers c JOIN c.orders o'); $query->setFirstResult(10)->setMaxResult(20); // doesn't do what you'd hope it would do, no ability to use this for pagination $customersAndOrders = $query->getResult(); // array of Customer objects with Orders hydrated // proposed query-join $query = $em->createQuery('SELECT c, o FROM Customers c QUERY JOIN c.orders o'); $query->setFirstResult(10)->setMaxResult(20); // now works for pagination $customersAndOrders = $query->getResult(); // array of Customer objects with Orders hyrdated // this would execute a series of queries -- i.e. in SQL // SELECT ... FROM customers LIMIT 10, 20 // SELECT ... FROM orders WHERE customer_id IN (.....) and/or, could there be a way to trigger a "query-join" against an existing array of entities? for example $query = $em->createQuery('SELECT c FROM Customers c'); // single query to fetch customers
$customers = $query->getResult(); // array of Customer objects
$em->join($customers, 'orders'); // fetch and hydrate the 'orders' association on each Customer using a single query
Perhaps at some point in the future Doctrine/DBAL could even make use of asynchronous queries (i.e. mysqlnd supports this) to allow these query-joins to run in parallel and the result would be more efficient paginated resultsets. Thoughts/feedback? |
| Comments |
| Comment by Benjamin Eberlei [ 30/Sep/10 ] |
|
There is another approach for this using several subqueries to build an IN clause, the Paginator extension supports this: http://github.com/beberlei/DoctrineExtensions I rather go the extension approach than changing the DQL for this feature. |
| Comment by Benjamin Eberlei [ 30/Sep/10 ] |
|
I just saw your second example, that is rather cool though and gets +1 from me. I had the same idea for "not initialized proxies", i.e. $em->getUnitOfWork()->initializeProxies('Customer');
|
| Comment by Marc Hodgins [ 29/Dec/10 ] |
|
Second example is a duplicate of |
[DDC-785] Post-Post-Persist event Created: 02/Sep/10 Updated: 14/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0-BETA4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | arnaud-lb | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
postPersist/postUpdate events are triggered in the middle of a unitOfWork, and querying the DB in such events causes infinite loops. Doctrine attempts to flush the entity manager before running any query, which triggers flushing of entities, and postPersist/postUpdate events are triggered again. I did not checked, but the flush() before each query may be a performance problem too, if doctrine has to determine what has changed, depending on the changetracking policy. Also, it would be great if postPersist / postUpdate events were triggered after all entities have been persisted. It looks like that entities are flushed by groups of same 'type', and that events for a type are triggered once all of the elements of that group have been flushed, potentially before entities of an other type have been flushed : postPersist / postUpdate events are triggered while some other entities are still not flushed. |
| Comments |
| Comment by Benjamin Eberlei [ 03/Sep/10 ] |
|
That is documented and for perfomance reasons we cannot move the preUpdate/postUpdate/prePersist/postPersist events to other locations inside the UnitOfWork. There is an onFlush event that allows for more flexibility and is triggered before any update/insert/delete is done by the UnitOfWork. |
| Comment by arnaud-lb [ 04/Sep/10 ] |
|
Thanks. I understand that. Is there any chance of getting some onPostFlush or similar, which would be triggered like onFlush, but after all update/insert/delete ? Or just some post-something event which is allowed to issue db queries. |
| Comment by Gediminas Morkevicius [ 24/Sep/10 ] |
|
onFlush you can store your entity for furher processing and on postPersist you can check if there are no more insertions and process the entity if it needs additional query |
| Comment by Gediminas Morkevicius [ 14/Jan/11 ] |
|
I think this issue should be closed since the main reason of opening it was the possibility to execute additional queries when inserts were pending in unit of work. In current release it does not cause a flush during an additional query execution anymore. |
[DDC-779] Doctrine\ORM\Configuration should be immutable after construction of EntityManager Created: 30/Aug/10 Updated: 30/Aug/10 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0-BETA3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Currently the Doctrine\ORM\Configuration instance is not immutable after construction of the EM, which can lead to funny behavior when changing essential dependencies such as caches or others. |
[DDC-1262] Have proxies copy docblocks aswell Created: 09/Jul/11 Updated: 09/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0.6, 2.1, Git Master |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Whenever a Proxy is generated it does not copy the docblocks. This means when you do something like "$refl = new ReflectionObject($proxy)" you might be in trouble. However if we add docblocks then we have to make sure that proxies do not magically appear as entities by throwing an exception in the AnnotationDriver. |
[DDC-1219] Remove dependancy on Collection interface in Domain Objects Created: 21/Jun/11 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1 |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | André R. | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Short: This issue is all about being able to use doctrine with naked domain objects without any use of doctrine classes. Seems like some of the UnitOfWork code is cable of handling other types of arrays, like: // If $actualData[$name] is not a Collection then use an ArrayCollection.
if ( ! $actualData[$name] instanceof Collection) {
$actualData[$name] = new ArrayCollection($actualData[$name]);
}
But in __cascade* functions this is not the case in all but two: if ($relatedEntities instanceof Collection) {
if ($relatedEntities instanceof PersistentCollection) {
// Unwrap so that foreach() does not initialize
2 however have: if (($relatedEntities instanceof Collection || is_array($relatedEntities))) {
if ($relatedEntities instanceof PersistentCollection) {
// Unwrap so that foreach() does not initialize
Would it be an idea to do "instanceof Traversable" instead of " instanceof Collection"? |
| Comments |
| Comment by André R. [ 21/Jun/11 ] |
|
Note: If the fist code block is always performed before the last 2 blocks then there is no issue here, just a need to make it more clear in Doc that this is possible but that you should not rely custom implementation as PersistentCollection will be injected when loaded from db. |
[DDC-1200] Derived Id Generator Created: 09/Jun/11 Updated: 09/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
For usage with the foreign key as primary key features described in |
| Comments |
| Comment by Daniel Lima [ 09/Nov/11 ] |
|
When this will be fixed? I think this is related to http://groups.google.com/group/doctrine-user/browse_thread/thread/7e1cfa9c4c99af31 |
[DDC-1197] Proxies should handle variable argument lists Created: 05/Jun/11 Updated: 05/Jun/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is a contingency issue for https://github.com/doctrine/doctrine2/pull/60 "Fix to allow for proxy generated classes to respect methods in parent which may use func_get_args internally. Previously they would be passed nothing and thus fail. Also reduces need to build up argumentString. " |
[DDC-1144] How insert a AES_ENCRYPT value in a table field Created: 10/May/11 Updated: 10/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0.4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | dquintard | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Win XP, MySql5, Php5.3, ZendFramework 1.11.4 |
||
| Description |
|
Hi there, Because '"INSERT statements are not allowed in DQL, ...." i processed like this:
How can i do ? /** Best regards David |
[DDC-1137] SchemaTool#getUpdateSchemaSql() does not respect database identifier in table names Created: 05/May/11 Updated: 14/May/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM, Tools |
| Affects Version/s: | 2.0.4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Hugh Lomas | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 2.6.18-194.32.1.el5.centos.plus x86_64 GNU/Linux |
||
| Description |
|
Given two databases, 'foo' and 'bar', with entities in /Entities/Foo/ annotated as follows: /** * Test * * @Table(name="foo.test") * @Entity */ Create an EntityManager instance with $connectionOptions = array(
'dbname' => 'Foo',
'driver' => 'pdo_mysql',
<..etc..>
);
Use EntityManager#getClassMetaData( "Entities\\Foo Use EntityManager#getClassMetaData( "Entities\\Foo Inserting die( print_r( $fromSchema, 1 ) . print_r( $toSchema, 1 ) . print_r( $schemaDiff, 1 ) ); into Doctrine/ORM/Tools/SchemaTool.php line 632 shows $fromSchema outputs [_tables:protected] => Array
(
[test]
but $toSchema outputs [_tables:protected] => Array
(
[foo.test]
which causes $schemaDiff to output [newTables] => Array
(
[foo.test]
In summary, Doctrine/DBAL/Schema/Comparator considers foo.test a new table, because Doctrine/DBAL/Schema/AbstractSchemaManager lists its table as "test" rather than "foo.test". |
| Comments |
| Comment by Hugh Lomas [ 05/May/11 ] |
|
It seems that changing AbstractSchemaManager.php to the following corrected the issue for me, however I am not sure of any repercussions that may arise as a result, being unfamiliar with the codebase. Doctrine/DBAL/Schema/AbstractSchemaManager.php line 228 return new Table( $tableName, $columns, $indexes, $foreignKeys, false, array()); Doctrine/DBAL/Schema/AbstractSchemaManager.php line 228 return new Table( $this->_conn->getDatabase() . "." . $tableName, $columns, $indexes, $foreignKeys, false, array()); |
| Comment by Benjamin Eberlei [ 14/May/11 ] |
|
Multi databases are not supported by schema manager and schema tool yet. |
[DDC-1106] Wrong inversedBy in example Created: 07/Apr/11 Updated: 07/Apr/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | cristobal castro | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
on page http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html |
MsSQL-Server DateTime microseconds issue
(DDC-1028)
|
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Sub-task | Priority: | Major |
| Reporter: | Martin Weise | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
php5.3.5; MsSQL-Server 2005; W2K8; Apache2; MS pdo_sqlsrv_ts_vc6 driver |
||
| Description |
|
To ensure that the MsSQL-Server 2005 (and maybe higher) uses the format that is specified in the MsSqlPlatform class (Y-m-d) This should be done directly after the connection has be opened. |
| Comments |
| Comment by Martin Weise [ 14/Feb/11 ] |
|
Issue created as wished from Juozas Kaziukenas. |
[DDC-1016] Example code does not reflect real code Created: 03/Feb/11 Updated: 03/Feb/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Documentation | Priority: | Major |
| Reporter: | thoth | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Website |
||
| Description |
|
http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#entity-state In the switch cases all the UnitOfWork constants are invalid. Example: |
[DDC-999] DQL always needs a FROM clause, should be changed Created: 23/Jan/11 Updated: 23/Jan/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Timo A. Hummel | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Sometimes a developer needs to issue a query without a FROM clause. This especially occurs using the QueryBuilder, when you may or may not have a table to select from, but call a stored procedure always. Example: $query = $em>createQuery('SELECT (1+1)');
The above query fails because the lexer expects T_FROM. If you replace (1+1) with a stored procedure, this example makes more sense. One might argue about that you should use DBAL directly, but I disagree, because it always can happen that you end up in a situation like this: $qb = $em->createQueryBuilder(); $qb->select("SOMEFANCYPROCEDURE()"); if ($condition) { $qb = $qb->from("additionalTable t"); } |
[DDC-952] Several features to batch eager selects more efficently Created: 27/Dec/10 Updated: 04/Jul/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Sub-Tasks: |
|
| Description |
|
This ticket aggregates several strategies to optimize batching of eager selects. |
| Comments |
| Comment by Benjamin Eberlei [ 31/Dec/10 ] |
|
Requirements for batching of eager loads: 1. Since we are using an IN() query for this we can only support this feature for entities that have a single column primary key. |
| Comment by Benjamin Eberlei [ 31/Dec/10 ] |
|
Next item to think about: What if an exception or event breaks the flow and "triggerEagerLoads()" is never called? |
[DDC-1450] UnitOfWork Transaction Rollback Support Created: 24/Oct/11 Updated: 20/Dec/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The UnitOfWork does not handle the case very well where a rollback is necessary. Can this be optimized? |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
[DDC-1443] Subscribers reachs maximum nesting level when creating association on pre/postPersist with cascade persist Created: 20/Oct/11 Updated: 29/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Guilherme Blanco | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Suppose a situation where: A -> B Where the OneToOne unidirectional association contains cascade persist. If I decide to save an entity B that should create an A instance, it goes into maximum nesting level no matter if I track prePersist or postPersist. |
| Comments |
| Comment by Guilherme Blanco [ 20/Oct/11 ] |
|
Failing test case |
| Comment by Guilherme Blanco [ 20/Oct/11 ] |
|
Uploading a new version, now passing successfully, but consuming the onFlush event (which should not be ideal). |
| Comment by Benjamin Eberlei [ 29/Oct/11 ] |
|
Ah yes, this never worked. The transaction stuff will fix that. You have to use scheduleForInsert() something inside prePersist. |
[DDC-1441] Metadata cannot be loaded for not registered proxy objects Created: 20/Oct/11 Updated: 05/Apr/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Aigars Gedroics | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MySQL, Ubuntu, PHP 5.3.6 |
||
| Attachments: |
|
| Description |
|
We are using several Doctrine managers in our project with the same entity classes and different database tables. The problem appears when we are willing to merge entity with lazy associations from one manager to another. The second entity manager instance hasn't got the proxy object metadata defined yet so it fails with Doctrine\ORM\Mapping\MappingException exception "Class EntityProxy is not a valid entity or mapped super class.". If both entity managers share the proxy objects the problem can be fixed by calling $em->getProxyFactory()->getProxy('Entity', -1);
which will register the entity metadata for the proxy classname as well. Still if the proxy configuration differs, there is no fix found without changing the Doctrine ORM code. The fix inside the Doctrine would be to detect Proxy classes before loading the metadata and load the metadata for it's parent class instead. Please see the diff attached with proposed solution. Also I think this issue could arise when unserialized entity objects will be merged into the entity manager. I will try creating test case for this. |
| Comments |
| Comment by Aigars Gedroics [ 24/Nov/11 ] |
|
Test case attached. |
| Comment by Aigars Gedroics [ 05/Apr/12 ] |
|
See my pull request in https://github.com/doctrine/doctrine2/pull/332. |
[DDC-1429] Add a method to the unit of work that merges any detached entity into UoW without calling SQL Created: 17/Oct/11 Updated: 17/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
This is for those that know what they are doing |
[DDC-1398] loading one item at a time when indexBy and EXTRA_LAZY fetch mode is used on a collection Created: 29/Sep/11 Updated: 10/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Reio Piller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Description |
|
collection->get($key) Atm in 2.1.2 this is loading the entire collection. It would be really handy that it would extra lazy load only one item using the association and indexBy fields and given key value (if collection is not initialized and the key havent been loaded yet ofc) Am i making sense with this? |
| Comments |
| Comment by Guilherme Blanco [ 20/Dec/11 ] |
|
Updating fix version |
| Comment by German Caseres [ 05/Mar/12 ] |
|
Is there any fix for this? i have the same problem. |
| Comment by Oleg Namaka [ 10/Mar/12 ] |
|
It makes a perfect sense here, I wish it was possible, it would give us a room for even more optimization. Any input on the issue from the developers? |
[DDC-1390] Lazy loading does not work for the relationships of an entity instance, whose class inherits from another entity class Created: 22/Sep/11 Updated: 06/Jan/13 |
|
| Status: | In Progress |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Alvarez Arribas | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian Linux 6.0, MySQL 5.0.51a |
||
| Attachments: |
|
| Description |
|
Lazy loading does not work for the relationships of an instance of an entity, whose class inherits from another entity class. Assume there are two entity classes, A and B, where A inherits from B. Now let $a be an instance of A, e. g. the result of "SELECT a FROM \A WHERE a.id = 1". Outputting $a will confirm it is a valid instance of a proxy object inheriting from A. Assume that the database row corresponding to $a contains a non-null foreign key that actually links to an existing row in another table, corresponding to another entity instance of a different class. Now, $a->someRelationship will always returns null in this scenario. I assume this is unintended behaviour, because clearly, the other entity should be lazily loaded on accessing it, and there is a value in the database. The fetch annotation attribute on that relationship has not been explicitly set, so I assume it is set to the default value, which, according to the docs, should be "lazy". The loading only fails when accessing the relationships of an entity instance, whose class inherits from another entity class. For entity instances, whose classes do not inherit from another entity class, lazy loading of their relationships works as expected. I had a look at the proxy objects and verified that they are present and override the __get method with an implementation containing a call to the load() method. Still, the loading won't work for some reason. This could be related to Bug |
| Comments |
| Comment by Benjamin Eberlei [ 31/Oct/11 ] |
|
Did this get fixed with the correction of your data? |
| Comment by Daniel Alvarez Arribas [ 01/Nov/11 ] |
|
No it did not. This issue is completely unrelated to the other one. For this, I have manually implemented workarounds, fetching the associations using DQL queries. Lazy loading in the inheritance scenario above still would not work. |
| Comment by Benjamin Eberlei [ 01/Nov/11 ] |
|
So A is an entity in a hierachy A -> B, and "someRelationship" is a field on A or on B Could you post parts of the mappings (entity docblock and the relationship)? |
| Comment by Daniel Alvarez Arribas [ 06/Nov/11 ] |
|
Hey, thanks for taking care of this. I attached the entities involved in the szenario to this issue. I had problems lazy loading entities through the following associations: Run.invoiceCreatorResult as well as InvoiceCreatorResult.dataVersion In this scenario, InvoiceCreatorResult, CommissionNoteCreatorResult and ConsumerInvoiceExporterResult all inherit from Result, which in turn inherits from a mapped superclass DataObject. Run and DataVersion inherit from DataObject directly. The associations where lazy loading does not work are associations both to and from the entity classes InvoiceCreatorResult, CommissionNoteCreatorResult and ConsumerInvoiceExporterResult. |
| Comment by Benjamin Eberlei [ 18/Nov/11 ] |
Just a short Q on understanding: Why is $a a proxy of A if you select it explicitly? |
| Comment by Benjamin Eberlei [ 18/Nov/11 ] |
|
This a working test-case with a model that i believe resembles yours exactly. I also put your models into another test and ran schema validation on them, which works out without problems. From the workflow with proxies, maybe |
| Comment by Daniel Alvarez Arribas [ 18/Nov/11 ] |
|
Regarding the proxy question, I just ment the query to be an example to further illustrate the type of $a. It was redundant and unnecessary though and probably misleading. Sorry for that. I did not select anything in the actual scenario. $a is merely some object of type A. No queries are involved. |
| Comment by Daniel Alvarez Arribas [ 18/Nov/11 ] |
|
Have you been able to make the tests fail with the original data provided? If not, I could set up a test case and post it. |
| Comment by Benjamin Eberlei [ 18/Nov/11 ] |
|
No i only checked the validity of mappings with the original data. If you could setup a testcase that would be really great. |
| Comment by Daniel Alvarez Arribas [ 19/Nov/11 ] |
|
I will set up a test case and upload it. I'll see if I can do it one of the next evenings. |
| Comment by Benjamin Eberlei [ 17/Dec/11 ] |
|
I tried again, also extended DDC-1390, but it was impossible for me to reproduce this. I ran this against master, 2.1.x and 2.1.1 specifically. |
| Comment by Daniel Alvarez Arribas [ 05/Jan/13 ] |
|
Sorry, I got swamped with work. Now I am working on this dedicatedly, testing against the latest release. Will let you know once I have a testcase. |
| Comment by Benjamin Eberlei [ 06/Jan/13 ] |
|
Good to hear, thanks for the persistent work on this. |
[DDC-1380] Standardize proxy class naming Created: 18/Sep/11 Updated: 18/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.x |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Johannes Schmitt | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
see https://github.com/doctrine/doctrine2/pull/125 |
[DDC-1357] Queries with multiple joins resulting in multiple scalar results for each top level entity only retain one scalar value for each entity Created: 01/Sep/11 Updated: 01/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Nils Adermann | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider this example: select g.id, u.id, u.status, count(p.phonenumber) numPhones from Group
* g join g.user u join u.phonenumbers p group by g.id, u.status, u.id
With data: phonenumbers:
[1, 2, 3, 4, 5, 6]
users:
[{id: 1, status: developer, phonenumbers: [1, 2]},
{id: 2, status: developer, phonenumbers: [3]},
{id: 3, status: developer, phonenumbers: [4, 5, 6]}]
groups:
[{id: 1, users: [1, 2]]},
{id:2, users: [3]}]
The result currently is: array(
array(
0 => object(CmsGroup) {
'id' => 1,
'users' => Collection(
object(CmsUser) { 'id' => 1 },
object(CmsUser) { 'id' => 2 }
)
},
'numPhones' => 1
),
array(
0 => object(CmsGroup) {
'id' => 2,
'users' => Collection(
object(CmsUser) { 'id' => 3 }
)
},
'numPhones' => 3
)
)
Note that the first entry contains only one value numPhones => 1, even though there are two users associated with that group. One of whom has 2 phone numbers and the other has 1. The result I would expect is: array(
array(
0 => object(CmsGroup) {
'id' => 1,
'users' => Collection(
object(CmsUser) { 'id' => 1 },
object(CmsUser) { 'id' => 2 }
)
},
'numPhones' => array(2, 1)
),
array(
0 => object(CmsGroup) {
'id' => 2,
'users' => Collection(
object(CmsUser) { 'id' => 3 }
)
},
'numPhones' => array(3)
)
)
The difference is that numPhones for each row now contains an array of the |
| Comments |
| Comment by Nils Adermann [ 01/Sep/11 ] |
|
You can find a test case for the correct result here: https://github.com/naderman/doctrine2/commit/a1ca3d9847cbc514fc951fb0b221b26fe03a6619 |
[DDC-1320] Ship Immutable date time with Doctrine Common, use in ORM - Should implement __toString() Created: 06/Aug/11 Updated: 31/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | 2.x |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Comments |
| Comment by Benjamin Eberlei [ 31/Oct/11 ] |
|
Has to be pushed back as immutable date time cannot be implemented in userland that well. |
[DDC-2104] BasicEntityPersister::load() doesn't allow for cache usage Created: 25/Oct/12 Updated: 12/Nov/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | Dan McFaul | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
This is a new feature, not a bug |
||
| Description |
|
BasicEntityPersister::load() calls: The executeQuery function has an optional fourth parameter to pass a QueryCacheProfile variable to use caching on the query. This is ignored/not implemented by BasicEntityPersister::load() |
[DDC-2100] Getting Started: Code First PHP fatal error:Call to undefined method Bug::setDescription() Created: 24/Oct/12 Updated: 24/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Type: | Documentation | Priority: | Major |
| Reporter: | bronze1man | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu 1204 php5.3.8 |
||
| Description |
|
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html ps: |
[DDC-2093] Doctrine Criteria does not support sorting by relationed field Created: 20/Oct/12 Updated: 06/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bogdan Yurov | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
// Here I call Criteria filter
public function getWalletsActive() {
$criteria = Criteria::create()
->where(Criteria::expr()->eq("isRemoved", "0"))
->orderBy(array("currency.id" => "ASC"));
return $this->wallets->matching($criteria);
}
// Relation
/**
* @var Currency
*
* @ORM\ManyToOne(targetEntity="Currency")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="id_currency", referencedColumnName="id")
* })
*/
protected $currency;
// File BasicEntityPersister.php
// This cause the problem:
if ( ! isset($this->_class->fieldMappings[$fieldName])) {
throw ORMException::unrecognizedField($fieldName);
}
// There are no relations in $this->_class->fieldMappings at all!
|
| Comments |
| Comment by Benjamin Eberlei [ 06/Jan/13 ] |
|
Mark as improvement. |
[DDC-2089] Modify OneToMany to allow unidirectional associations without the need of a JoinTable Created: 19/Oct/12 Updated: 16/Dec/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.x |
| Fix Version/s: | 2.4, 3.0 |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Enea Bette | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | onetomany, persister, unidirectional | ||
| Environment: |
Debian Wheezy, Mysql 5.1, Apache2, PHP 5.4 |
||
| Description |
|
As I sayd in the title, it would be nice if the ORM layer could permit to map a 1:n association in the db as an unidirectional OneToMany in the classes, without using a JoinTable in the database. Is it possible? |
| Comments |
| Comment by Enea Bette [ 16/Dec/12 ] |
|
A little up... for inspiration from JPA |
[DDC-2042] Metadata association overriding : allow to override 'targetEntity' Created: 26/Sep/12 Updated: 26/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Charles Rouillon | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While associating object to an descriminated table I wasn't enable to fix the entityTarget (only one can be set in entity annotation). It could be resolve by adding the possibility to override 'targetEntity' value in Doctrine\ORM\Mapping\ClassMetadataInfo::ClassMetadataInfo(). Such as :
That would need to add a control on the new targetEntity in Doctrine\ORM\Mapping\ClassMetadataInfo::_validateAndCompleteAssociationMapping(). Such as :
cro. |
[DDC-2043] Extra cache operation in DBAL\Cache\ResultCacheStatement.php Created: 26/Sep/12 Updated: 26/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bogdan Albei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS, PHP 5.3.10 |
||
| Description |
|
This is the closeCursor() method in DBAL\Cache\ResultCacheStatement.php: public function closeCursor() { $this->statement->closeCursor(); if ($this->emptied && $this->data !== null) { $data = $this->resultCache->fetch($this->cacheKey); if ( ! $data) { $data = array(); } $data[$this->realKey] = $this->data; $this->resultCache->save($this->cacheKey, $data, $this->lifetime); unset($this->data); } } We are using Memcache and I noticed an extra GET operation on all cache misses. In the code above I believe the fetch call is not necessary and that the code would do the same without it. |
| Comments |
| Comment by Christophe Coevoet [ 26/Sep/12 ] |
|
The SQL is used as a key because it is what identifies the query which is done (well, the statement and the parameters) |
| Comment by Bogdan Albei [ 26/Sep/12 ] |
|
The cacheKey already identifies the query(or at least it should). Would we have cases where different queries would want to use the same cache key? |
[DDC-1991] Add parameter indexBy to EntityRepository->createQueryBuilder() Created: 20/Aug/12 Updated: 20/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Philipp Cordes | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
createQueryBuilder() currently doesn’t have a parameter to set the third option on the FROM fragment: indexBy. Right now you have to read it, create a new From with the read properties and your desired indexBy value and replace the existing one on the QueryBuilder. Should be ten minutes’ work including tests. Thanks a lot! |
[DDC-1986] findBy hydration with limit and offset with Oracle database (oci8 driver) Created: 17/Aug/12 Updated: 08/Jan/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Benjamin Grandfond | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | oracle | ||
| Environment: |
composer.json require : "php": ">=5.3.3", |
||
| Description |
|
I tried to use the findBy method with limit and offset parameters against an Oracle database using oci8 driver. The query seems to executed successfully but the hydrator fails when hydrating data as there is a DOCTRINE_ROWNUM column appending the "limit" clause. Here is the exception thrown : "Notice: Undefined index: DOCTRINE_ROWNUM in [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php line 183" I was thinking about something like this to fix this issue
Maybe there is a better approach, what are your thoughts? |
| Comments |
| Comment by Benjamin Grandfond [ 17/Aug/12 ] |
|
I implemented it in my forks : https://github.com/benja-M-1/doctrine2/commit/c8d899b14446accf869ddc0043f4235284375755 It works for me, but I didn't write unit tests. |
| Comment by Benjamin Grandfond [ 24/Aug/12 ] |
|
Hi, Did you have time to have a look at this issue? Thanks |
| Comment by Christophe Coevoet [ 24/Aug/12 ] |
|
Please send a pull request when you submit a fix. It is the proper way to submit them for review. When we want to see things waiting for review, we look at the list of pending PRs, not at all comments of the issue tracker to find links in them. And I can tell you that this change has a big issue: it introduces a state in the database platform whereas it is currently stateless. This is likely to cause some issues when using more than 1 query (which is a common use case). |
| Comment by Benjamin Grandfond [ 29/Aug/12 ] |
|
Hi Christophe thank you for your feedback. I didn't send a PR because I wanted someone sharing his thoughts about what I suggested in this current issue. However I don't really understand the stateless argument, can you explain a bit more? Otherwise how would do you proceed to tell Doctrine not to hydrate platform-specific columns? |
| Comment by Christophe Coevoet [ 29/Aug/12 ] |
|
If you run several queries, they will be affected by the extra columns of previous requests, which is wrong |
| Comment by Benjamin Eberlei [ 29/Aug/12 ] |
|
I think the ObjectHydrator catches this by skipping undefined columns, i think we might just have overoptimized the SimpleObjectHydrator a little bit. |
[DDC-1965] Multiple Index fails if index name not specified Created: 02/Aug/12 Updated: 02/Aug/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Pont | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Cli | ||
| Environment: |
Ubuntu 11.04, PHP 5.3.6 with Suhosin-patch, Symfony 2.0.15 |
||
| Description |
|
@ORM\Table(name="applications", indexes={@ORM\Index(name="csl_idx", columns= {"createdAt", "status", "loanType"}), @ORM\Index(name="s_idx", columns={"status"}), @ORM\Index(name="l_idx", columns={"loanType"})})the above Annotation creates 3 different indexes BUT when: * @ORM\Table(name="applications", indexes={@ORM\Index(columns={"createdAt", "status", "loanType"} ), @ORM\Index(columns= {"status"}), @ORM\Index(columns= {"loanType"})}) index-names not specified Symfony2 schemaUpdate tools shows only the last Index |
[DDC-1963] Remove by-ref access to changeset in lifecycle event args Created: 31/Jul/12 Updated: 31/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | None |
| Fix Version/s: | Git Master |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Marco Pivetta | Assignee: | Marco Pivetta |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
UoW currently passes computed changesets to lifecycle event args byref. This has to be changed to force users to use UoW public API to modify changesets instead. |
[DDC-1960] mapping joins in native queries breaks if select columns are starting with columns from joined table Created: 31/Jul/12 Updated: 21/Nov/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1.4, 2.1.7 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Thomas Subera | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu kernel 2.6.32-40-server |
||
| Attachments: |
|
| Description |
|
Using a simple Testcase like in http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/native-sql.html there are two Tables: *) users: Column | Type | Modifiers | Storage | Description ------------+---------+-----------+----------+------------- u_id | integer | not null | plain | u_name | text | not null | extended | address_id | integer | not null | plain | *) address: Column | Type | Modifiers | Storage | Description ----------+---------+-----------+----------+------------- a_id | integer | not null | plain | a_street | text | not null | extended | a_city | text | not null | extended | address_id is a foreign key to address; Now i created the Entities and setup a native query using ResultSetMappingBuilder: $rsm = new \Doctrine\ORM\Query\ResultSetMappingBuilder($entityManager); $rsm->addRootEntityFromClassMetadata('MyProject\Entity\Users', 'u'); $rsm->addJoinedEntityFromClassMetadata('MyProject\Entity\Address', 'a', 'u', 'address'); $query = ' SELECT u.*, a.* FROM users u LEFT JOIN address a ON (u.address_id = a.a_id) '; /** @var $native \Doctrine\ORM\NativeQuery */ $native = $entityManager->createNativeQuery($query, $rsm); $ret = $native->getResult(); This returns the Entities correctly:
array(2) {
[0] =>
class MyProject\Entity\Users#61 (3) {
protected $id =>
int(1)
protected $name =>
string(5) "Smith"
protected $address =>
class MyProject\Entity\Address#63 (4) {
protected $id =>
int(1)
protected $street =>
string(8) "Broadway"
protected $city =>
string(8) "New York"
protected $users =>
class Doctrine\ORM\PersistentCollection#64 (9) {
...
}
}
}
[1] =>
class MyProject\Entity\Users#66 (3) {
protected $id =>
int(2)
protected $name =>
string(7) "Sherlok"
protected $address =>
class MyProject\Entity\Address#67 (4) {
protected $id =>
int(2)
protected $street =>
string(13) "Oxford Street"
protected $city =>
string(6) "London"
protected $users =>
class Doctrine\ORM\PersistentCollection#68 (9) {
...
}
}
}
}
BUT if you change the order of the select columns starting with ones from address you get borked Data:
$query = '
SELECT
a.*,
u.*
FROM
users u
LEFT JOIN address a ON (u.address_id = a.a_id)
';
array(2) {
[0] =>
class MyProject\Entity\Users#61 (3) {
protected $id =>
int(1)
protected $name =>
string(5) "Smith"
protected $address =>
class MyProject\Entity\Address#63 (4) {
protected $id =>
int(2)
protected $street =>
string(13) "Oxford Street"
protected $city =>
string(6) "London"
protected $users =>
class Doctrine\ORM\PersistentCollection#64 (9) {
...
}
}
}
[1] =>
class MyProject\Entity\Users#66 (3) {
protected $id =>
int(2)
protected $name =>
string(7) "Sherlok"
protected $address =>
NULL
}
}
This happens because the function Doctrine\ORM\Internal\Hydration\AbstractHydrator::_gatherRowData does not consider the Mapping i set up. Instead it just add the columns as they get starting with address ones. Doctrine\ORM\Internal\Hydration\ObjectHydrator::_hydrateRow then knows the Mapping and ignores the first Address as there is no User to map on, cycling to the next row will then add the address of the second row to the user from the first one. There are multiple ways to fix this. One would be to consider the mapping in _gatherRowData, the second to rewrite the _hydrateRow generating the Entities first and then the mapping in a second foreach loop. This bugger had me for 2 days until i finally figured it out. thanks |
| Comments |
| Comment by Frederic [ 21/Nov/12 ] |
|
Hello, Has same issue with using DQL /createQuery() ! Try all the day to find where was my mistake but seems to be a CRITICAL bug ! Doctrine version used : 2.3.1-DEV <code> </code> Problem is that the order of the Aliases (cc, oc) is not considered on building SQL . $rowData = $this->gatherRowData($row, $cache, $id, $nonemptyComponents); returns Array [oc] => Array As "oc" is a mapping, on the first loop the $parentAlias is not yet known and so : else if (isset($this->_resultPointers[$parentAlias])) { echo $parentAlias." parentObject 2\n"; $parentObject = $this->_resultPointers[$parentAlias]; }else { // HERE : on first loop, for "oc", parent not yet known so skipped !!! continue; }</code> using a workaround on ObjectHydrator::hydrateRowData like this : make it work... Sorry for my dirty explanation... |
[DDC-1624] Locking CTI doesnt work on SQL Server Created: 29/Jan/12 Updated: 20/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.2 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The WITH Keyowrd is appended to the whole FROM .. JOIN .. block instead of behind the FROM block. |
[DDC-1599] OnFlush event in transaction Created: 14/Jan/12 Updated: 20/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Gediminas Morkevicius | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
Is there any particular reason why onFlush event is not triggered when the transaction is allready open? https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L290 It would help a lot developing listeners since this event is the mostly used one and since theres preFlush now it seems a logical solution if onFlush would be a start of transaction in general |
| Comments |
| Comment by Benjamin Eberlei [ 14/Jan/12 ] |
|
onFluish is not the start of a transaction. It has nothing to do with this. |
| Comment by Marco Pivetta [ 31/Mar/12 ] |
|
Is a third event needed? Or is this to be marked as "won't fix"? |
| Comment by Benjamin Eberlei [ 31/Mar/12 ] |
|
Maybe onBeginTransaction, onCommit and onRollback. However since you can start transactions manually using $em->beginTransaction(), the Flush events are somehwat independent of transactions anyways. |
| Comment by Gediminas Morkevicius [ 31/Mar/12 ] |
|
Well, user can start transaction anytime, but the fact is that if we think ORM we do not know nothing about the database. we just persist and flush objects. Yes I think these would be very useful, from how I see it, if you use event listeners, is: loadClassMetadata: you can apply extra mapping onFlush: you can modify entity changesets, or persist recalculate new ones, without triggering the database, since it is not used to begin the database modifications yet. onBeginTransaction: could use the database modifications keeping in sync the entity changesets. the thing about this event is that usually in behavioral way atomic updates are required. for example nestedset tree sync lft rgt columns, sortable sync the sort index, materialized path, all these requires atomic updates, and the best place is the start of transaction. onCommit: could be useful to execute right before commit, finalizing database modifications could be done. onRollback: this one is really something, since if you go far, there might be something like files uploaded during the entity processing, and you may want to remove them if transaction fails. |
| Comment by Guilherme Blanco [ 21/May/12 ] |
|
This situation was barely documented here: http://www.doctrine-project.org/jira/browse/DDC-1443 We need a better Transaction API that completely fixes the computation of changesets and also allow more fine grained control over Entities and their corresponding information. I'd postpone this one until 3.0. |
[DDC-1551] postFlush event listeners should be able to get a list of all flushed entities Created: 21/Dec/11 Updated: 23/May/12 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Albert Casademont | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 8 |
| Labels: | None | ||
| Description |
|
Testing the new Doctrine 2.2 Beta we finally got the postFlush event which is a nice way to handle things after all the DB work has finished. The main problem is that there is no way to get all the flushed entities. In the onFlush event you are able to use the getScheduledEntityUpdates/Inserts/Deletions but as these entities are flushed, those arrays are now empty. To solve this i see 2 aproaches: 1. Not unseting the array that holds the scheduled entities so the getScheduledEntityUpdates/Inserts/Deletions still have data. Those arrays are reset just before finishing the commit method so maybe unsetting them one by one as they are flushed is not necessary I can make a patch if necessary, just wanted to know if that sounds ok before starting it |
| Comments |
| Comment by Jasper N. Brouwer [ 23/May/12 ] |
|
I agree that Doctrine\ORM\Event\PreFlushEventArgs should contain a record of flushed entities, preferably reachable by entity-insertions/updates/deletions and collection-updates/deletions. I have a project (using Doctrine 2.1) which wrapped the flush call in my own. My flush dispatches custom preFlush/postFlush events (as they didn't exist in Doctrine 2.1), where my postFlushEventArgs does contain such a record. I've just upgraded my project to use Doctrine 2.2 and stumbled upon: Catchable fatal error: Argument 1 passed to Nw\Event\EntityEvent::postFlush() must be an instance of Nw\Event\Args\PostFlushEventArgs, instance of Doctrine\ORM\Event\PostFlushEventArgs given. It seems I've now hooked into Doctrine's postFlush (because I named the events the same way). I have renamed my events to work around this error, but I'd rather see my behavior implemented natively. PS: Using Doctrine 2.2.2 to be precise |
[DDC-1507] State change detection for version incrementation (for optimistic locking) in combination with orphanRemoval Created: 23/Nov/11 Updated: 27/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1.4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Georg Wächter | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As i understand the documentation correctly, orphanRemoval associations have the meaning of a "part of" relationship. In the example (http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-associations.html#orphan-removal) the adresses are part of the contact. In my opinion we should reason that the state of the adress consists of the states of all nested contacts. As a consequence we should flag the contact as "dirty" when the adresses change. This is relevant for optimistic locking scenarios or event handlers. In my application i tried to use optimistic locking for "contacts", which does not work if i don't change anything in the contact but only in the nested addresses. |
| Comments |
| Comment by Benjamin Eberlei [ 27/Nov/11 ] |
|
This is still only an approvement, you can workaround this and handle is in your domain code. |
| Comment by Georg Wächter [ 27/Nov/11 ] |
|
Not in all cases. The first problem is that my domain code can't modify the version property, doctrine seems to block any manipulations to it. So i'm not able to increment the variable myself. The only solution is to implement optimistic locking on my own or to add a dummy persistent boolean field that gets inversed by my domain code .. which would trigger the doctrine implementation for the optimistic locking. I think it's clear that the second option shouldn't be a choice. If doctrine doesn't handle the overall case exactly it should allow me to increment the version number myself. |
Possible Regression with OneToOne relation
(DDC-1461)
|
|
| Status: | Open |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | None |
| Security Level: | All |