cake bake doesn't find new tables

2008-09-30 Thread Kenchu

I use cake bake to generate all my controllers, views and models.
Unfortunatelyl cake bake doesn't seem to realize the changes I make in
my database anymore. I've added a couple of more tables, but when I
try to bake some new models, they aren't even in the list of models.
Only the old tables are. I've checked the database configuration
multiple times and cannot see anything that would suggest why cake is
acting this way.

database.php

class DATABASE_CONFIG {

var $default = array(
'driver' = 'mysql',
'persistent' = false,
'host' = 'localhost',
'login' = 'root',
'password' = '',
'database' = 'mydb',
'prefix' = '',
);
}

If I do this in the command prompt:

mysql  (password and user details) ENTER
use mydb; ENTER
show tables; ENTER

I get this:

+-+
| Tables_in_mydb  |
+-+
| adresses|
| bankaccounts|
| banks   |
| cars|
| categories  |
| comments|
| countries   |
| orders  |
| orders_products |
| products|
| searches|
| users   |
+-+
12 rows in set (0.00 sec)

Using cake bake I get these:

Possible Models based on your current database:
1. Bankaccount
2. Bank
3. Category
4. Comment
5. Country
6. Order
7. OrdersProduct
8. Product
9. Search
10. User

Cars and adresses are new tables. Both of them are not present in the
list. Any ideas what's wrong here?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cake bake doesn't find new tables

2008-09-30 Thread Kenchu

Thank you. Works excellent now. :)

On Sep 30, 3:05 pm, Markus Muschol [EMAIL PROTECTED]
wrote:
 You have to clean the cache.
 Delete all files in tmp/cache/models.

 Best Regards

 Am 30.09.2008 um 14:54 schrieb Kenchu:



  I use cake bake to generate all my controllers, views and models.
  Unfortunatelyl cake bake doesn't seem to realize the changes I make in
  my database anymore. I've added a couple of more tables, but when I
  try to bake some new models, they aren't even in the list of models.
  Only the old tables are. I've checked the database configuration
  multiple times and cannot see anything that would suggest why cake is
  acting this way.

  database.php

  class DATABASE_CONFIG {

     var $default = array(
             'driver' = 'mysql',
             'persistent' = false,
             'host' = 'localhost',
             'login' = 'root',
             'password' = '',
             'database' = 'mydb',
             'prefix' = '',
     );
  }

  If I do this in the command prompt:

  mysql  (password and user details) ENTER
  use mydb; ENTER
  show tables; ENTER

  I get this:

  +-+
  | Tables_in_mydb  |
  +-+
  | adresses        |
  | bankaccounts    |
  | banks           |
  | cars            |
  | categories      |
  | comments        |
  | countries       |
  | orders          |
  | orders_products |
  | products        |
  | searches        |
  | users           |
  +-+
  12 rows in set (0.00 sec)

  Using cake bake I get these:

  Possible Models based on your current database:
  1. Bankaccount
  2. Bank
  3. Category
  4. Comment
  5. Country
  6. Order
  7. OrdersProduct
  8. Product
  9. Search
  10. User

  Cars and adresses are new tables. Both of them are not present in the
  list. Any ideas what's wrong here?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with reading cookie

2008-09-22 Thread Kenchu

Nice. :)
I also commented those pages in the docs...

On Sep 21, 6:45 pm, villas [EMAIL PROTECTED] wrote:
 Yes,  you are right about that introduction; that section seems to be
 out of date when compared to the API:

 http://api.cakephp.org/cookie_8php-source.html

 I have now submitted an update for that section of the Book so that
 others will not be so confused. Hopefully it will appear soon once it
 has been reviewed.

 On Sep 20, 8:50 pm, Kenchu [EMAIL PROTECTED] wrote:

  Actually, none of the properties seem to work, atleast not for me.
  Name and key (apart from time) do not work. Setting them directly in
  beforeFilter works though.

  On Sep 20, 9:41 pm, Kenchu [EMAIL PROTECTED] wrote:

   I dont see the point of having a page where they show how to set
   properties in the controller if they dont work. As you said, I did not
   use the long version of the write command, since it said on the page
   before how to set it up using properties.

   On Sep 20, 6:30 pm, villas [EMAIL PROTECTED] wrote:

Before you criticise,  are you sure that you read and tried what it
said in the docs?

Example given in the docs is:
$this-Cookie-write('last_name', 'Masters', false, '1 hour');

Therefore you should be able to do this:
$this-Cookie-write('cart', array(124,1232,3232), false, '1 hour');

From your question,  it does not seem that you tried that code.
However,  if you really did find a 'better way',  please make a
comment in the docs to help the next guy.

Best wishes.

On Sep 20, 2:05 pm, Kenchu [EMAIL PROTECTED] wrote:

 Thanks! Works perfect now. Though I think it's bad they dont say this
 in the documentation.

 On Sep 20, 11:42 am, Yodi Aditya [EMAIL PROTECTED] wrote:

  Try using :
  function beforeFilter() {
      $this-Cookie-time = '5 Days';
      $this-Cookie-path = '/';

  }

  On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:

   I've managed to get cookies working for the session, but if I 
   restart
   my browser, the cookies seem to be gone, and $cookieTime doesn't 
   seem
   to do anything about it. This is the code I've got:

   ___

   [...]

           var $cookieName = 'my.cookie';
           var $cookieTime = 3600;
           var $cookieKey = '***';

           function index() {
   //              $this-Cookie-write('cart', 
   array(124,1232,3232));
                   pr($this-Cookie-read('cart'));
           }

   [...]

   ___

   So what I do is uncomment the cookie-write-line, run the script, 
   then
   comment the line again, and then run the script once more. Now if 
   you
   DONT turn off the browser, you will see the array being printed.
   However, if I restart the page and visit it again, nothing will be
   printed.

   Help plz. :D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with reading cookie

2008-09-20 Thread Kenchu

Thanks! Works perfect now. Though I think it's bad they dont say this
in the documentation.

On Sep 20, 11:42 am, Yodi Aditya [EMAIL PROTECTED] wrote:
 Try using :
 function beforeFilter() {
     $this-Cookie-time = '5 Days';
     $this-Cookie-path = '/';

 }

 On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:



  I've managed to get cookies working for the session, but if I restart
  my browser, the cookies seem to be gone, and $cookieTime doesn't seem
  to do anything about it. This is the code I've got:

  ___

  [...]

          var $cookieName = 'my.cookie';
          var $cookieTime = 3600;
          var $cookieKey = '***';

          function index() {
  //              $this-Cookie-write('cart', array(124,1232,3232));
                  pr($this-Cookie-read('cart'));
          }

  [...]

  ___

  So what I do is uncomment the cookie-write-line, run the script, then
  comment the line again, and then run the script once more. Now if you
  DONT turn off the browser, you will see the array being printed.
  However, if I restart the page and visit it again, nothing will be
  printed.

  Help plz. :D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with reading cookie

2008-09-20 Thread Kenchu

I dont see the point of having a page where they show how to set
properties in the controller if they dont work. As you said, I did not
use the long version of the write command, since it said on the page
before how to set it up using properties.

On Sep 20, 6:30 pm, villas [EMAIL PROTECTED] wrote:
 Before you criticise,  are you sure that you read and tried what it
 said in the docs?

 Example given in the docs is:
 $this-Cookie-write('last_name', 'Masters', false, '1 hour');

 Therefore you should be able to do this:
 $this-Cookie-write('cart', array(124,1232,3232), false, '1 hour');

 From your question,  it does not seem that you tried that code.
 However,  if you really did find a 'better way',  please make a
 comment in the docs to help the next guy.

 Best wishes.

 On Sep 20, 2:05 pm, Kenchu [EMAIL PROTECTED] wrote:

  Thanks! Works perfect now. Though I think it's bad they dont say this
  in the documentation.

  On Sep 20, 11:42 am, Yodi Aditya [EMAIL PROTECTED] wrote:

   Try using :
   function beforeFilter() {
       $this-Cookie-time = '5 Days';
       $this-Cookie-path = '/';

   }

   On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:

I've managed to get cookies working for the session, but if I restart
my browser, the cookies seem to be gone, and $cookieTime doesn't seem
to do anything about it. This is the code I've got:

___

[...]

        var $cookieName = 'my.cookie';
        var $cookieTime = 3600;
        var $cookieKey = '***';

        function index() {
//              $this-Cookie-write('cart', array(124,1232,3232));
                pr($this-Cookie-read('cart'));
        }

[...]

___

So what I do is uncomment the cookie-write-line, run the script, then
comment the line again, and then run the script once more. Now if you
DONT turn off the browser, you will see the array being printed.
However, if I restart the page and visit it again, nothing will be
printed.

Help plz. :D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with reading cookie

2008-09-20 Thread Kenchu

Actually, none of the properties seem to work, atleast not for me.
Name and key (apart from time) do not work. Setting them directly in
beforeFilter works though.

On Sep 20, 9:41 pm, Kenchu [EMAIL PROTECTED] wrote:
 I dont see the point of having a page where they show how to set
 properties in the controller if they dont work. As you said, I did not
 use the long version of the write command, since it said on the page
 before how to set it up using properties.

 On Sep 20, 6:30 pm, villas [EMAIL PROTECTED] wrote:

  Before you criticise,  are you sure that you read and tried what it
  said in the docs?

  Example given in the docs is:
  $this-Cookie-write('last_name', 'Masters', false, '1 hour');

  Therefore you should be able to do this:
  $this-Cookie-write('cart', array(124,1232,3232), false, '1 hour');

  From your question,  it does not seem that you tried that code.
  However,  if you really did find a 'better way',  please make a
  comment in the docs to help the next guy.

  Best wishes.

  On Sep 20, 2:05 pm, Kenchu [EMAIL PROTECTED] wrote:

   Thanks! Works perfect now. Though I think it's bad they dont say this
   in the documentation.

   On Sep 20, 11:42 am, Yodi Aditya [EMAIL PROTECTED] wrote:

Try using :
function beforeFilter() {
    $this-Cookie-time = '5 Days';
    $this-Cookie-path = '/';

}

On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:

 I've managed to get cookies working for the session, but if I restart
 my browser, the cookies seem to be gone, and $cookieTime doesn't seem
 to do anything about it. This is the code I've got:

 ___

 [...]

         var $cookieName = 'my.cookie';
         var $cookieTime = 3600;
         var $cookieKey = '***';

         function index() {
 //              $this-Cookie-write('cart', array(124,1232,3232));
                 pr($this-Cookie-read('cart'));
         }

 [...]

 ___

 So what I do is uncomment the cookie-write-line, run the script, then
 comment the line again, and then run the script once more. Now if you
 DONT turn off the browser, you will see the array being printed.
 However, if I restart the page and visit it again, nothing will be
 printed.

 Help plz. :D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with reading cookie

2008-09-19 Thread Kenchu

I've managed to get cookies working for the session, but if I restart
my browser, the cookies seem to be gone, and $cookieTime doesn't seem
to do anything about it. This is the code I've got:

___

[...]

var $cookieName = 'my.cookie';
var $cookieTime = 3600;
var $cookieKey = '***';

function index() {
//  $this-Cookie-write('cart', array(124,1232,3232));
pr($this-Cookie-read('cart'));
}

[...]

___

So what I do is uncomment the cookie-write-line, run the script, then
comment the line again, and then run the script once more. Now if you
DONT turn off the browser, you will see the array being printed.
However, if I restart the page and visit it again, nothing will be
printed.

Help plz. :D
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching doesnt work for some actions

2008-09-14 Thread Kenchu

Okay, this is REALLY weird. I tried copying the index action and its
view to another name. It seems like unless the name of the action is
'index', the caching will not work. Again, the actions I have are
IDENTICAL. The only thing that is different is the name.

HOWEVER. If you change the $cacheAction to a string instead (so it is
the same for all actions, i.e. $cacheAction = '1 hour' for example),
then it DOES work. wtf?

On Sep 13, 12:48 pm, Kenchu [EMAIL PROTECTED] wrote:
 I've got this code:

         var $helpers = array('Cache');
         var $cacheAction = array
         (
                 'index' = '+1 hour',
                 'view' = '+1 hour'
         );

 [...]

         function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Invalid Post.', true));
                         $this-redirect(array('action'='index'));
                 }
                 $this-set('post', $this-Post-read(null, $id));
         }

         function index() {
                 $data = $this-Post-findAll();
         $this-set('posts', $data);
         }

 Caching for the index works, but the queries for the view action will
 always be makde. Why? I've tried changing $cacheAction to view slash
 (/) instead, but that didnt do any difference. Fact is, if I did it
 for the index, index caching wouldnt work either at all.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching help

2008-09-13 Thread Kenchu

I found this and it works excellent.

http://bakery.cakephp.org/articles/view/icache-true-query-caching

On Sep 12, 3:30 pm, Kenchu [EMAIL PROTECTED] wrote:
 Thanks!

 But what about caching for longer periods, w/o updating? Because as of
 now, if you update a table, then the queries will be remade. I just
 want 1 query to occur once each day for a specific thing..

 On Sep 10, 10:53 am, Dave J [EMAIL PROTECTED] wrote:

  Hi Kenchu,

  I'm almost sure this is a hack, but it's been working fine for me so
  far.

  If you want your variables to persist in the cached views, set them
  like this:

  $this-data['variableName'] = 'variableValue';

  You can have a look at the created cached files in the tmp directory
  to see what Cake is doing. At the very top, there's a list of
  variables which are persistent for that cache.

  On Sep 9, 2:27 pm, Kenchu [EMAIL PROTECTED] wrote:

  http://book.cakephp.org/view/347/Marking-N...ontent-in-Views

   In the link above they've got a cached page, but still within the
   cake:nocache tags they access a variable called $newProducts. How is
   that possible? I've been trying to use the $this-set([...]) function
   in the action, beforeFilter and in the __construct, but none of them
   worked. Neither the action im caching or beforeFilter would run. Why
   putting it in the construct didnt work I dont know.

   So how do you send data to a nocache tag within a cached page?

   I also wonder if it's possible to keep acachefor a whole day without
   it being updated, even though new posts and updates occur in the
   database. According to:

  http://book.cakephp.org/view/348/Clearing-the-Cache

   thecacheis cleared for this. I don't want it to be.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Caching doesnt work for some actions

2008-09-13 Thread Kenchu

I've got this code:

var $helpers = array('Cache');
var $cacheAction = array
(
'index' = '+1 hour',
'view' = '+1 hour'
);

[...]

function view($id = null) {
if (!$id) {
$this-Session-setFlash(__('Invalid Post.', true));
$this-redirect(array('action'='index'));
}
$this-set('post', $this-Post-read(null, $id));
}

function index() {
$data = $this-Post-findAll();
$this-set('posts', $data);
}

Caching for the index works, but the queries for the view action will
always be makde. Why? I've tried changing $cacheAction to view slash
(/) instead, but that didnt do any difference. Fact is, if I did it
for the index, index caching wouldnt work either at all.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching help

2008-09-12 Thread Kenchu

Thanks!

But what about caching for longer periods, w/o updating? Because as of
now, if you update a table, then the queries will be remade. I just
want 1 query to occur once each day for a specific thing..

