http://bakery.cakephp.org/articles/view/243
On Apr 12, 6:44 am, "AD7six" <[EMAIL PROTECTED]> wrote: > On 10 abr, 15:48, "cherrio" <[EMAIL PROTECTED]> wrote: > > > > > Hey All, > > > a question about persistent data. I was using a Config method that I > > got from the old Wiki, but when I upgraded to 1.1.14.4797 this broke. > > So I checked the Bakery again and found > > thishttp://bakery.cakephp.org/articles/view/61, > > having trouble getting this one working too. But both (the old and new > > method) have the same problem I think, namely for each configuration/ > > setting lookup it has to query the database. > > > So I am trying to roll my own (or can some one suggest an > > alternative?) that has the following features I want, > > > 1. One static instance, available to all controllers > > > 2. Lazy instantiation of database connection, i.e. when the first > > get($key) called > > > 3. When it is instantiated it should select all key/value pairs from > > the database and store them in an associative array > > > 4. when the second and subsequent get($key) function call occurs, > > should return the value from the associative array rather than DB > > lookup > > > 5. Have a method called set($key, $value), that updates the > > associative array and possible the database (depending on where/how db > > is updated). > > What does the bakery article not tick off your list? > > Regarding point 1 you would just want to create an init method which > you would call as the first line of your read/write method to do "if > there is not instance loadModel('Setting'); $this->Instance = new > Setting(); etc. > > If you make the change to 1.2, I think the Configure:: class will > probably do most if not all of what you want. > > hth, > > AD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
