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

[eluser]WanWizard[/eluser]
@Ikkes,

Which version of Datamapper? I have a comment line on Line Number: 645.

[eluser]WanWizard[/eluser]
@North2Alaska,

That sounds like the same (kind of) issue as @Ikkes.

Can you (both?) add a method to your model called post_model_init(), and in that method do a
Code:
var_dump(get_object_vars($this);
to make sure that your class properties aren't overwritten for some reason...

[eluser]Ikkes[/eluser]
@WanWizard

The version I use is 1.8.2.

On line 645 in application/libraries/datamapper.php I have the following text:
Code:
// Get and store the table's field names and meta data
$fields = $this->db->field_data($this->table);

With kind regards,
Dennis

[eluser]Maglok[/eluser]
[quote author="WanWizard" date="1331854807"]@Maglok,

Datamapper is about relations, it can't produce data in a relation that is not related. Wink

The best option is probably to retrieve all hobbies, and retrieve the person including it's related hobbies. Then iterate over the hobbies, and check if the id exists as a key in persons->hobbies->all. If so, that hobby is related, and if not, well...[/quote]

That is a good guideline, DM being about relations. Anyway that is how I fixed it indeed. Thanks!

[eluser]WanWizard[/eluser]
@Ikkes,

Please download the latest one (https://bitbucket.org/wanwizard/datamapper/get/tip.zip) and install it, so we're looking at the same code.

Just tried it here with the latest code from bitbucket, which loads the set database name without problems (and generates an "invalid database group" error when I use an undefined name).

[eluser]North2Alaska[/eluser]
@WanWizard I've simplified the model down to nothing.

class User extends DataMapper {

var $prefix = 'auth_';

public function post_model_init() {
var_dump(get_object_vars($this));

}
}

and the controller

class Users extends CI_Controller {

function index() {

$u = new User();
$u->where('username', 'North2Alaska')->get();

echo 'Email: ' . $u->email . '<br />';
}
}

Still no change.

[eluser]North2Alaska[/eluser]
@WanWizard

I can set the table name like

var $table = 'auth_users';

and that works.

When I finally got that to work I also got the var_dump output. The prefix was empty.

[eluser]North2Alaska[/eluser]
@WanWizard

Another interesting tidbit, the model template model has no mention of prefix in it. It probably doesn't really mean anything as it's only a example, but it is pretty detailed in what can be in the model.

[eluser]WanWizard[/eluser]
I can not reproduce it here, if I set a prefix in an existing model it immediately complains it can't find the table, and gives the table name with the prefix.

Which leads me to believe that you're not using the latest version of the code.

So the same advice as to @Ikkes: Please download the latest version (https://bitbucket.org/wanwizard/datamapper/get/tip.zip) and upgrade your installation.

[eluser]North2Alaska[/eluser]
@WanWizard

I'll do that and let you know.

BTW: I was out looking at the 2.0 version but nothing has change for a few months. Is progress still being made? I'm going to be doing a lot of DM and would like to contribute in some way.




Theme © iAndrew 2016 - Forum software by © MyBB