Welcome Guest, Not a member yet? Register   Sign In
Code Igniter - Datamapper ORM 1.8.2 - Table Generation
#1

[eluser]nickaceph[/eluser]
Hi, First of all I would like to thank CodeIgniter for a great framework, planning and reasearch lead me to decide to use CI an Datamapper ORM for my project.

Many post is about the CI - DataMapper ORM rises with how to generate Model From Database which in my point of view is much complicated as the application will have to know your conventions in table which would be very .... but possible maybe Big Grin

My question is much much possible as Can DataMapper Generate Table in the Database from your define Model or is there any Datamapper extension or helper that would do this:

ex : generateTable('modelName')

now i know this is possible as the plugin knows what it needs. is there any such so I would never have to code them my self.

Thanks
Nick Ace
#2

[eluser]WanWizard[/eluser]
[quote author="nickaceph" date="1369299091"]My question is much much possible as Can DataMapper Generate Table in the Database from your define Model or is there any Datamapper extension or helper that would do this[/quote]

The answer to both is no. This is a very complex operation, and very dependent on what the database can provide in terms of information.

It's been looked at, but given the fact it only takes 2 minutes tops to create a model class, generating it is pretty pointless.
#3

[eluser]toopay[/eluser]
@WanWizzard, well actually it should not so complex, considering the ORM itself is all about DDL, right? I do think that handwriting model is beautiful task, but when we deal with more than 10 tables/entities, this can be monotonous task

Propel, Doctrine (and even Gas ORM 2) support that task (generating model -> database, vice versa) Smile
#4

[eluser]WanWizard[/eluser]
Datamapper is open source, feel free to contribute.

But I honestly don't see what there is to generate. A default datamapper class is empty (1 line of code for the class definition). You may want to add a table name if it's non-standard (1 line of code extra), and you may want to add relations (which you can't generate because you can't get them from the database).
#5

[eluser]nickaceph[/eluser]
To All

Thanks for the replies, I have taken everything to account and with the implementation I'm going to have. I really will need such a feature, with the comparison between Datamapper, Propel and GAS with the feature, implementation and browsing the code's that make it happen. I have decided to go with Datamapper, Extending it to add my custom basecode and the ability to generate table and/or update field changes.

for my implementation it will go something like these.
- a Module a CI controller or Group of CI controller will be developed ex: HR 201 File Module
- these depends on more that one Model - this will now be define using the extended DatamapperORM
- HR 201 File Module have a setup controller which will call the model generation base on the Module requirements
... something like these

Thank you all for your feedback I will also post my code implementation when it is done for anyone who may need them.

Thanks Again

Nick Ace







Theme © iAndrew 2016 - Forum software by © MyBB