nciri / zend-db-model-generator

Automatically exported from code.google.com/p/zend-db-model-generator
0 stars 0 forks source link

FEATURE: Code generation without overwriting existing code #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
IDEAS TO SOLVE

1. Create for every Model, Mapper, DbTable an extra class which extends the 
generated classes, but they are empty for Users Code

or 

2. Create an part in the generated Models, Mappers and DbTables, where the 
UsersCode can exist, which would not overwritten.

or 

3. Use Zend_Code_Generator to check if CODE IS DIRTY
http://framework.zend.com/manual/en/zend.codegenerator.html

Original issue reported on code.google.com by globalni...@gmail.com on 9 Feb 2012 at 12:04

Attachments:

GoogleCodeExporter commented 8 years ago
thanks for your comments. I do want to find the best method to achieve such a 
feature. your information was really helpful, hopefully I'll come with a final 
resolution soon.

Original comment by kfirufk@gmail.com on 26 Jul 2012 at 9:21

GoogleCodeExporter commented 8 years ago
Hi,

just a small suggestion, I have a repositories folder where I keep all my 
custom code for each model.

-root
..models
...DbTable
....Users.php (DbTable)
....Users_Wishlist.php (DbTable)
...mappers
....Users.php (mapper)
....Users_Wishlist.php (mapper)
...repositories
....Users.php (repository "custom code")
....Users_Wishlist.php (repository "custom code")
...Users.php (model)
...Users_Wishlist.php (model)

* Add RepositoryAbstract.php class with at least a constructor;
* Add additional methods/properties to ModelAbstract and generated classes to 
handle the repository, ie. setRepository($repository) in ModelAbstract, 
getRepository() in each generated model etc;

I think this is more clean than having a custom class for each model, mapper 
and dbtable, since think most custom code could be handled at the "repository" 
level;

FYI. I'm migrating a big project to Symfony2 next year, wich works nicely with 
Doctrine out of the box, looking forward to it :)

Original comment by diegot...@gmail.com on 19 Dec 2012 at 1:10