Welcome Guest, Not a member yet? Register   Sign In
ORM Table Mapping [CI2]
#1

(This post was last modified: 04-05-2018, 07:31 AM by ciadmin.)

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.
Reply
#2

If your adding it to the json you also need to alter the table and add it there also.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(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.
Reply
#4

Glad you got it to work.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB