With the holidays over we have been getting ready to upgrade our
production systems to 1.1.12.  Now with '13 out the pressure is on.
>From reading this list there are still many on 1.1.10 or even
earlier.  Here is one way we have reduced our workload and code
complexity.  I do not like littering the 'uses' array with unnecessary
models and it defeats the lazy loading if you only need a model in
some circumstance.

In AppController:
        function & constructModel($modelname) {
                if (!class_exists($modelname)) {
                        loadModel($modelname);
                }
                $m = new $modelname();
                return $m;
        }
        function usesModel($modelname) {
                if ( !isset($this->{$modelname})) {
                        if (!class_exists($modelname)) {
                                loadModel($modelname);
                        }
                        $this->{$modelname} = new $modelname();
                }
        }

Then in the code I use constructModel like
  $auser = $this->contructModel('User');  // instead of $auser = new
User();
or
 $this->usesModel('User'); // instead of  $this->User = new User();


David Lloyd
--
Lloydhome Consulting, Inc.
http://www.lloydhome.com


On Feb 5, 3:31 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 2/5/07, cdomigan <[EMAIL PROTECTED]> wrote:
>
> > One question I have is what is the easiest way to upgrade to the
> > latest version. Can I just copy my whole app folder across? Or do I
> > need to just copy the user files I have created?
>
> Just rename the old cake folder and upload a new cake folder - try out
> if everything works and then delete the renamed old cake folder - you
> need not touch your app
>
> Cheers
> Tarique.
>
> P.S. In most cases everything works as supposed to :)
>
> --
> =============================================================
> PHP for E-Biz:http://sanisoft.com
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> =============================================================


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to