Hrm, using this it works:
$this->User->read(null, $this->params['named']['user_id']);
$this->User->getIni();
But I often wondered why CakePHP relies on this "proxy" or something
for its models? It seems I always have to communicate through
$this->Modelname when doing stuff with models, is it creating,
viewing, updating or deleting. Why is that? Why don't I work with
"real" dedicated objects? I guess there's a good reason (and I think
it's because of PHP, because in Ruby on Rails this is done quite more
elegant as far as I remember), but I couldn't find it yet.
On Wed, Oct 27, 2010 at 1:53 PM, psybear83 <[email protected]> wrote:
> Hi everybody
>
> This seems pretty basic, but I just don't get it to work...
>
> I have a model User with a method:
>
> function getIni() {
> return "some INI stuff";
> }
>
> Then I have an action downloadIni() in UsersController:
>
> function downloadIni() {
> // ...
> $user = $this->User->find($this->params['named']['user_id']);
> $user->getIni();
> // ...
> }
>
> However, because find() actually doesn't return a User model instance
> (but an array), this doesn't work. But sadly I just didn't find a way
> to get a model instance from $this->User...
>
> I found this:
> http://debuggable.com/posts/how-to-properly-create-a-model-instance-manually:480f4dd6-4424-4c89-9564-4647cbdd56cb
> But this seems to be outdated...
>
> Thanks for help!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en