CodeIgniter Forums
ORM Table Mapping [CI2] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: ORM Table Mapping [CI2] (/showthread.php?tid=70409)



ORM Table Mapping [CI2] - nehasharma - 04-05-2018

Hi All, 

I am new to the CodeIgniter. And currently working on the existing CodeIgniter Project. I have a small task to do, That just to introduce a checkbox and save its value to database. But when I have integrated the code to the project, All the existing calculation of discounts is messed. I analysed the code and I found that, in the project ORM Table mapping is used. In which a json file is stored for each table containing  all the details of table. I am writing the json file code below
{ "class": "Session_Registration"
  , "table": "session_registration"
  , "id": {}

  , "literals": {
"half_day": {
"php_data_type": "bool"
  , "default_value": false
}
  , "extended_day": {
"php_data_type": "bool"
  , "default_value": false
}
  , "time_added": {
  "php_data_type": "datetime"
}
  , "expiration_overridden": {
"php_data_type": "bool"
  , "default_value": false
}
//set to true if parent clicked "Pay Later" button
  , "pay_later": {
"php_data_type": "bool"
  , "default_value": false
}
  , "deleted": {
"php_data_type": "bool"
  , "default_value": false
}
}

// references to other objects (except DateTime objects; DateTimes are considered literals)
 , "references": {
    "semester": {
"class": "Semester"
}
  , "student": {
"class": "Person"
}
  , "session": {
"class": "Session"
}
  , "homegroup": {
"class": "Scheduled_Class"
}
  , "sale_item": {
    "class": "Sale_Item"
}
}

  , "collections": {
    //Note: this includes both homegroups and choice classes
    "choice_class_registrations": {
"class": "Class_Registration"
  , "relationship": "one-to-many"
}
}
}

I just need to add one column name bb_clinic. when I am adding column value in the json file.It is giving error : bb_clinic column does not exist. I have added the bb_clinic column directly on the phpmyadmin, But its not working. 
Please give me a solution that how to add a column using ORM table Mapping, Or what is the proper solution.


RE: ORM Table Mapping [CI2] - InsiteFX - 04-05-2018

If your adding it to the json you also need to alter the table and add it there also.


RE: ORM Table Mapping [CI2] - nehasharma - 04-05-2018

(04-05-2018, 09:02 AM)InsiteFX Wrote: If your adding it to the json you also need to alter the table and add it there also.

Wink Thank You so much for you reply. Now I have resolved the issue. I have already added that column to the table but it was not working, because there are dependent views also in the database. I altered the view also. After that it works.


RE: ORM Table Mapping [CI2] - InsiteFX - 04-06-2018

Glad you got it to work.