[DDC-3407] add possibility to prevent some entitiy methods from being proxied Created: 21/Nov/14  Updated: 21/Nov/14

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Trivial
Reporter: Oliver Hoff Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This is for optimization of lazy loading, when using entity methods that operate only on identifier values.

This issue is partially addressed via:
https://github.com/doctrine/doctrine2/commit/ba38f3e1e9d725224998af9fce42186b5ccb9641

But it makes assumptions about a certain code style, that is for an "id" identifier property the getter is named "getId". but some code styles prefer "getID".

It would be nice to have an annotation like @ORM\SkipProxy (or equivalents for xml/yaml) to mark a method that should not be proxied.



 Comments   
Comment by Marco Pivetta [ 21/Nov/14 ]

I wouldn't implement it that way. I'm actually building something (non-trivial) at https://github.com/Ocramius/ProxyManager/pull/192 and https://github.com/Ocramius/ProxyManager/issues/159, but it will take some time to get there, and also to get doctrine to use that component to generate proxy classes.





[DDC-3287] PreUpdateEventArgs need to extend Doctrine\Common\PreUpdateEventArgs Created: 29/Aug/14  Updated: 19/Oct/14

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial
Reporter: Sebastian Kuhlmann Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: inheritance, orm


 Description   

Currently the inheritance tree of the EventArgs don't allow for creating event listeners that fit both ORM- and MongoDB-driven applications.

Doctrine\Common defines base classes for Lifecycle event arguments. Doctrine\ORM uses the common library and extends it's classes. So does MongoDB. If you wanted to write something that suits both ORM and MongoDB you should be able to rely on the Common-implementations.

The provided classes to extend:

  • Doctrine\Common\Persistence\Event\LifecycleEventArgs
  • Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs
  • Doctrine\Common\Persistence\Event\ManagerEventArgs
  • Doctrine\Common\Persistence\Event\OnClearEventArgs
  • Doctrine\Common\Persistence\Event\PreUpdateEventArgs

Checking the Github repository there is no common ground for the inheritance mechanism.

  • Doctrine\ORM\Event\LifecycleEventArgs extends Doctrine\Common\Persistence\Event\LifecycleEventArgs
  • Doctrine\ORM\Event\PreUpdateEventArgs extends Doctrine\ORM\Event\LifecycleEventArgs
  • Doctrine\ORM\Event\PreFlushEventArgs extends Doctrine\Common\EventArgs
  • Doctrine\ORM\Event\PostFlushEventArgs extends Doctrine\Common\EventArgs
  • Doctrine\ORM\Event\OnFlushEventArgs extends Doctrine\Common\EventArgs
  • Doctrine\ORM\Event\OnClearEventArgs extends Doctrine\Common\EventArgs

This needs to change and ORM\PreUpdateEventArgs as well as ORM\OnClearEventArgs need to extend the respective events from Doctrine\Common.



 Comments   
Comment by Sebastian Kuhlmann [ 23/Sep/14 ]

See https://github.com/doctrine/doctrine2/pull/1144

Comment by Christophe Coevoet [ 04/Oct/14 ]

All flush event args should be updated to extend ManagerEventArgs (and marking their getEntityManager method as deprecated too)

Comment by Christophe Coevoet [ 04/Oct/14 ]

to be clear, the change on PreUpdateEventArgs cannot be done until 3.0 because of BC

Comment by Doctrine Bot [ 19/Oct/14 ]

A related Github Pull-Request [GH-1144] was assigned:
https://github.com/doctrine/doctrine2/pull/1144





[DDC-3265] Incorrect Docblock return type in CacheConfiguration Created: 21/Aug/14  Updated: 30/Aug/14

Status: In Progress
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.5
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: James Murray Assignee: Steve Müller
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In CacheConfiguation.php line #88 (at the time of writing)

The docblock for the method getRegionsConfiguration specifies the return type of "QueryCacheValidator" however it's actually returning "RegionsConfiguration"



 Comments   
Comment by Steve Müller [ 22/Aug/14 ]

PR: https://github.com/doctrine/doctrine2/pull/1116/

Comment by Doctrine Bot [ 30/Aug/14 ]

A related Github Pull-Request [GH-1116] was assigned:
https://github.com/doctrine/doctrine2/pull/1116

Comment by Doctrine Bot [ 30/Aug/14 ]

A related Github Pull-Request [GH-1116] was closed:
https://github.com/doctrine/doctrine2/pull/1116





[DDC-2898] SQL-Table Prefixes example produces php notices with ManyToMany-Associations Created: 09/Jan/14  Updated: 09/Jan/14

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.1
Fix Version/s: None

Type: Documentation Priority: Trivial
Reporter: do.ev. Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

source: http://docs.doctrine-project.org/en/latest/cookbook/sql-table-prefixes.html

In class TablePrefix the line ...

if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {

should be replaced by ...

if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) {






[DDC-2633] How i can use arithmetic expression in the ORDER BY clause? Created: 26/Aug/13  Updated: 26/Aug/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.3.4
Fix Version/s: None

Type: Documentation Priority: Trivial
Reporter: Liverbool Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I found solution in this site: http://michelsalib.com/2012/03/04/doctrine2-ninja-with-the-hidden-keyword/

I want to use:
... ORDER BY DATE_FORMAT(field, '%Y')
or
... ORDER BY CONVERT(field USING [CHARSET])

and it catch exception like:

<br />
<b>Fatal error</b>: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message 'SELECT t.id, t.label, t.id AS value, t.label AS text FROM Entities\Repair\ProductType t WHERE t.bch_id=?1 ORDER BY DATE_FORMAT(t.create_date,'%Y') ASC' in /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:39
Stack trace:
#0 /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(396): Doctrine\ORM\Query\QueryException::dqlError('SELECT t.id, t....')
#1 /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(744): Doctrine\ORM\Query\Parser->syntaxError('end of string')
#2 /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(229): Doctrine\ORM\Query\Parser->QueryLanguage()
#3 /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(304): Doctrine\ORM\Query\Parser->getAST()
#4 /home/joyprice.core/Vendor/Doctrine/orm/lib/Doctrine/ORM/Query.php(233): Doctrine\ORM\Query\Parser->parse()

But have solution from DQL?

Sorry to ask the question in Issues Tracker.
Thanks






[DDC-2611] [GH-756] Make yaml/xml configuration for "AttributeOverride" and "AssociationOverride" more discoverable Created: 13/Aug/13  Updated: 13/Aug/13

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of peterjmit:

Url: https://github.com/doctrine/doctrine2/pull/756

Message:

I was trying to find out how to configure `AttributeOverride` in yaml for one of my entities and all paths led me to the [Override Field Association Mappings In Subclasses](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/override-field-association-mappings-in-subclasses.html) tutorial.

It was a lot harder to find anything for xml/yaml. This pull request adds a link to the [Overrides section](https://doctrine-orm.readthedocs.org/en/latest/reference/inheritance-mapping.html#overrides) of the inheritance mapping reference which provides the needed examples.

Alternatively yaml/xml examples could be provided in the tutorial but I am not familiar enough with sphinx/the docs to make those changes



 Comments   
Comment by Doctrine Bot [ 13/Aug/13 ]

A related Github Pull-Request [GH-756] was closed:
https://github.com/doctrine/doctrine2/pull/756





[DDC-1972] Throw an exception when setting cascade options which do not exist Created: 08/Aug/12  Updated: 08/Aug/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.1.6
Fix Version/s: None

Type: Improvement Priority: Trivial
Reporter: George Zankevich Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I made the assumption that the way to define a cascading delete is to do (in YAML):

cascade: [delete]

When it is actually:

cascade: [remove]

It would be nice if Doctrine would throw an exception when the user sets a cascade option which does not exist.






[DDC-1765] SchemaTool Commands should accept both --force and --dump-sql Created: 04/Apr/12  Updated: 17/Nov/12

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: Rafael Dohms Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When running SchemaTool for schema operations you can get either a --dump-sql or make the changes using --force

When you run with --force you get a generic "1 query executed" response, there should be a way to execute it receiving feedback of the queries and making the changes.

This is good for example for my automated test env builder, as the return of this command would be logged. But i see no reason why the script can't take both options.



 Comments   
Comment by Paweł Nowak [ 17/Nov/12 ]

Proposed fix: https://github.com/doctrine/doctrine2/pull/517





[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:
http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/dql-doctrine-query-language.html#dql-select-examples

The following lines are present:
$query = $em->createQuery('SELECT u.username, u.name FROM CmsUser u');
$users = $query->getResults(); // array of CmsUser username and name values
echo $users[0]['username'];

There is an error in:
$query->getResults();

It should read
$query->getResult();






[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
{
/**

  • @Id @Column(type="integer", nullable=false, columnDefinition="INT UNSIGNED NOT NULL AUTO_INCREMENT")
  • @GeneratedValue(strategy="AUTO")
    */
    private $id;

/**

  • @OneToOne(targetEntity="User_ExtraAttrs", cascade= {"persist","remove","detach","merge","refresh"}

    , mappedBy="User")

  • @JoinColumn(name="id", referencedColumnName="id")
    */
    private $UserAttrs;
    }

class User_ExtraAttrs
{
/**

  • @OneToOne(targetEntity="User", cascade= {"all"}

    , inversedBy="UserAttrs")

  • @Id
  • @JoinColumn(name="VehicleID", referencedColumnName="VehicleID")
    */
    private $User;
    }

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-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
In 24.2.2. Configuration (Non-PEAR)

The example seems to be wrong.

use Doctrine\DBAL\Tools\Console\Helper\EntityManagerHelper;
should be
use Doctrine\ORM\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-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-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,
in a situation where entity, that EM is to work with, is not inside of any namespace (that should be specified in $chainDriverImpl->addDriver($metadataDriver, 'someNamespace'); )
-> gives error message 'Entity # is not a valid entity or mapped superclass' instead of notifying that the entity's namespace is not added






[DDC-1076] It should be possible to supply EntityManager with a custom ProxyFactory Created: 24/Mar/11  Updated: 25/Mar/11

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: David Reisch Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 2
Labels: None


 Description   

It is plausible that one might want to handle the loading of proxy classes in their own way, perhaps not using the filename/class scheme doctrine currently comes with.

Currently the only way to provide your own implementation of ProxyFactory is to subclass EntityManager. Even this is not clean since one also must copy/paste the EntityManager::create factory method to get identical behavior.

It would be nice if there was a ProxyFactory interface and one could provide an instance of it to Doctrine\ORM\Configuration when creating an EntityManager.



 Comments   
Comment by David Reisch [ 24/Mar/11 ]

I would be happy to contribute a patch to this end.

Comment by Benjamin Eberlei [ 25/Mar/11 ]

Can you elaborate on your use-case? proxies are sorft of a by product, to be genreated in a temporary cache directory. I don't see why one should bother about how it is done.

Comment by David Reisch [ 25/Mar/11 ]

Hi,
I think allowing users to specify their own implementations for things is pretty essential for a library, especially when there is no cost in complexity or implementation.

Anyhow, here's my pitch:

I personally do not like using inheritance for proxies (it feels hackish to me), preferring instead to have interfaces for my Business Objects which the proxies implement. To that end, I do not generate my proxies with doctrine, but maintain my own, in my code base, and the class files do not necessarily match up to the doctrine ProxyFactory's assumptions about where to find the classes.

Regards,





[DDC-1004] Option for mapping:import to not write Entity Files if they exist Created: 27/Jan/11  Updated: 27/Jan/11

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: s.rohweder Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

There should be an option to omit the creation of allready existing entities:

Use Case:

if you develop your model in the database and create the entities with the cli and then go on with development and create new tables you would build the entities again with the cli. This will kill your allready existing and possible extended entities.

Best would be if you have to set the option when you want the existing entities overwritten. so you cant accidently overwrite them






[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
http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html#merging-entities
It appears to state that private variables are not serialized for child objects

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-605] Include Fowards Compatible Support for Scalar Type Hints Patch in ProxyFactory Created: 21/May/10  Updated: 08/Aug/10

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Trivial
Reporter: Benjamin Eberlei Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 0
Labels: None


 Description   

ProxyFactory needs foward compatible support for the scalar type hint patch:

http://ilia.ws/archives/217-Scalar-Type-Hints-are-Here!.html



 Comments   
Comment by Roman S. Borschel [ 23/May/10 ]

I would be surprised if that would not be reverted soon though





[DDC-567] Foreign Key to Unique Field Update Failure Created: 03/May/10  Updated: 08/Oct/12

Status: Reopened
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.0-BETA2
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Trivial
Reporter: Michael Ridgway Assignee: Roman S. Borschel
Resolution: Unresolved Votes: 2
Labels: None

Attachments: File DDC567Test.php    

 Description   

I am getting an error: 'Notice: Undefined index: sysname in ./libraries/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 434' when I try to flush a change to a property that references a unique field on another object.

From poking around in the _prepareUpdateData function, it seems that it only allows you to use identifier fields:

$newValId = $uow->getEntityIdentifier($newVal);

..

$result[$owningTable][$sourceColumn] = $newValId[$targetClass->fieldNames[$targetColumn]];

I'll see if I can get a test case for this set up.



 Comments   
Comment by Roman S. Borschel [ 03/May/10 ]

Hi. That is right. Foreign keys (join columns) must point to primary keys, not arbitrary other columns, whether they're unique or not, Doctrine does not know.

In other words, joinColumn must always refer to an identifier/pk. I'm not sure but I think anything else would be a pretty strange relational model, too, but there may be usecases we have not yet encountered.

I'm afraid this will not be possible and would be very hard to implement. Of course if somebody has a patch we happily accept it (after reviewing).

Leaving this open in the case somebody wants to work on it.

Comment by Michael Ridgway [ 03/May/10 ]

A minimal test case. Removing the first flush produces the same error, so this seems to be a bug on inserts as well.

Comment by Roman S. Borschel [ 03/May/10 ]

Its not really a bug but rather a new feature This was not intended to work so far.

Comment by Michael Ridgway [ 03/May/10 ]

Ah, ok. Maybe it didn't work before. I don't know where I got the idea that it did.

Thanks.

Comment by Michael Ridgway [ 03/May/10 ]

Oops, closed it before I noticed you said you wanted to leave it open.

Comment by Roman S. Borschel [ 03/May/10 ]

Thanks for the testcase though, it is useful. In your concrete example, is it not an option to make the sysname the @Id ?

Comment by Michael Ridgway [ 03/May/10 ]

Yes. That is definitely the way it should be done in this case. I can't really think of a case to have a reference to a unique key while still having an Id on it, except when you're working with an existing, poorly designed database (which is our case).

The reason I assumed this was possible is that the references actually work for lazy loading, but as soon as you start changing the references it throws this error.

Comment by Roman S. Borschel [ 14/May/10 ]

Lowering priority.

Comment by Thomas Subera [ 08/Oct/12 ]

although we would also need this i would suggest adding an error message if the associated column is not found in $newValId. (class BasicEntityPersister.php _prepareUpdateData)

otherwise the field is populated with null leaving the developer debugging an hour :-/

thx





Generated at Fri Dec 19 09:33:12 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.