karantan
karantan

Reputation: 1015

CodeIgniter and ORM (datamapper)

i'm new to php and codeigniter but i have experience with pylons and sqlalchemy.

there you define model classes and then you use command something like "paster setup-app development.ini" and (paster?) creates tables for you and you dont have to write any sql code...

i was trying this with codeigniter and datamapper but so far i'm not sure if it is possible. so here i am asking you if it is possible?

i am very confused because in "models/" you can put your own classes (like in sqlalchemy). in these classes you define every attribute, relationship and other stuff. so why would you need to write the same thing 2 times? (1st in this class 2nd in sql script)

Upvotes: 0

Views: 412

Answers (1)

WanWizard
WanWizard

Reputation: 2574

That is not possible, Datamapper implements the Active Record pattern which expects the tables to be there.

There is no need to define any attributes in a Datamapper model, it will be fetched from the associated table (and cached).

Upvotes: 1

Related Questions