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

[eluser]beemr[/eluser]
OK, so I just tried it, and the Model remained intact. I didn't verify whether or not a library would get squashed, but it was the "name" thing that really brought fear.

I already had a model named "role" with a column "name", so I added this model:
Code:
<?php
class Name extends ActiveRecord
{
    function __construct ()
    {
        parent::ActiveRecord();
    }
    
    function check()
    {
        die("I die, yet I live");
    }

}
?>

And this library:
Code:
function collision()
    {
        $this->load->model("role");
        $this->load->model("name");
        $this->role->set_values(array('id'=>1,'name'=>'vegetable'));
        $this->role->update();
        echo ($this->name);
        $this->name->check();
    }

The result: The Model function dies as expected, and my table has the value "vegetable" inserted at id position 1. Before it dies, it also produces the error:
A PHP Error was encountered

Severity: 4096

Message: Object of class Name could not be converted to string

Filename: controllers/welcome.php

Line Number: 71

So, I think external Model namespaces are preserved safely. Whew!


Messages In This Thread
ActiveRecord for CodeIgniter: Rails-style model interactions - by El Forum - 03-29-2008, 08:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB