Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve fields in the model #203

Open
bereldhuin opened this issue May 14, 2015 · 1 comment
Open

Retrieve fields in the model #203

bereldhuin opened this issue May 14, 2015 · 1 comment

Comments

@bereldhuin
Copy link

Hi,

I'm currently testing your model and it does a great job. :-)
However, there is something I don't understand : it seems that we cannot retrieve fields value after a get() directly in the model, as it's the case with most framework's models I tried.

For example, if I define a model like this :

Class Blog_model extends My_Model {

public $title = '';
public $content = '';

}

In my controller, if I call $this->blog->get(3), I can't retrieve $this->blog->title

I have to do $blog = $this->blog->get(4) to be able to get $blog->title

And this should be the same for updates or insert which should use the properties of the object.

Is this a normal behaviour or did I miss something ?
Maybe I could try triggers to set the properties with after_get and before_update.

Regards,

Fred

@michail1982
Copy link

@fred9176 this is not а datamapper
hovever you can use after_get callback to modify query result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants