[DDC-1024] the EntityGenerator generate getters and setters for properties of the parent class Created: 09/Feb/11 Updated: 04/Jan/12 Resolved: 12/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Tools |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Christophe Coevoet | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
when using the EntityGenerator to generate getters and setters of two classes mapped with annotations, one inheriting from the other, the EntityGenerator generates getters and setters for the properties of the parent class in the child class too. This occurs since the recent EntityGenerator changes (as it did not care about inheritance before). I haven't try if it works well when using XML or YAML for the mapping. |
| Comments |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
How do you define inheritance? |
| Comment by Christophe Coevoet [ 12/Feb/11 ] |
|
In my case, it was inheritance using a Single Table Inheritance. Both entities were in the same Symfony2 Bundle so the getters and setters were generated by the same command. |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
fixed |
| Comment by yakobe [ 01/Nov/11 ] |
|
I am still having this problem with the 2.1 branch. Should it not happen anymore? |
| Comment by Albert Brand [ 04/Jan/12 ] |
|
I'm also still seeing this in 2.1 (bundled with Symfony2). |
[DDC-1034] Registered lifecycle callbacks of derived classes have unexpected call sequence Created: 15/Feb/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Bart | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Situation: Expected output: Actual output: Test code: // Assume there is an entity manager $em // Fetch object Possible problem cause ClassMetadataInfo::addLifecycleCallback($callback, $event) method has a note 'If the same callback is registered more than once, the old one will be overridden'. We are not sure whether this is the case. |
| Comments |
| Comment by Benjamin Eberlei [ 04/Mar/11 ] |
|
Fixed. |
[DDC-1056] Using the StaticPHPDriver throws PHP Error Undefined property: Doctrine\ORM\Mapping\Driver\StaticPHPDriver::$_classNames Created: 03/Mar/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Steven Rosato | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Using the StaticPHPDriver throws PHP Error Undefined property: Doctrine\ORM\Mapping\Driver\StaticPHPDriver::$_classNames this is due to the class not having the two required instance variables $this->_classNames and $this->_fileExtension. |
| Comments |
| Comment by Steven Rosato [ 03/Mar/11 ] |
|
I have attached the patch that resolves the issue. |
| Comment by Steven Rosato [ 03/Mar/11 ] |
|
I applied the patch and added a pull request. https://github.com/doctrine/doctrine2/pull/34 |
| Comment by Benjamin Eberlei [ 04/Mar/11 ] |
|
Fixed |
[DDC-1041] UnitOfWork tryGetById method is always called with the rootEntityName Created: 24/Feb/11 Updated: 04/Mar/11 Resolved: 04/Mar/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Couragier Sébastien | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
LAMP |
||
| Description |
|
My problem : i have a class table inheritance, with only 3 class, one abstract and two concrete. if i already have in my identity map the ConcretClassA with id = 1 That's because the entityRepository (and all the other doctrine class) call the UnitOfWork tryGetById with the rootEntityName, which in my case is AbstractClass. $this->_em->getUnitOfWork()->tryGetById($id, $this->_class->rootEntityName) if i change this line to : $this->_em->getUnitOfWork()->tryGetById($id, $this->_class->name) the find method return the expected null value. So, why the UnitOfWork tryGetById method is always called with the rootEntityName ? |
| Comments |
| Comment by Benjamin Eberlei [ 25/Feb/11 ] |
|
The identity map HAS to work by root entity name. Otherwise think of an inheritance hierachy A If this does not hold you are screwed. Your problem is more subtle, i am not sure what the expected behavior should be here. |
| Comment by Couragier Sébastien [ 28/Feb/11 ] |
|
In my sense, the client code should exactly knows the inheritance hierachy, and exactly know what it wants too, so if it asks for an 'A' instance, you can't return a 'B' instance, although A inherit from B. |
| Comment by Benjamin Eberlei [ 28/Feb/11 ] |
|
I agree with you except for the last sentence part. If A->B and you query for B with Id 1 it should treturn an A if it exists. But if B->C and A->C then find(A) should only ever return As or Cs never, Bs. |
| Comment by Couragier Sébastien [ 28/Feb/11 ] |
|
I agree. 'AbstractClass' => And, at this time, in my code, i would like to know if the id 1 is a ConcretClassB. If the id 1 is a ConcretClassA, i must throw an exception. thx for your help |
| Comment by Benjamin Eberlei [ 28/Feb/11 ] |
|
Cant you just check instanceof? $a = $em->find('ConcretClassA', $aId);
if ($a instanceof ConcretClassB) {
throw new Exception();
}
|
| Comment by Couragier Sébastien [ 28/Feb/11 ] |
|
Of course i can. Nevermind, i don't have all the uses case Doctrine have to handle with inheritance in mind; so if you say it is to the client code to check, and it is a completely normal behavior, then it's okay for me. |
| Comment by Benjamin Eberlei [ 28/Feb/11 ] |
|
i will change this behavior in the future, i am just making suggestions for you to fix it now. Using instanceof will also be forwards compatible since "null instanceof Class" is always false. In any case the level of having to be careful is the same, using null instead of an object can get you into troubles aswell. |
| Comment by Couragier Sébastien [ 03/Mar/11 ] |
|
Perhaps throw a \Doctrine\ORM\EntityNotFoundException would be a better option than return a null value ? |
| Comment by Benjamin Eberlei [ 04/Mar/11 ] |
|
Fixed. |
[DDC-1033] Cloned proxies show unexpected behavior when initialized Created: 14/Feb/11 Updated: 26/Feb/11 Resolved: 26/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.0.2 |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Karsten Dambekalns | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When a proxy has been loaded and is cloned before being initialized, it will behave unexpectedly. _load() in the proxy starts a chain of method calls that end up loading the data and putting it into the proxy being in the identity map inside UoW. Now the registered proxy will be updated, but the cloned copy will of course not be changed - except it will behave as if it was initialized. This leads (at least in my case) to changes not being picked up after merge() has been called. In my case I could work around this if I could ask the proxy to initialize itself ( |
| Comments |
| Comment by Benjamin Eberlei [ 18/Feb/11 ] |
|
This issue is rather tricky, since __clone is called AFTER the actual clone, on the CLONED object. What we need is before the clone on the original object. This is pretty problematic to solve, i have to wrap my head around it. |
| Comment by Benjamin Eberlei [ 26/Feb/11 ] |
|
Fixed. |
[DDC-1026] Doctrine Cache Created: 10/Feb/11 Updated: 25/Feb/11 Resolved: 25/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | None |
| Affects Version/s: | 2.0.1, 2.0.2 |
| Fix Version/s: | 2.0.2 |
| Security Level: | All |
| Type: | Bug | Priority: | Critical |
| Reporter: | Bertrand Zuchuat | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I find a problem with doctrine cache key. It use a namespace and key to save the value and never use the namespace to get it. I checked that on AbstractQuery::getResultCacheId(). AbstractCache::save |
| Comments |
| Comment by Benjamin Eberlei [ 12/Feb/11 ] |
|
AbstractQuery::getResultCacheId() does not append the namespace. The Cache functions fetch() and contains() do. |
| Comment by Alex Woods [ 24/Feb/11 ] |
|
Actually, I think ALL result caching may be broken since the fix for This patch should fix the issue. There's still a less serious issue - and that's that if there are two ids with clashing hashes that are being called repeatedly in quick succession, they're going to keep displacing each other from the cache. An alternative patch could bundle both ids them into the same cache entry: if ($cached === false) However, I think displacing is better than running the risk of having a TTL that is too long be applied as the result of a clash! EDIT: I'm also wondering why $hash isn't used as the cache key. It looks like the intention was that it should be, but it isn't.. |
| Comment by Benjamin Eberlei [ 25/Feb/11 ] |
|
Fixed, the |
[DDC-1036] the Aggregate Expressions "AVG" | "MAX" | "MIN" | "SUM", should be followed by SimpleArithmeticExpression Created: 16/Feb/11 Updated: 20/Feb/11 Resolved: 20/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Jison Xiao | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
the Aggregate Expressions "AVG" | "MAX" | "MIN" | "SUM", should be not only followed by StateFieldPathExpression , but also SimpleArithmeticExpression, i found it can not execute dql like i think, this should be a bug |
| Comments |
| Comment by Guilherme Blanco [ 19/Feb/11 ] |
|
You are totally right. I fixed on trunk repository. Thanks a lot for pointing out this issue. =) |
| Comment by Benjamin Eberlei [ 20/Feb/11 ] |
|
Merged into 2.0.x also |
[DDC-1023] the EntityGenerator duplicates the property when using annotations Created: 09/Feb/11 Updated: 13/Feb/11 Resolved: 13/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Tools |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.0.2 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Christophe Coevoet | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When using the EntityGenerator to generate getters and setters of a class mapped with annotations, all properties are duplicated. This occurs at least when the properties were defined protected (not tried with private ones). It worked fine before the recent EntityGenerator changes. |
| Comments |
| Comment by Benjamin Eberlei [ 13/Feb/11 ] |
|
Fixed |
[DDC-1030] Issue with parseTokensInEntityFile() and multiple levels of namespace Created: 12/Feb/11 Updated: 13/Feb/11 Resolved: 13/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | Git Master |
| Fix Version/s: | 2.0.2 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Jonathan H. Wage | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
If you have something like Acme\MainBundle\Document\User, the parser will only popular Acme\User as the key for the parsed information. We have to consider multiple leves of namespace. This concatenates each namespace after the namespace separator is found. I made the same fix in the odm here. Pull request for ORM on the way. https://github.com/doctrine/mongodb-odm/commit/b7c72aa7b7b41de97b328a872cc8f7d4141b3143 |
| Comments |
| Comment by Jonathan H. Wage [ 12/Feb/11 ] |
| Comment by Benjamin Eberlei [ 13/Feb/11 ] |
|
Ah good catch. That fixes 2 open issues that i couldnt pin down |
| Comment by Benjamin Eberlei [ 13/Feb/11 ] |
|
Fixed. |
[DDC-953] CLI tools orm:generate-entities --regenerate-entities=1 flag will generate empty entities 50% of time. Created: 28/Dec/10 Updated: 08/Feb/11 Resolved: 08/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Mapping Drivers |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Flyn San | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 10.10, PHP5.3.3 |
||
| Description |
|
Running the command: 50% of the time my entity will appear as: namespace models; /**
} The other 50% everything will be in there. In addition, if the --regenerate-entities=1 argument is removed, if I change the data in my YAML schema file for a column (such as changing length=255 to length=50 on a string), the annotations won't be updated when the updated entity is generated. It seems only new fields are being added to the entity files which is why --regenerate-entities=1 was required in the first place. |
| Comments |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
Fixed |
| Comment by Flyn San [ 08/Feb/11 ] |
|
This issue is still not fixed in 2.0.1. Simply run orm:generate-entities --regenerate-entities=1 --generate-annotations=1 to replicate. |
| Comment by Benjamin Eberlei [ 08/Feb/11 ] |
|
Yes, because this issue is fixed in 2.0.2 not in 2.0.1. |
[DDC-1018] INDEX BY does not work in JOIN clauses Created: 04/Feb/11 Updated: 05/Feb/11 Resolved: 05/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | DQL |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
It seems INDEX BY only works in the FROM, not in JOIN clauses. This is a dependency for |
| Comments |
| Comment by Benjamin Eberlei [ 05/Feb/11 ] |
|
Fixed |
[DDC-1009] Allow using an annotation namespace in the EntityGenerator Created: 01/Feb/11 Updated: 02/Feb/11 Resolved: 02/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Tools |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.2 |
| Security Level: | All |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Christophe Coevoet | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The EntityGenerator does not allow to use a namespace for annotations, which is supported by the driver and used by Symfony2 DoctrineBundle. The pull request https://github.com/doctrine/doctrine2/pull/22 adds this behavior. |
| Comments |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
Fixed. |
[DDC-1006] Entity Generator Regenerate If Not New Created: 31/Jan/11 Updated: 02/Feb/11 Resolved: 02/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Tools |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Stephen Walker | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When regenerating entities from xml ( and i am sure all others ) it gives a blank entity class when the file exists and the regenerateIfExists is set to true, the expected result would be a full entity with any removed columns removed from the entity and new columns to be added. i've come up with a fix that i assume is the correct way $em->getConfiguration()->setMetadataDriverImpl( $cmf = new Doctrine\ORM\Tools\DisconnectedClassMetadataFactory(); $generator = new \Doctrine\ORM\Tools\EntityGenerator(); in the _hasProperty and _hasMethod functions, need to add the below to the inline check:
|
| Comments |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
blank as in the file is completly empty? |
| Comment by Stephen Walker [ 02/Feb/11 ] |
|
no, it generates just the class with no properties or methods. |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
Fixed |
[DDC-1002] bug in generate entities with many2many relationships from xml/yml shcemes Created: 25/Jan/11 Updated: 02/Feb/11 Resolved: 02/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Stepan Tanasiychuk | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux stfalcon-laptop 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux |
||
| Attachments: |
|
| Description |
|
I try use many2many relations in my symfony2 learning project https://github.com/symfony/symfony.git After that I try generate similar entitries is doctrine2-sandbox. Problem is the same Problem:
|
| Comments |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
Fixed the msising constructor. However mind that in my Whitewashing project i wrote the entities manually, not generated them! |
[DDC-1008] Entity Generator Stub Method For Id Generator Created: 31/Jan/11 Updated: 02/Feb/11 Resolved: 02/Feb/11 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | Tools |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | 2.0.2, 2.1 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Stephen Walker | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In the EntityGenerator when the id setting has a generator of NONE it does not add the stub method for setting the id keys value, here's my fix: around line 478 in the _generateEntityStubMethods function, the first foreach which checks for the id mapping, change: if ( ! isset($fieldMapping['id']) || ! $fieldMapping['id']) { TO if ( ! isset($fieldMapping['id']) || ! $fieldMapping['id'] || ($this->_getIdGeneratorTypeString($metadata->generatorType) == 'NONE')) { |
| Comments |
| Comment by Benjamin Eberlei [ 02/Feb/11 ] |
|
Fixed |