@toopay
Thanks for the response. That clears a lot of stuff up for me.
I am assuming you are suggesting to use set function to build a collection, and then follow the standard format for inserting it into the database? This gets rid of the custom methods in the model, as well as the private variables? Is that correct?
Is something that I create in the view or controller, accessible in the model than this way through _after_save()?
So instead of calling a function set_types, I could just set a collection of ‘types’ with the array of data I need. Then when _after_save() is called, insert that information to the correct table?
I am sorry, but I am coming back to PHP and web development after my career with Game Design didn’t go anywhere after a few years. OOP PHP 5 is new to me entirely, as well as frameworks like CI, so it’s been a little slow for me grasping things.
Ruby on Rails actually has a cascade insert. I only played with ROR for a few weeks using the CodeSchool Zombies for Rails and some side project, but I could so something like this (provided in my limited knowledge I understood what was going on).
This is my best PHP interpretation for mythical GAS ORM with cascade insert -
$data = array(
'name' => 'Bob',
'email' => '[email protected]',
'job' => find_by_name('M$'),
'pay' => array('amount' => '2000', 'frequency' => '2 weeks'),
);
Model\User::make($data);
I imagine additional arrays would be new record for table Pay, and would insert into User_Pay the correct IDs, while find_by_name would look in table Job for the existing record and make the correct IDs in User_Job.
This could be super far off plausible, like I said I am just getting back into this so my knowledge is super limited.
This is everything I have on my Database setup. I just switched to a new host that uses CPanel so still learning where all the info is listed. I hope this answers your question about my database.
Server: Localhost via UNIX socket
Server version: 5.1.56-log
Protocol version: 10
User: guildwar@localhost
MySQL charset: UTF-8 Unicode (utf8)
Web server
cpsrvd 11.30.4.6
MySQL client version: 5.1.56
PHP extension: mysql