Re: Use model inside helper

2008-07-01 Thread b logica
You'd be better off adding a new field to the User data array with the concatenated names in afterFind(). Or, use the Autofield behavior: http://cakeexplorer.wordpress.com/category/model/ Sorry for not addressing your original query. On Mon, Jun 30, 2008 at 5:30 PM, Mike <[EMAIL PROTECTED]> wrot

Re: Use model inside helper

2008-06-30 Thread Mike
I've got a quick question about this - Let's say I have a Model for User, which has a firstname and lastname. Let's say that I want a method that will take data for an instance of hte model, and produce a full name (i.e., return $data['User']['firstname'] .' '. $data['User']['lastname'];, more-o

Re: Use model inside helper

2008-05-13 Thread [EMAIL PROTECTED]
If I use & ClassRegistry::getInstance(); in the helper the model is present. If I use $Model=& ClassRegistry::getObject('ModelName'); I get that $Model =null On 13 Mag, 10:17, grigri <[EMAIL PROTECTED]> wrote: > > Only it works for some model and for other it doesn't work. > > Why? > > It will on

Re: Use model inside helper

2008-05-13 Thread grigri
> Only it works for some model and for other it doesn't work. > Why? It will only work for models that are already loaded and registered. If you need a model that hasn't been loaded, you'll have to use App::import() to load it first. --~--~-~--~~~---~--~~ You rece

Re: Use model inside helper

2008-05-13 Thread [EMAIL PROTECTED]
I use this in my helper > > in yourhelper: > > function something() { >   $Model=& ClassRegistry::getObject('ModelName'); > > Only it works for some model and for other it doesn't work. Why? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Use model inside helper

2008-05-02 Thread grigri
> In a word, no. Controller sends the data prepared by your model to the > view where your helper can access it. Hmm... I'd have to disagree there. With regards to data [the four horsemen CRUD], I totally agree - you should not do this in a helper. On the other hand, model/schema inspection is

Re: Use model inside helper

2008-05-02 Thread Sliv
In a word, no. Controller sends the data prepared by your model to the view where your helper can access it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-

Use model inside helper

2008-05-02 Thread [EMAIL PROTECTED]
I have a question. Is it correct in MVC use a model inside a helper. If yes how can I do that? Many Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php