[DDC-947] Optmize Code-Generation Strategies Created: 24/Dec/10  Updated: 29/Mar/11

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We should optimize code-generation somehow.



 Comments   
Comment by Benjamin Eberlei [ 29/Mar/11 ]

Descheduled to 2.x





[DDC-896] Use PDepend for Code-Generation Created: 27/Nov/10  Updated: 27/Nov/10

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

Type: Improvement Priority: Major
Reporter: Benjamin Eberlei Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Our current code-generation tool has many shortcomings and due to its hard to test nature also many (known and unknown) bugs, as well as high maintenance.

Since people are overusing this tool and I am sort of annoyed by how much time goes into this we should rewrite this in a two-step procedure:

1. Move code into Common so we can share it between ORM, Mongo and CouchDB.
2. Use PDepend to read an entities source file (it generates an AST) and modify the AST with the required changes.

This gives us the advantage of having to maintaining less code for this stuff.






[DDC-585] Create a coding standards document Created: 13/May/10  Updated: 17/Apr/14

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

Type: Documentation Priority: Major
Reporter: Roman S. Borschel Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

We need a new coding standards document for Doctrine 2.



 Comments   
Comment by Benjamin Morel [ 29/Jan/13 ]

Has there been any work on a coding standards document yet?
I'm currently working on fixing documentation on this project, and it might be a good time to define a standard.
I've started compiling a few recommendations based on various feedbacks I've got in my pull requests, and I can post them here.
Please let me know if there have been previous attempts so far!

Comment by Marco Pivetta [ 29/Jan/13 ]

Benjamin Morel Guilherme Blanco may have a CS ruleset, but it's not ready yet. Perfect timing btw, we really need to automate this to avoid having all these useless CS fix comments in pull requests

Comment by Benjamin Morel [ 29/Jan/13 ]

Ok, I'll post my document here once ready, and Guilherme Blanco will be able to compare it with his ruleset!

Comment by Benjamin Morel [ 30/Jan/13 ]

Here is a first draft: https://gist.github.com/4676670

Please comment!

Comment by Benjamin Morel [ 11/Feb/13 ]

Guilherme Blanco, if you don't have time to compare your ruleset with my draft, maybe you could publish your current ruleset so that others can have a look?

Comment by Benjamin Morel [ 02/Aug/13 ]

Any update guys? I'm willing to spend some time on this work, but if no one answers, we won't be going forward

Comment by Marco Pivetta [ 02/Aug/13 ]

Benjamin Morel I think a pull request against the doctrine website (https://github.com/doctrine/doctrine-website-sphinx) would be fine...

Comment by Steve Müller [ 17/Apr/14 ]

This should go into https://github.com/doctrine/coding-standard repo (long term).





[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:
helmer
Hi. I have a question regarding (pre|post)persist events. Why are the events ignored for second persist (should fire prePersist) + flush (should fire postPersist) in the following pastie: http://pastebin.com/V8CrPWkM Is it a bug or am I missing sth?
Stof
helmer: there is no second persist. persist() means saying Doctrine to manage the entity. Once it is managed, you are not persisting it anymore but updating it
helmer
Stof: so basically one could define these two events for themselves as (pre|post)Insert?
beberlei
yes
helmer
thanks beberlei&stof! though a suggestion to docteam .. perhaps make it more clear to people like me, current doc can be kind of misleading ie: "There are two ways for the prePersist event to be triggered. One is obviously when you call EntityManager#persist()" http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html#prepersist

Pastie code (probably expired by now):
$entity = new Entity();

$entity->setSomething('xxx');
$this->em->persist($entity);
$this->em->flush();

$entity->setSomething('yyy');
$this->em->persist($entity);
$this->em->flush();






[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-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   

See: http://www.doctrine-project.org/documentation/manual/2_0/en/annotations-reference#ann_mappedsuperclass

@MappedSuperclass

An mapped superclass is an abstract or concrete class that provides persistent entity state and mapping information for its subclasses, but which is not itself an entity. This annotation is specified on the Class docblock and has no additional attributes.

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:

  • Is this defined on the superclass or on the children classes?
  • If it's defined on the child classes, does it take parameters? The name of the super class?
  • It was not at all apparent to me that it was mutually exclusive with the @Entity tag


 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 DDC-511 looks like that same issue.

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.





Generated at Wed Jul 23 22:39:59 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.