Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM v1.8.2

[eluser]coldscooter[/eluser]
This is causing problems when extending MY_Model. It no longer finds the class MY_Model.

I believe this is being caused by the bootstrapping.

Any advice on how to deal with this?

[eluser]WanWizard[/eluser]
What is "this"?

[eluser]coldscooter[/eluser]
When I add DataMapper to auto-load in autoload.php, my models can no longer extend from MY_Model. Just says "class not found".

[eluser]coldscooter[/eluser]
Is there a way of returning just the result set, without all the other DataMapper related stuff?

[eluser]WanWizard[/eluser]
[quote author="coldscooter" date="1337020584"]When I add DataMapper to auto-load in autoload.php, my models can no longer extend from MY_Model. Just says "class not found". [/quote]
Datamapper doesn't do anything with models or loading models, it uses it's own autoloader for models.

I wouldn't know why it wouldn't work, assuming you load the model using $this->load->model().

[eluser]WanWizard[/eluser]
[quote author="coldscooter" date="1337023181"]Is there a way of returning just the result set, without all the other DataMapper related stuff?[/quote]
No.

[eluser]coldscooter[/eluser]
Is there a way of catching a failed db call with DataMapper?

So if I went:

$u = new User();
$u->where(array('name'=>'testname'));
$u->get();

If there was no field 'name' in that table, id like to be able to handle it without getting a fatal db error.

[eluser]WanWizard[/eluser]
No,

Datamapper uses CI's active record libary underneath, and CI just aborts when an error is detected. It doesn't throw exceptions that can be caught.

But you can check before running the query, every Datamapper object contains a property $fields, which contains all columns of the objects' table.

Code:
$u = new User();
if (in_array('name', $u->fields))
{
    $u->where(array(‘name’=>‘testname’));
}
else
{
    // column does not exist
}
$u->get();

[eluser]coldscooter[/eluser]
If i set up a relationship in one model (lets say users relates to access_logs), can I then create new records in access_logs through the User model, without having a model for access_logs?

[eluser]coldscooter[/eluser]
Can i set up a relationship without having a separate relationship table?




Theme © iAndrew 2016 - Forum software by © MyBB