Monday, February 2, 2009

Re: loading cake into code

Any way from outside the cake system?

Or any way to make the App::import function available in my existing
code?

On Feb 2, 8:04 pm, Miles J <mileswjohn...@gmail.com> wrote:
> App::import('Model', 'ModelName');
> $model = new ModelName();
>
> But that would only work within the cake system itself.
>
> On Feb 1, 8:20 pm,bwragg<benjamin.wr...@gmail.com> wrote:
>
>
>
> > Hi all,
>
> > We have some code written in an existing app and will be migrating it
> > to cake in the future but for step 1 of the migration we need to start
> > using cake's model functionality.
>
> > So is it possible to load cake into the existing php code via an
> > include() to get access to just the model functionality and not the
> > controller and view functionality? For example how can I do something
> > like :
>
> > //existing applicataion code
> > include('load_cake.php');
> > $m=new model_in_cakes_model_dir();
> > //...use model as normally would in cake
> > $m->findAll();
> > //change $m to have different values
> > $m->save();
>
> > Thanks.
>
> >bwragg- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: