nciri / zend-db-model-generator

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

Feature requests: singular row model names, & row stubs #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
sorry if this is the wrong place to put feature requests

in every other ORM i've used, the table & table objects are plural (because 
they hold many rows) and the row objects are singular. 

it would be great if we could provide an associative array of 
plural-to-singular conversions to be performed at build-time. e.g.  ('People' 
=> 'Person', 'Companies' => 'Company');  If there's no conversion specified for 
the table, then it just gets the same name for the table & row (e.g. Sheep 
table returns a Sheep row). This way the default behaviour would be the same as 
it is now, providing backward compatibility.

it is also frustrating that any custom methods we add to row objects get 
overwritten each time the objects are regenerated. it would be great if on 
first-generation, two row objects were created for each table: Model_Person, 
and Model_Person_Base. On every re-generation after the first one, Model_Person 
would NOT get overwritten if it already existed. All our custom code goes in 
there, and it extends Model_Person_Base, which does get overwritten each time 
the db layer is regenerated.

Right now I put my custom code at the bottom of each file and if i want to 
regenerate, i have to manually back it up, and then copy/paste it into the new 
files. Huge pain. I tried creating my own extension objects. The problem was 
that the generated code only returned the generated row objects for query 
results. I couldn't get it to return my extension objects.

lastly, it would be great if there was an easy way to turn off namespacing 
altogether, so that we could say "$person = new Person()", instead of "$person 
= new Application_Model_Person()" or "$person = new Model_Person()".

if this sounds cool, but you don't have time, i might be able to pitch in. i'm 
pretty strapped for time too, but i've been doing php professionally for 10 
years now.

Original issue reported on code.google.com by oran...@gmail.com on 9 Jan 2012 at 4:18

GoogleCodeExporter commented 8 years ago
nice ideas. I'm gonna start working on them in the near future and let ya know 
:)

Original comment by kfirufk@gmail.com on 7 Feb 2012 at 9:13