Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord for CodeIgniter: Rails-style model interactions
#41

[eluser]ralf57[/eluser]
[quote author="sophistry" date="1190687940"]@ralf57 - i have to agree with walesmd. i've been using CI Active Record for a year now and it's just great for most everything.

but, this class is an advancement I was ready to make - i am just lazy about writing lots of redundant code.
[/quote]

Thank you sophistry,
i'm evaluating this custom ActiveRecord implementation to solve a limitation of CI Active Record.
I'm going to explain:
the
Code:
$this->db->insert('mytable', $data);
method accepts an array
Code:
$data = array(
    'title' => 'My title' ,
    'name' => 'My Name' ,
    'date' => 'My date'
);
as the second parameter so it can produce
Code:
INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
but it doesn't take care of binding the table fields with the array keys so, if you pass the array in a different order it will insert the values in the wrong fields (for example "My title" into "name" field).
This was pushing me to find a solution in this custom class.
Can this issue solved with the built-in CI ActiveRecord class?


Messages In This Thread
ActiveRecord for CodeIgniter: Rails-style model interactions - by El Forum - 10-03-2007, 01:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB