zikula-modules / Clip

Flexible Document Creator
35 stars 8 forks source link

Refactor to Doctrine 2 #7

Open matheo opened 13 years ago

matheo commented 13 years ago

Refactor Clip for Doctrine 2.

ghost commented 11 years ago

Looking for volunteers for this please @cmfcmf @nmpetkov @craigh @planetenkiller

craigh commented 11 years ago

I cannot

cmfcmf commented 11 years ago

No sorry. I only used DBUtil for now. Doctrine is new for me too.

nmpetkov commented 11 years ago

Me too. I'm using some doctrine commands, but I'm at the stage I can't understand why table structures are placed in php comments... :-( Also I'm not sure how doctrine implements JOIN's and other database queries, which are essential for large content/database management. Also I'm new to Clip at all.

ghost commented 11 years ago

@nmpetkov Doctrine 2 implements what is called the "data mapper" pattern. So basically, Doctrine just needs a map of how entities are structured and their relations, so it can map them. this can be done using XML, YML, plain old arrays (like our DBUtil tables.php) or annotations. Annotations (written in docblock comments) are just another way of telling Doctrine about the mapping. Overall, Annotations are an extremely useful feature allowing one to add features to code without having to write code as it were. Here's a wonderful example: http://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/annotations/converters.html

nmpetkov commented 11 years ago

Thank you. It's good that comments are just one of the options to specify structure of database.

ghost commented 11 years ago

@nmpetkov - see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping there are tabs showing YML/XML as well as annotations.