On Sep 10, 10:53 am, Dave J [EMAIL PROTECTED] wrote:
 Hi Kenchu,

 I'm almost sure this is a hack, but it's been working fine for me so
 far.

 If you want your variables to persist in the cached views, set them
 like this:

 $this-data['variableName'] = 'variableValue';

 You can have a look at the created cached files in the tmp directory
 to see what Cake is doing. At the very top, there's a list of
 variables which are persistent for that cache.

 On Sep 9, 2:27 pm, Kenchu [EMAIL PROTECTED] wrote:

 http://book.cakephp.org/view/347/Marking-N...ontent-in-Views

  In the link above they've got a cached page, but still within the
  cake:nocache tags they access a variable called $newProducts. How is
  that possible? I've been trying to use the $this-set([...]) function
  in the action, beforeFilter and in the __construct, but none of them
  worked. Neither the action im caching or beforeFilter would run. Why
  putting it in the construct didnt work I dont know.

  So how do you send data to a nocache tag within a cached page?

  I also wonder if it's possible to keep acachefor a whole day without
  it being updated, even though new posts and updates occur in the
  database. According to:

 http://book.cakephp.org/view/348/Clearing-the-Cache

  thecacheis cleared for this. I don't want it to be.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Caching help

2008-09-09 Thread Kenchu

http://book.cakephp.org/view/347/Marking-N...ontent-in-Views

In the link above they've got a cached page, but still within the
cake:nocache tags they access a variable called $newProducts. How is
that possible? I've been trying to use the $this-set([...]) function
in the action, beforeFilter and in the __construct, but none of them
worked. Neither the action im caching or beforeFilter would run. Why
putting it in the construct didnt work I dont know.

So how do you send data to a nocache tag within a cached page?

I also wonder if it's possible to keep a cache for a whole day without
it being updated, even though new posts and updates occur in the
database. According to:

http://book.cakephp.org/view/348/Clearing-the-Cache

the cache is cleared for this. I don't want it to be.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: biggner of cake php

2008-09-09 Thread Kenchu



On Sep 9, 11:02 am, akhilesh [EMAIL PROTECTED] wrote:
 i am new for cake php and i want to learn cake can any one help me?

Id recommend buying a book. I couldnt make out any sense of the
tutorials I found online, but once I learnt some things from a book
(begining Beginning CakePHP From Novice to Professional 2008) stuff
got alot easier.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Controller w/o model?

2008-09-09 Thread Kenchu

Not all my pages (views) can be linked to a specific model/controller.
For example. Imagine a welcome-page of a game-site. On it you'll see
alot of different things, not only connected to a single table. It
might show some news, some popular forum posts, as well as a list of
logged in users. Now where would all the logic for this page be done?
In the users controller? In the forum-post controller? In the news
controller? None is really more fitting than any other. Sure I
supposed you COULD just decide to do everything in, lets say, the news
controller in the action 'home', where you submit custom queries to
the database, but that doesn't seem like a good solution. It doesn't
look nice from a system modelling point of view.

So how would you tackle this problem?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller w/o model?

2008-09-09 Thread Kenchu

I think I just got an answer for my own question. Looking at the pages
controller, all you really need to do is make a new controller, set
its $uses property to an emtpy array, and then in its action use $this-
render('whatviewtouse.ctp');



On Sep 10, 2:27 am, Kenchu [EMAIL PROTECTED] wrote:
 Not all my pages (views) can be linked to a specific model/controller.
 For example. Imagine a welcome-page of a game-site. On it you'll see
 alot of different things, not only connected to a single table. It
 might show some news, some popular forum posts, as well as a list of
 logged in users. Now where would all the logic for this page be done?
 In the users controller? In the forum-post controller? In the news
 controller? None is really more fitting than any other. Sure I
 supposed you COULD just decide to do everything in, lets say, the news
 controller in the action 'home', where you submit custom queries to
 the database, but that doesn't seem like a good solution. It doesn't
 look nice from a system modelling point of view.

 So how would you tackle this problem?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---