Re: Auth component question

2011-02-20 Thread Jeremy Burns | Class Outfit
And the tables contain the same data?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Feb 2011, at 07:46, Tapan Kumar Thapa wrote:

> Yes DB structure,code and model files are identical.
> 
> From Development: (Fetched from mysql yog)
> 
> CREATE TABLE `users` (
>`id` int(10) NOT NULL AUTO_INCREMENT,
>`username` varchar(40) NOT NULL,
>`password` varchar(40) NOT NULL,
>`email` varchar(255) NOT NULL,
>`first_name` varchar(40) NOT NULL,
>`last_name` varchar(40) NOT NULL,
>`created` datetime DEFAULT NULL,
>`modified` datetime DEFAULT NULL,
>PRIMARY KEY (`id`),
>UNIQUE KEY `username` (`username`,`email`)
>  ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
> 
> From QA: (fetched from cli)
> 
> mysql> show create table users;
> +---+---+
> | Table | Create Table
>   
>   
>   
>   
>   |
> +---+---+
> | users | CREATE TABLE `users` (
>   `id` int(10) NOT NULL auto_increment,
>   `username` varchar(40) NOT NULL,
>   `password` varchar(40) NOT NULL,
>   `email` varchar(255) NOT NULL,
>   `first_name` varchar(40) NOT NULL,
>   `last_name` varchar(40) NOT NULL,
>   `created` datetime default NULL,
>   `modified` datetime default NULL,
>   PRIMARY KEY  (`id`),
>   UNIQUE KEY `username` (`username`,`email`)
> ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 |
> +---+---+
> 1 row in set (0.00 sec)
> 
> mysql>
> 
> Please suggest.
> 
> Regards
> Tapan Thapa
> 
> On Mon, Feb 21, 2011 at 1:11 PM, Jeremy Burns | Class Outfit 
>  wrote:
> Then your value is not being set in the session and you won't be able to 
> retrieve it. Are you database structures the same? Have you changed anything 
> to do with your User model? Are the code sets identical?
> 
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
> 
> On 21 Feb 2011, at 07:39, Tapan Kumar Thapa wrote:
> 
>> Please find the debug info from development machine and QA machine.
>> 
>> Development:
>> Array
>> (
>> [id] => 1
>> [username] => khbk
>> [email] => k...@khbk.com
>> 
>> [first_name] => Mahuaa
>> [last_name] => Television
>> [created] => 
>> [modified] => 
>> )
>> QA:
>> Array
>> (
>> [username] => admin
>> [password] => suresh
>> 
>> )
>> 
>> Please suggest
>> 
>> Regards
>> Tapan Thapa
>> 
>> 
>> 
>> On Mon, Feb 21, 2011 at 1:07 PM, Jeremy Burns | Class Outfit 
>>  wrote:
>> What happens when you debug out the value of the auth session variables? Is 
>> the value there?
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> jeremybu...@classoutfit.com
>> http://www.classoutfit.com
>> 
>> On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:
>> 
>>> Unfortunately i am not getting any error but my view shows blank in case no 
>>> value retrieved from session for first_name. But if i change the code to 
>>> read username from session it start displaying in my view.
>>> 
>>> Please suggest.
>>> 
>>> Regards
>>> Tapan Thapa
>>> 
>>> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker 
>>>  wrote:
>>> will u please tell what error is coming out?
>>> 
>>> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>>>  wrote:
>>> > Hello Community,
>>> >
>>> > I am using auth component in my code and while retrieving first_name from
>>> > se

Re: Auth component question

2011-02-20 Thread Tapan Kumar Thapa
Yes DB structure,code and model files are identical.

>From Development: (Fetched from mysql yog)

CREATE TABLE `users` (
   `id` int(10) NOT NULL AUTO_INCREMENT,
   `username` varchar(40) NOT NULL,
   `password` varchar(40) NOT NULL,
   `email` varchar(255) NOT NULL,
   `first_name` varchar(40) NOT NULL,
   `last_name` varchar(40) NOT NULL,
   `created` datetime DEFAULT NULL,
   `modified` datetime DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `username` (`username`,`email`)
 ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1

>From QA: (fetched from cli)

mysql> show create table users;
+---+---+
| Table | Create
Table
|
+---+---+
| users | CREATE TABLE `users` (
  `id` int(10) NOT NULL auto_increment,
  `username` varchar(40) NOT NULL,
  `password` varchar(40) NOT NULL,
  `email` varchar(255) NOT NULL,
  `first_name` varchar(40) NOT NULL,
  `last_name` varchar(40) NOT NULL,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`,`email`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 |
+---+---+
1 row in set (0.00 sec)

mysql>

Please suggest.

Regards
Tapan Thapa

On Mon, Feb 21, 2011 at 1:11 PM, Jeremy Burns | Class Outfit <
jeremybu...@classoutfit.com> wrote:

> Then your value is not being set in the session and you won't be able to
> retrieve it. Are you database structures the same? Have you changed anything
> to do with your User model? Are the code sets identical?
>
>
> Jeremy Burns
> *Class Outfit*
> *
> *
> jeremybu...@classoutfit.com 
> http://www.classoutfit.com
>
> On 21 Feb 2011, at 07:39, Tapan Kumar Thapa wrote:
>
> Please find the debug info from development machine and QA machine.
>
> Development:
>
> Array
> (
> [id] => 1
> [username] => khbk
> [email] => k...@khbk.com
>
> [first_name] => Mahuaa
> [last_name] => Television
> [created] =>
> [modified] =>
> )
>
> QA:
>
> Array
> (
> [username] => admin
> [password] => suresh
>
> )
>
> Please suggest
>
> Regards
> Tapan Thapa
>
>
>
> On Mon, Feb 21, 2011 at 1:07 PM, Jeremy Burns | Class Outfit <
> jeremybu...@classoutfit.com> wrote:
>
>> What happens when you debug out the value of the auth session variables?
>> Is the value there?
>>
>> Jeremy Burns
>> *Class Outfit*
>> *
>> *
>> jeremybu...@classoutfit.com 
>> http://www.classoutfit.com
>>
>> On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:
>>
>> Unfortunately i am not getting any error but my view shows blank in case
>> no value retrieved from session for first_name. But if i change the code to
>> read username from session it start displaying in my view.
>>
>> Please suggest.
>>
>> Regards
>> Tapan Thapa
>>
>> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker <
>> anandghaywankar...@gmail.com> wrote:
>>
>>> will u please tell what error is coming out?
>>>
>>> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>>>  wrote:
>>> > Hello Community,
>>> >
>>> > I am using auth component in my code and while retrieving first_name
>>> from
>>> > session ($this->Session->read('Auth.User.first_name')) on my
>>> development
>>> > machine(windows with wamp), it is working fine.
>>> >
>>> > However if deploying the same code on QA machine (linux with apache and
>>> php
>>> > separately), i am not able to get the first_name from session although
>>> i
>>> > have noticed if i am trying to retrieve username or password from
>>> session,
>>> > it is working.
>>> >
>>> > Working on QA - $this->Session->read('Auth.User.username')
>>> > Working on QA - $this->Session->read('Auth.User.password')
>>> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
>>> > $this->Session->read('A

Re: Auth component question

2011-02-20 Thread Jeremy Burns | Class Outfit
Then your value is not being set in the session and you won't be able to 
retrieve it. Are you database structures the same? Have you changed anything to 
do with your User model? Are the code sets identical?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Feb 2011, at 07:39, Tapan Kumar Thapa wrote:

> Please find the debug info from development machine and QA machine.
> 
> Development:
> Array
> (
> [id] => 1
> [username] => khbk
> [email] => k...@khbk.com
> 
> [first_name] => Mahuaa
> [last_name] => Television
> [created] => 
> [modified] => 
> )
> QA:
> Array
> (
> [username] => admin
> [password] => suresh
> 
> )
> 
> Please suggest
> 
> Regards
> Tapan Thapa
> 
> 
> 
> On Mon, Feb 21, 2011 at 1:07 PM, Jeremy Burns | Class Outfit 
>  wrote:
> What happens when you debug out the value of the auth session variables? Is 
> the value there?
> 
> Jeremy Burns
> Class Outfit
> 
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
> 
> On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:
> 
>> Unfortunately i am not getting any error but my view shows blank in case no 
>> value retrieved from session for first_name. But if i change the code to 
>> read username from session it start displaying in my view.
>> 
>> Please suggest.
>> 
>> Regards
>> Tapan Thapa
>> 
>> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker 
>>  wrote:
>> will u please tell what error is coming out?
>> 
>> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>>  wrote:
>> > Hello Community,
>> >
>> > I am using auth component in my code and while retrieving first_name from
>> > session ($this->Session->read('Auth.User.first_name')) on my development
>> > machine(windows with wamp), it is working fine.
>> >
>> > However if deploying the same code on QA machine (linux with apache and php
>> > separately), i am not able to get the first_name from session although i
>> > have noticed if i am trying to retrieve username or password from session,
>> > it is working.
>> >
>> > Working on QA - $this->Session->read('Auth.User.username')
>> > Working on QA - $this->Session->read('Auth.User.password')
>> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
>> > $this->Session->read('Auth.User.email')*
>> >
>> > Please suggest.
>> >
>> > Regards
>> > Tapan Thapa
>> > India
>> 
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>> 
>> 
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php
>> 
>> 
>> -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth component question

2011-02-20 Thread Tapan Kumar Thapa
Please find the debug info from development machine and QA machine.

Development:

Array
(
[id] => 1
[username] => khbk
[email] => k...@khbk.com
[first_name] => Mahuaa
[last_name] => Television
[created] =>
[modified] =>
)

QA:

Array
(
[username] => admin
[password] => suresh
)

Please suggest

Regards
Tapan Thapa



On Mon, Feb 21, 2011 at 1:07 PM, Jeremy Burns | Class Outfit <
jeremybu...@classoutfit.com> wrote:

> What happens when you debug out the value of the auth session variables? Is
> the value there?
>
> Jeremy Burns
> *Class Outfit*
> *
> *
> jeremybu...@classoutfit.com 
> http://www.classoutfit.com
>
> On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:
>
> Unfortunately i am not getting any error but my view shows blank in case no
> value retrieved from session for first_name. But if i change the code to
> read username from session it start displaying in my view.
>
> Please suggest.
>
> Regards
> Tapan Thapa
>
> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker <
> anandghaywankar...@gmail.com> wrote:
>
>> will u please tell what error is coming out?
>>
>> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>>  wrote:
>> > Hello Community,
>> >
>> > I am using auth component in my code and while retrieving first_name
>> from
>> > session ($this->Session->read('Auth.User.first_name')) on my development
>> > machine(windows with wamp), it is working fine.
>> >
>> > However if deploying the same code on QA machine (linux with apache and
>> php
>> > separately), i am not able to get the first_name from session although i
>> > have noticed if i am trying to retrieve username or password from
>> session,
>> > it is working.
>> >
>> > Working on QA - $this->Session->read('Auth.User.username')
>> > Working on QA - $this->Session->read('Auth.User.password')
>> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
>> > $this->Session->read('Auth.User.email')*
>> >
>> > Please suggest.
>> >
>> > Regards
>> > Tapan Thapa
>> > India
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth component question

2011-02-20 Thread Jeremy Burns | Class Outfit
What happens when you debug out the value of the auth session variables? Is the 
value there?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Feb 2011, at 07:34, Tapan Kumar Thapa wrote:

> Unfortunately i am not getting any error but my view shows blank in case no 
> value retrieved from session for first_name. But if i change the code to read 
> username from session it start displaying in my view.
> 
> Please suggest.
> 
> Regards
> Tapan Thapa
> 
> On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker 
>  wrote:
> will u please tell what error is coming out?
> 
> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>  wrote:
> > Hello Community,
> >
> > I am using auth component in my code and while retrieving first_name from
> > session ($this->Session->read('Auth.User.first_name')) on my development
> > machine(windows with wamp), it is working fine.
> >
> > However if deploying the same code on QA machine (linux with apache and php
> > separately), i am not able to get the first_name from session although i
> > have noticed if i am trying to retrieve username or password from session,
> > it is working.
> >
> > Working on QA - $this->Session->read('Auth.User.username')
> > Working on QA - $this->Session->read('Auth.User.password')
> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
> > $this->Session->read('Auth.User.email')*
> >
> > Please suggest.
> >
> > Regards
> > Tapan Thapa
> > India
> 
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth component question

2011-02-20 Thread Tapan Kumar Thapa
Unfortunately i am not getting any error but my view shows blank in case no
value retrieved from session for first_name. But if i change the code to
read username from session it start displaying in my view.

Please suggest.

Regards
Tapan Thapa

On Mon, Feb 21, 2011 at 12:52 PM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> will u please tell what error is coming out?
>
> On Feb 21, 12:12 pm, Tapan Kumar Thapa
>  wrote:
> > Hello Community,
> >
> > I am using auth component in my code and while retrieving first_name from
> > session ($this->Session->read('Auth.User.first_name')) on my development
> > machine(windows with wamp), it is working fine.
> >
> > However if deploying the same code on QA machine (linux with apache and
> php
> > separately), i am not able to get the first_name from session although i
> > have noticed if i am trying to retrieve username or password from
> session,
> > it is working.
> >
> > Working on QA - $this->Session->read('Auth.User.username')
> > Working on QA - $this->Session->read('Auth.User.password')
> > *Not working on QA - $this->Session->read('Auth.User.first_name) or
> > $this->Session->read('Auth.User.email')*
> >
> > Please suggest.
> >
> > Regards
> > Tapan Thapa
> > India
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth component question

2011-02-20 Thread andy_the ultimate baker
will u please tell what error is coming out?

On Feb 21, 12:12 pm, Tapan Kumar Thapa
 wrote:
> Hello Community,
>
> I am using auth component in my code and while retrieving first_name from
> session ($this->Session->read('Auth.User.first_name')) on my development
> machine(windows with wamp), it is working fine.
>
> However if deploying the same code on QA machine (linux with apache and php
> separately), i am not able to get the first_name from session although i
> have noticed if i am trying to retrieve username or password from session,
> it is working.
>
> Working on QA - $this->Session->read('Auth.User.username')
> Working on QA - $this->Session->read('Auth.User.password')
> *Not working on QA - $this->Session->read('Auth.User.first_name) or
> $this->Session->read('Auth.User.email')*
>
> Please suggest.
>
> Regards
> Tapan Thapa
> India

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Auth component question

2011-02-20 Thread Tapan Kumar Thapa
Hello Community,

I am using auth component in my code and while retrieving first_name from
session ($this->Session->read('Auth.User.first_name')) on my development
machine(windows with wamp), it is working fine.

However if deploying the same code on QA machine (linux with apache and php
separately), i am not able to get the first_name from session although i
have noticed if i am trying to retrieve username or password from session,
it is working.

Working on QA - $this->Session->read('Auth.User.username')
Working on QA - $this->Session->read('Auth.User.password')
*Not working on QA - $this->Session->read('Auth.User.first_name) or
$this->Session->read('Auth.User.email')*

Please suggest.

Regards
Tapan Thapa
India

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Fatal error: Call to undefined method CakeRoute::__set_state()

2011-02-20 Thread Jeremy Burns | Class Outfit
Hi John

I haven't yet, but will. The reason I didn't carry it through is because it is 
changing core Cake files. I am doing nothing special with cache, the page that 
throws the error is an extremely simple landing page, I have only seen this is 
one instance and it is only on my remote server (not my local one). I'm 
surprised that others as well as myself aren't plagued by this if it is indeed 
a core problem. Hence the reason I didn't leap right in and change core files; 
I was looking for a simpler explanation.

But I'll run this through now. Thanks.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 19 Feb 2011, at 22:17, John Andersen wrote:

> Hi Jeremy,
> 
> If the defect you refer to is the one at:
> http://cakephp.lighthouseapp.com/projects/42648/tickets/1486-cached-view-throws-an-undefined-method-cakeroute__set_state
> 
> then it has been resolved. Does the solution not work in your case?
> Enjoy,
>   John
> 
> On Feb 19, 9:20 pm, Jeremy Burns  wrote:
>> I upgraded site to 1.3.7, and am now getting this error:
>> 
>> Fatal error: Call to undefined method CakeRoute::__set_state() in
>> <[path]>/app/tmp/cache/views/<[filename.php]>  (<[path]> and
>> <[filename.php]> are the path to my app and one or more filenames in cache
>> that throw this error).
>> 
>> As you'd expect, it goes away when I stop reading from the cache.
>> 
>> A Google search throws up a defect in Lighthouse, but there isn't an obvious
>> fix.
>> 
>> Anyone got any ideas about a solution please?
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: having trouble with post on inherited cake project

2011-02-20 Thread cricket
On Sat, Feb 19, 2011 at 10:37 AM, Thomas  wrote:
> I have never used cake before but found myself thrust into it because
> a project I have inherited was developed using it. I must say I find
> it very inflexible as opposed to good old fashioned coding. I have a
> form where the developers used iterating keys in the form. What I want
> to do, and what I am accustomed to doing when the number of inputs is
> variable or unknown is something like this:  name=something[]/> where it just plugs my post into an array with the
> key undeclared. How do you guys bake (correct term?) into your
> projects? This is what I have now:
> echo $form->checkbox('OnsiteTrainingClass.select_class'.
> $i,array('id'=>'select'.$i,'label'=>'','value'=>
> $value['OnsiteTrainingClass']['id']));
>
> If I take the $i out of this it hoses everything up.


This is going to be long, but I figured it'd be best so you have maybe
a better idea what's going on under the hood.

Let's say we have two models, Thingy and Widget. Each Thingy is made
from one or more kinds of Widget. When creating a new Thingy, we
choose which kinds of Widgets to build it from, as well as how many of
each Kind.

To keep things simple, each of the tables has just id & name columns.

class Thingy extends AppModel
{
var $hasAndBelongsToMany = array('Widget');
var $hasMany = array('ThingiesWidget');
}

class Widget extends AppModel
{
var $hasAndBelongsToMany = array('Thingy');
var $hasMany = array('ThingiesWidget');
}

The $hasMany both of them have is the model for the join table,
thingies_widgets. Ordinarily, we wouldn't need to mention that
association, except that, along with the usual FK columns, it's going
to have a num_pieces column.

Baking views, you'll get the following for your add form:

echo $this->Form->input('name');
echo $this->Form->input('Widget');

FormHelper creates a multi-select list for Widget, using the name as
option and id as value.



I misspoke when I said that Cake doesn't use the name[] format. It
does use it, but YOU don't want to do so for what you're trying to do.
Because it won't give the correct format for the data.

Selecting a few Widgets from the list and submitting results in:

Array
(
[Thingy] => Array
(
[name] => foo
)

[Widget] => Array
(
[Widget] => Array
(
[0] => 2
[1] => 3
)
)
)

That's fine, but doesn't allow for setting the number of pieces. First
thing is to change the select list to a group of checkboxes:

echo $this->Form->select('Widget', $widgets, null, array('multiple' =>
'checkbox'));

giving:


etc.

Either way, $this->data will be formatted the same.

But we need text inputs matched up with each checkbox, so we have to
use a loop and create each checkbox/text input pair manually. Starting
with just the checkboxes:

foreach ($widgets as $key => $widget)
{
?>

Form->checkbox('Widget', array('value' => $key, 'id' =>
'Widget'.$key));
echo $widget;
?>




red




blue

etc.

Note that now we no longer have the empty [] in the name attributes.
If we selected a couple and submitted, $this->data would come in as:

Array
(
[Thingy] => Array
(
[name] => foo
)

[Widget] => Array
(
[Widget] => 0
)
)

Oops. We could instead do something like this:

foreach ($widgets as $key => $widget)
{
?>




 Array
(
[name] => foo
)

[Widget] => Array
(
[Widget] => Array
(
[0] => 2
[1] => 3
)
)
)


OK, back to where we were. But we want to save our data into the
thingies_widgets table using that $hasMany association. We can change
the loop to create the tags like so:



giving:


etc.

and:

Array
(
[Thingy] => Array
(
[name] => foo
)

[ThingiesWidget] => Array
(
[2] => 2
[3] => 3
)
)

Getting much closer. BTW, notice that the keys have changed. They're
no longer zero-based, but the same as the ids. That's doesn't matter,
because we'll be using saveAll(), and the keys can be arbitrary
(though unique). Have a look here:
http://api.cakephp.org/view_source/model/#line-1575

Under if (Set::numeric(array_keys($data))) { ... the $key is only used
to keep track of validation errors.

So, now we can use the same manual element technique, but include the
text field, and change the naming convention slightly to create a new
sub-array and keys.




giving:

Array
(
[Thingy] => Array
(
[name] => foo
)

[ThingiesWidget] => Array
(
[1] => Array
(
[num_pieces] =>
)

[2] => Array
 

Re: having trouble with post on inherited cake project

2011-02-20 Thread David Kullmann
Thomas:

I think 2 responses ago Cricket gave the best answer so far. Check out
this page on the CakePHP docs that shows how to create an input with
the "[]" modifier to the form name:

http://book.cakephp.org/view/1395/options-multiple

I know it can be frustrating inheriting a project and we have all been
there at one point or another. I can imaging it's even more
frustrating when it's a framework you don't haven't been accustom to
using. If you are going to spend more than 2-3 hours on this project
(and it sounds like you are) then here is how you can instantly make
yourself much more productive, and less frustrated:

1. Read the entire CakePHP Cook Book for your CakePHP version (1.1,
1.2, or 1.3) located at book.cakephp.org. It's a simple and easy read,
you'll breeze right through it.

2. Keep in mind there may be an improved method for trying to
accomplish something you used to have to do by hand in PHP. The built-
in form libraries really speed up development, however, it could be
very frustrating if you haven't been introduced to them before. Use
the book and API as a guide.

3. If you are stuck, email this list or go on IRC and we'll do our
best to help you out! You can always post large code snippets to
bin.cakephp.org (username is your IRC name, or whatever name you feel
like making up on the spot.)

4. If you are in NYC, join my CakePHP meetup group on Meetup.com =)

Regards,
David

On Feb 20, 12:10 am, cricket  wrote:
> On Sat, Feb 19, 2011 at 11:33 PM, Thomas  wrote:
> > Wow, not really sure what to say. The example you provided is pretty
> > much what I have now. I still have not gotten an answer. Can cake
> > dynamically create the post array key, again referencing this
> > example:?
> > 
> > Maybe none of you have seen this because it is not possible in cake.
>
> Maybe we're all idiots.
>
> The empty square brackets thing in form names is very well understood.
> The thing is, Cake doesn't use them.
>
> > But I would like a definitive answer from somebody.
>
> No kidding? And I thought people used this list to trade gossip.
>
> > Let me explain what my form is doing. I assume that the dilemma is not
> > understood. Basically there is a variable number of classes. The user
> > opts to register for the class using a checkbox and then indicates the
> > number of seats they wish to purchase. Now what I would love to know
> > is how in cake land the association between selected classes and
> > number of seats is made for the purpose of forming a query.
>
> > Remember the array will have 20 key/values if there are 20 classes
> > even if only 3 are selected. Then for the three how do you know the
> > proper key/value in the text (no seats) array?
>
> So you need to match up the class checkboxes with the no. of seats
> inputs. I'm still not seeing why you're so confused about the use of
> $i in a loop.
>
> BTW, have you tried looking at the submitted data? Set debug to 2 in
> core.php and:
>
> if (!empty($this-data))
> {
>     die(debug($this->data));
>
> You haven't, in fact, stated that there's an actual problem, aside
> from that the code isn't written the way you're used to.
>
> > I think in cake that is called a controller.
>
> A controller is a class. It's what handles a typical request. Perhaps
> you meant that the key/values are handed to the controller? That is
> correct.
>
> > I would like someone to
> > write a routine to accomplish this without reqiring a bunch of string
> > manipulation.
>
> http://www.catb.org/~esr/faqs/smart-questions.html
>
> > Has anyone here developed anything not using cake?
>
> I won't be offended by that because 1) I realise that nobody had
> clairified why the name[] notation isn't used in Cake; and, 2) with
> some of the *other* questions that have been posted here lately, it's
> looking like an awful lot of people *do* jump into Cake without any
> programming experience at all. ;-)
>
> You still haven't posted:
> a) the loop code
> b) a description of the models involved and their associations
>
> Perhaps we can get this straightened out for you. Meanwhile, try not
> to be so hostile. At least until you've been around for awhile.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: configuration values in database?

2011-02-20 Thread Miles J
I accomplished this using a model and the Configure class, like so:

Configure::write('Forum.settings',
ClassRegistry::init('Forum.Setting')->getSettings());

Place that in your bootstrap or AppController.

The technique is being used in my 2.0 forum plugin.

https://github.com/milesj/cake-forum/blob/2.0/forum_app_controller.php

On Feb 20, 10:31 am, kdubya  wrote:
> My suggestion would be to create a Model (maybe called Configuration
> with a DB table called configurations) for your configuration data
> then add the Model to your app_controller ($uses =
> array('Configuration');) so that it is available in all controllers.
> Depending on what you want to do with he configuration data, you may
> not need a controller. The Model class Configuration should probably
> have methods like get() and put() for accessing and adding/changing
> your settings.
>
> To learn about adding an app_controller.php to your app, 
> see:http://book.cakephp.org/#!/view/957/The-App-Controller
>
> HTH,
> Ken

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with cake 1.2 or not ?

2011-02-20 Thread Miloš Vučinić
Yeah , and also just because this time it makes more sense to wait for
a new version of cake it is a rule. The other opinions about upgrading
to 1.3 first are also justified.

So some kind of conclusion is that there are no rules on when to
upgrade immediately or wait for an even newer version, it depends from
case to case.

:)

All the best
Milos

On Feb 21, 12:42 am, Miloš Vučinić  wrote:
> Sorry for not answering sooner, I got some flue so I wasn't really
> turning my computer on :) Break time :)
>
> I just wanted to say thank you for the support , I really appreciate
> all of the information and advices you gave me. I guess I can wait
> then because there is no current emergency for upgrading and also
> after this business year there is probably going to be need for a lot
> of changes and upgrades and having that in mind it wouldn't be bad to
> start it in 2.0 than to make it first for 1.3 and then all the same
> for 2.0 again.
>
> Thanks
>
> On Feb 18, 3:24 pm, Alejandro Gómez Fernández 
> wrote:
>
>
>
>
>
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > Several years ago we neded to upgrade our management system from oracle
> > 8 when oracle release the version 10. Our provider insists us for
> > migrate to oracle 9 and then to 10. After a long analisys the systems
> > engineers decide to migrate to oracle 10 because the process will be
> > shorter. And it was fine and whe we finish the upgrade, oracle 10 was
> > mostly very stable.
>
> > This case seems pretty equal to me.
>
> > Ryan's advice is the most recommended for almost every case.
> > What Ryan says have the most sense if you need to do a seamless upgrade
> > for whatever other reason.
>
> > Remember, just like Ryans says, a production site will not be based in
> > development versions of framework, database, etc. But if you make
> > re-engineering to your site, this will take time and when you finish the
> > 2.0 framework wil be stable. Or you can wait until this happend.
>
> > If you upgrade to 1.3 and then again to 2.0 when there is no need to do,
> > it's to make the work two times. Even more, you can add new features
> > just like in any other software version upgrade and no only migrate the
> > framework version.
>
> > I think it's no needed to do the update now, because you want to upgrade
> > for fear to "PHP hosting can be changed to higher version" and then "the
> > website will no work".
>
> > This will not happpend in the short time, because php 5.3 it's now the
> > "top" standard (php it's releasing yet 5.2.x versions) so your
> > production website made with cakephp 1.2 will just work fine for several
> > more months.
>
> > Obviously, it's highly probable that there are no guide to do the
> > upgrade from 1.2 to 2.0
>
> > Regards,
>
> > Alejandro.
>
> > El 18/02/2011 01:23, Ryan Schmidt escribi :
>
> > > On Feb 17, 2011, at 21:41, Alejandro G mez Fern ndez wrote:
>
> > >> In case you want to upgrade cake "to the most recent version" I think
> > >> you must see cake 2.0. It's a development version, but more or less,
> > >> when you finish your migration it will be a production version. To
> > >> change to an 1.3.x has no sense to me.
>
> > > Upgrading a production site to the development version of CakePHP that 
> > > will become 2.0 makes no sense. The final version 2.0 is not released 
> > > yet, and the developers have provided no guidance on when it will be 
> > > completed. It might be tomorrow, it might be next year. In the mean time, 
> > > you might run into issues, the response to which will generally be "it's 
> > > a development version, it's expected to have unresolved problems, go use 
> > > the stable version".
>
> > > There is a published guide explaining how to upgrade a 1.2 site to 1.3. 
> > > When 2.0 is released, I would expect there to be a guide explaining how 
> > > to upgrade a site from 1.3 to 2.0. I would not, however, expect there to 
> > > be a guide on how to upgrade from 1.2 directly to 2.0; users would be 
> > > expected to have already upgraded to 1.3. Therefore it makes a great 
> > > amount of sense to upgrade your 1.2 site to 1.3 now, verify that you've 
> > > followed the existing upgrade guide properly and that everything works, 
> > > and publish your site with 1.3, and then, whenever 2.0 does come out, you 
> > > can tackle that upgrade then.
>
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (MingW32)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > iQEcBAEBAgAGBQJNXoELAAoJEHQn9CmeN9DJsmwH/0hKu+83Fb7FxtFNIvpYEocm
> > R+/jrMJCmwWWZMSoLOzF+aXH2fqcJd5evtMag4ErqjjFMIPrS/7JOZIrOM/P6dPK
> > kM672hL/WKTNvzxOPsXx/ywq9ydGHUBz3NM5i23DRP+PDCWoucIfgceZpFuTG2+H
> > AMRHmA/QIVg/zpLP3zzcqtW+eUcDDomUjOFRCVj2NDw6ReHCYh/hkcI4LED0tAX9
> > PSLPGrOVH6KodySzx+Os3/ABdFUyJtSczqwAa+qOfwLMZiV5S67IoRYMnvtYUYgq
> > 4nfy4/pK/swKOSCpfZneNp1X+/zi7pr2ueFAR0FnMt+lN+3JjrdluwXNtQQsmeU=
> > =Tcoo
> > -END PGP SIGNATURE-

-- 
Our newest site for the community: CakePHP 

Re: Problem with cake 1.2 or not ?

2011-02-20 Thread Miloš Vučinić
Sorry for not answering sooner, I got some flue so I wasn't really
turning my computer on :) Break time :)

I just wanted to say thank you for the support , I really appreciate
all of the information and advices you gave me. I guess I can wait
then because there is no current emergency for upgrading and also
after this business year there is probably going to be need for a lot
of changes and upgrades and having that in mind it wouldn't be bad to
start it in 2.0 than to make it first for 1.3 and then all the same
for 2.0 again.

Thanks


On Feb 18, 3:24 pm, Alejandro Gómez Fernández 
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Several years ago we neded to upgrade our management system from oracle
> 8 when oracle release the version 10. Our provider insists us for
> migrate to oracle 9 and then to 10. After a long analisys the systems
> engineers decide to migrate to oracle 10 because the process will be
> shorter. And it was fine and whe we finish the upgrade, oracle 10 was
> mostly very stable.
>
> This case seems pretty equal to me.
>
> Ryan's advice is the most recommended for almost every case.
> What Ryan says have the most sense if you need to do a seamless upgrade
> for whatever other reason.
>
> Remember, just like Ryans says, a production site will not be based in
> development versions of framework, database, etc. But if you make
> re-engineering to your site, this will take time and when you finish the
> 2.0 framework wil be stable. Or you can wait until this happend.
>
> If you upgrade to 1.3 and then again to 2.0 when there is no need to do,
> it's to make the work two times. Even more, you can add new features
> just like in any other software version upgrade and no only migrate the
> framework version.
>
> I think it's no needed to do the update now, because you want to upgrade
> for fear to "PHP hosting can be changed to higher version" and then "the
> website will no work".
>
> This will not happpend in the short time, because php 5.3 it's now the
> "top" standard (php it's releasing yet 5.2.x versions) so your
> production website made with cakephp 1.2 will just work fine for several
> more months.
>
> Obviously, it's highly probable that there are no guide to do the
> upgrade from 1.2 to 2.0
>
> Regards,
>
> Alejandro.
>
> El 18/02/2011 01:23, Ryan Schmidt escribi :
>
> > On Feb 17, 2011, at 21:41, Alejandro G mez Fern ndez wrote:
>
> >> In case you want to upgrade cake "to the most recent version" I think
> >> you must see cake 2.0. It's a development version, but more or less,
> >> when you finish your migration it will be a production version. To
> >> change to an 1.3.x has no sense to me.
>
> > Upgrading a production site to the development version of CakePHP that will 
> > become 2.0 makes no sense. The final version 2.0 is not released yet, and 
> > the developers have provided no guidance on when it will be completed. It 
> > might be tomorrow, it might be next year. In the mean time, you might run 
> > into issues, the response to which will generally be "it's a development 
> > version, it's expected to have unresolved problems, go use the stable 
> > version".
>
> > There is a published guide explaining how to upgrade a 1.2 site to 1.3. 
> > When 2.0 is released, I would expect there to be a guide explaining how to 
> > upgrade a site from 1.3 to 2.0. I would not, however, expect there to be a 
> > guide on how to upgrade from 1.2 directly to 2.0; users would be expected 
> > to have already upgraded to 1.3. Therefore it makes a great amount of sense 
> > to upgrade your 1.2 site to 1.3 now, verify that you've followed the 
> > existing upgrade guide properly and that everything works, and publish your 
> > site with 1.3, and then, whenever 2.0 does come out, you can tackle that 
> > upgrade then.
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (MingW32)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNXoELAAoJEHQn9CmeN9DJsmwH/0hKu+83Fb7FxtFNIvpYEocm
> R+/jrMJCmwWWZMSoLOzF+aXH2fqcJd5evtMag4ErqjjFMIPrS/7JOZIrOM/P6dPK
> kM672hL/WKTNvzxOPsXx/ywq9ydGHUBz3NM5i23DRP+PDCWoucIfgceZpFuTG2+H
> AMRHmA/QIVg/zpLP3zzcqtW+eUcDDomUjOFRCVj2NDw6ReHCYh/hkcI4LED0tAX9
> PSLPGrOVH6KodySzx+Os3/ABdFUyJtSczqwAa+qOfwLMZiV5S67IoRYMnvtYUYgq
> 4nfy4/pK/swKOSCpfZneNp1X+/zi7pr2ueFAR0FnMt+lN+3JjrdluwXNtQQsmeU=
> =Tcoo
> -END PGP SIGNATURE-

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: virtual fields falling outside normal array scope

2011-02-20 Thread dreamingmind


On Feb 20, 4:48 am, John Andersen  wrote:
> Thanks :)
> I just wonder, why the CakePHP book states one thing, when using MySQL
> and another when using PostgreSQL in the section "Create virtual
> fields" at:http://book.cakephp.org/#Creating-virtual-fields-1609
>
> Have you tried to do accordingly? That is, changing the statement in
> the component to:
>
> [code]
> $modelObj->virtualFields = array ('name' => 'CONCAT($modelObj->primaryKey, ": 
> ", $modelObj->displayField)');
>
> [/code]
>

The line I'm using to create the virtual field does follow the
recommendation of the book page for mySQL. Your suggested alteration
is, I know, intended to create a properly formed SQL CONCAT command
but it violates php syntax. My current code does create the proper
CONCAT command for mySQL and has proper php syntax.

These side issues aside though, I seem to have discovered my problem
and it points to a subtle (or perhaps glaring?) misunderstanding of
Objects on my part.

The problem started when I found I needed to pass the Model object in
to my Component as a parameter or the Component would not have it to
work with. So I did this in the calling controller:
   $model = new Aro();
Then I passed the Model object along to method tree_crud in the
TreeCrud Component like this:
   $this->set('treecrud_data',$this->TreeCrud->tree_crud($model));

In the Component I made the virtualField for the Model as described
earlier. I also tried to make the virtual field for the instance of
the Model named $model in the Controller, before calling the Component
method. Both approaches generated a returned data array in this form:
Array
(
[Aro] => Array
(
[id] => 1
[parent_id] =>
[model] => Group
[foreign_key] => 1
[alias] => administrators
[lft] => 1
[rght] => 4
)

[0] => Array
(
[Aro__name] => 1: administrators
)
)

The solution was to avoid creating and passing in a new instance of
the Model. So the proper code for the call was
  $this->set('treecrud_data',$this->TreeCrud->tree_crud($this-
>{$this->modelClass}));

Then, inside my Component I could create the virtual field in the same
way I described previously. Violà! I get the proper result array:
Array
(
[Aro] => Array
(
[id] => 1
[parent_id] =>
[model] => Group
[foreign_key] => 1
[alias] => administrators
[lft] => 1
[rght] => 4
[name] => 1: administrators
)
...

Thanks, Don





-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: Variables for Validation

2011-02-20 Thread Krissy Masters
Thanks,

I like the $this->field('name', array('id' => $id)); Nice and simple.

K

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of cricket
Sent: Sunday, February 20, 2011 2:41 PM
To: cake-php@googlegroups.com
Subject: Re: Variables for Validation

On Sun, Feb 20, 2011 at 8:22 AM, Krissy Masters
 wrote:
> Not sure why I only thought of this now.
>
> Any form: quick dummy function
>
> function edit() {
>
> If(!empty($this->data)) {
>
>       If($this->save());
>
>        // whatever
>       }
> $countries = $this->Model->_getCountries(); // returns list of countries
> $this->set(compact('countries'));
>
>
> }
>
> So you have a full list of countries in the form user can select from.
>
> $validate array() in model I have a function to check the country_id value
> and that function also uses _getCountries();
>
> public function checkCountryValues( $data, $field ){
>
> $valid = false;
>        if( !empty( $this->data[$this->alias][$field] ) ) {
>                if ( array_key_exists($this->data[$this->alias][$field],
> $this->_getCountries() ) ){
>                        $valid = true;
>                }
>        }
>        return $valid;
> }
>
>
>
> So I am essentially grabbing that data twice. How can I reuse that initial
> $countries throughout the whole process rather than grabbing the same data
> over and over?
> Might sounds trivial but some models might have 6 or more related models
and
> then validating pulling all the same values used in the view / form it is
> just added work.

You're making the mistake of focusing on the action instead of the
request. In your example, "the whole process" occurs over two separate
requests.

In the validation scenario, I think it's just as well to check if
$this->field('name', array('id' => $id)) returns empty or not.

It's just an example, I know, but your model's method is also
protected, so the controller could not call it.

-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: virtual fields falling outside normal array scope

2011-02-20 Thread John Andersen
Thanks Cricket, I got that shortly after I wrote it :)

But the issue that the OP seems to have, is that the usage of virtual
fields does not appear to work, when the model is being assigned the
virtual fields in a component and then a find statement is executed.

I don't have more time today to look into this, so hopefully someone
else will pick it up or the OP will find a solution :)
Enjoy,
   John

On Feb 20, 7:14 pm, cricket  wrote:
> On Sun, Feb 20, 2011 at 7:48 AM, John Andersen  
> wrote:
> > Thanks :)
> > I just wonder, why the CakePHP book states one thing, when using MySQL
> > and another when using PostgreSQL in the section "Create virtual
> > fields" at:
> >http://book.cakephp.org/#Creating-virtual-fields-1609
>
> The comment about Postgres is just a clarification because each has
> their own way to do CONCAT(). That is, the first example is
> MySQL-specific.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: configuration values in database?

2011-02-20 Thread kdubya
My suggestion would be to create a Model (maybe called Configuration
with a DB table called configurations) for your configuration data
then add the Model to your app_controller ($uses =
array('Configuration');) so that it is available in all controllers.
Depending on what you want to do with he configuration data, you may
not need a controller. The Model class Configuration should probably
have methods like get() and put() for accessing and adding/changing
your settings.

To learn about adding an app_controller.php to your app, see:
http://book.cakephp.org/#!/view/957/The-App-Controller

HTH,
Ken

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: virtual fields falling outside normal array scope

2011-02-20 Thread cricket
On Sun, Feb 20, 2011 at 7:48 AM, John Andersen  wrote:
> Thanks :)
> I just wonder, why the CakePHP book states one thing, when using MySQL
> and another when using PostgreSQL in the section "Create virtual
> fields" at:
> http://book.cakephp.org/#Creating-virtual-fields-1609

The comment about Postgres is just a clarification because each has
their own way to do CONCAT(). That is, the first example is
MySQL-specific.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Variables for Validation

2011-02-20 Thread cricket
On Sun, Feb 20, 2011 at 8:22 AM, Krissy Masters
 wrote:
> Not sure why I only thought of this now.
>
> Any form: quick dummy function
>
> function edit() {
>
> If(!empty($this->data)) {
>
>       If($this->save());
>
>        // whatever
>       }
> $countries = $this->Model->_getCountries(); // returns list of countries
> $this->set(compact('countries'));
>
>
> }
>
> So you have a full list of countries in the form user can select from.
>
> $validate array() in model I have a function to check the country_id value
> and that function also uses _getCountries();
>
> public function checkCountryValues( $data, $field ){
>
> $valid = false;
>        if( !empty( $this->data[$this->alias][$field] ) ) {
>                if ( array_key_exists($this->data[$this->alias][$field],
> $this->_getCountries() ) ){
>                        $valid = true;
>                }
>        }
>        return $valid;
> }
>
>
>
> So I am essentially grabbing that data twice. How can I reuse that initial
> $countries throughout the whole process rather than grabbing the same data
> over and over?
> Might sounds trivial but some models might have 6 or more related models and
> then validating pulling all the same values used in the view / form it is
> just added work.

You're making the mistake of focusing on the action instead of the
request. In your example, "the whole process" occurs over two separate
requests.

In the validation scenario, I think it's just as well to check if
$this->field('name', array('id' => $id)) returns empty or not.

It's just an example, I know, but your model's method is also
protected, so the controller could not call it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: create a admin user without registration by Auth component.

2011-02-20 Thread John Andersen
Take a look at the Auth components hashPassword method in the CakePHP
book at:
http://book.cakephp.org/#hashPasswords-1259

You should use the method before you inserts a new user in the
database.
Enjoy,
   John

On Feb 20, 5:20 pm, "sanjibdhar...@gmail.com"
 wrote:
> Is it possible to create a admin user without registration by Auth
> component.If possible can you tell me how.
>
> I have tried with creating user by database insert.But  login action
> accept only hashed password.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread euromark
john is still right, though
the data should be finalized in the view
this way you can customize it better

simply use a "csv" layout (settings headers) which uses the custom csv
view you generate (using a csv helper).


On 20 Feb., 16:51, John Andersen  wrote:
> This is speculation only, but maybe define your field parameter in the
> find statement, so that the "newdate" comes first!
> Enjoy,
>    John
>
> On Feb 20, 4:42 pm, Tapan Kumar Thapa 
> wrote:
>
>
>
>
>
>
>
> > Thanks for your suggestion.
>
> > I have implemented this in my model.
>
> > var $virtualFields = array(
> >         'newdate' => 'DATE_FORMAT(Incoming.date, "%d-%b-%y")'
> >     );
>
> > It works as charm however now i have got another problem.
>
> > now my new date is coming in last like this.
>
> > SELECT `Incoming`.`time`, `Incoming`.`msisdn`, `Incoming`.`shortcode`,
> > `Incoming`.`operator`, `Incoming`.`circle`, `Incoming`.`keyword`,
> > `Incoming`.`answer`, `Incoming`.`age`, `Incoming`.`gender`,
> > `Incoming`.`status`, *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
> > `Incoming__newdate`* FROM `incomings` AS `Incoming` WHERE
> > `Incoming`.`created` >= '2011-02-08 00:00:00' AND `Incoming`.`created` <=
> > '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc LIMIT 20, 20
>
> > However i want like this:
>
> > SELECT *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
> > `Incoming__newdate`*,`Incoming`.`time`,
> > `Incoming`.`msisdn`, `Incoming`.`shortcode`, `Incoming`.`operator`,
> > `Incoming`.`circle`, `Incoming`.`keyword`, `Incoming`.`answer`,
> > `Incoming`.`age`, `Incoming`.`gender`, `Incoming`.`status`  FROM `incomings`
> > AS `Incoming` WHERE `Incoming`.`created` >= '2011-02-08 00:00:00' AND
> > `Incoming`.`created` <= '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc
> > LIMIT 20, 20
>
> > Please suggest.
>
> > Regards
> > Tapan Thapa
> > India
>
> > On Sun, Feb 20, 2011 at 8:28 PM, John Andersen 
> > wrote:
>
> > > Please show us how the view code looks like, maybe we can suggest
> > > something based on that.
>
> > > If you can't then you may be able to use a virtual field for this,
> > > look at the CakePHP book at:
> > >http://book.cakephp.org/view/1608/Virtual-fields
>
> > > Enjoy,
> > >   John
>
> > > On Feb 20, 3:45 pm, Tapan Kumar Thapa 
> > > wrote:
> > > > Unfortunately no(:-
>
> > > > I have an export csv option via a html link and i am not presenting this
> > > > data to my view.
>
> > > > Please suggest if this can be achieved in controller itself.
>
> > > > Regards
> > > > Tapan Thapa
> > > > India
>
> > > [snip]
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


create a admin user without registration by Auth component.

2011-02-20 Thread sanjibdhar...@gmail.com
Is it possible to create a admin user without registration by Auth
component.If possible can you tell me how.

I have tried with creating user by database insert.But  login action
accept only hashed password.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Non-Admin logout issue (ACL)

2011-02-20 Thread John Andersen
Check what URL you are being given back by $this->Auth->logout()!
Enjoy,
   John

On Feb 20, 10:27 am, sumri  wrote:
> Hi,
>
> I'm new in CakePHP.
>
> Just setting up ACL for my apps with 3 user groups :
>
> - administrators
>
> - managers
>
> - users
>
> There's no issue with login - it's redirect to the right link.
>
> I've a problem when users logout.
>
> When i logged out with 'administrators' users, the apps will logged
> and redirect to the right link.
>
> But when i logged out using 'managers' & 'users' users, the app not
> logged out and redirect to the wrong page with "You are not authorized
> to access that location." message.
>
> here's my app_controller script :
>
> ==
>    class AppController extends Controller {
>     var $components = array('Acl', 'Auth', 'Session');
>     var $helpers = array('Html', 'Form', 'Session');
>   function beforeFilter() {
>     //Configure AuthComponent
>     $this->Auth->authorize = 'actions';
>     $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
>     $this->Auth->logoutRedirect = array('controller' => 'users',
> 'action' => 'login');
>     $this->Auth->loginRedirect = array('controller' =>
> 'ApplicationsUsers', 'action' => 'index');
>     $this->Auth->actionPath = 'controllers/';
>     $this->Auth->allowedActions = array('display');
>     }
>   }
> ?>
> ==
>
> and this is login and logout in my userscontroller
>
> ==
>   function login() {
>     if ($this->Session->read('Auth.User')) {
>       $this->Session->setFlash('You are logged in!');
>       $this->redirect('/', null, false);
>     }
>   }
>
>   function logout() {
>    $this->Session->setFlash('Good-Bye');
>    $this->redirect($this->Auth->logout());
>   }
>
> ==
>
> pls heelppp m..
>
> i've referred solution from this thread 
> :http://groups.google.com/group/cake-php/browse_thread/thread/bb7472b0...
> unfortunately.. i've got same result.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Non-Admin logout issue (ACL)

2011-02-20 Thread sumri
Hi,

I'm new in CakePHP.

Just setting up ACL for my apps with 3 user groups :

- administrators

- managers

- users

There's no issue with login - it's redirect to the right link.

I've a problem when users logout.

When i logged out with 'administrators' users, the apps will logged
and redirect to the right link.

But when i logged out using 'managers' & 'users' users, the app not
logged out and redirect to the wrong page with "You are not authorized
to access that location." message.

here's my app_controller script :

==
Auth->authorize = 'actions';
$this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
$this->Auth->loginRedirect = array('controller' =>
'ApplicationsUsers', 'action' => 'index');
$this->Auth->actionPath = 'controllers/';
$this->Auth->allowedActions = array('display');
}
  }
?>
==

and this is login and logout in my userscontroller

==
  function login() {
if ($this->Session->read('Auth.User')) {
  $this->Session->setFlash('You are logged in!');
  $this->redirect('/', null, false);
}
  }


  function logout() {
   $this->Session->setFlash('Good-Bye');
   $this->redirect($this->Auth->logout());
  }

==

pls heelppp m..

i've referred solution from this thread :
http://groups.google.com/group/cake-php/browse_thread/thread/bb7472b0ef3d161/c7596953b630c51e?lnk=gst&q=logout#
unfortunately.. i've got same result.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread John Andersen
This is speculation only, but maybe define your field parameter in the
find statement, so that the "newdate" comes first!
Enjoy,
   John

On Feb 20, 4:42 pm, Tapan Kumar Thapa 
wrote:
> Thanks for your suggestion.
>
> I have implemented this in my model.
>
> var $virtualFields = array(
>         'newdate' => 'DATE_FORMAT(Incoming.date, "%d-%b-%y")'
>     );
>
> It works as charm however now i have got another problem.
>
> now my new date is coming in last like this.
>
> SELECT `Incoming`.`time`, `Incoming`.`msisdn`, `Incoming`.`shortcode`,
> `Incoming`.`operator`, `Incoming`.`circle`, `Incoming`.`keyword`,
> `Incoming`.`answer`, `Incoming`.`age`, `Incoming`.`gender`,
> `Incoming`.`status`, *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
> `Incoming__newdate`* FROM `incomings` AS `Incoming` WHERE
> `Incoming`.`created` >= '2011-02-08 00:00:00' AND `Incoming`.`created` <=
> '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc LIMIT 20, 20
>
> However i want like this:
>
> SELECT *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
> `Incoming__newdate`*,`Incoming`.`time`,
> `Incoming`.`msisdn`, `Incoming`.`shortcode`, `Incoming`.`operator`,
> `Incoming`.`circle`, `Incoming`.`keyword`, `Incoming`.`answer`,
> `Incoming`.`age`, `Incoming`.`gender`, `Incoming`.`status`  FROM `incomings`
> AS `Incoming` WHERE `Incoming`.`created` >= '2011-02-08 00:00:00' AND
> `Incoming`.`created` <= '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc
> LIMIT 20, 20
>
> Please suggest.
>
> Regards
> Tapan Thapa
> India
>
> On Sun, Feb 20, 2011 at 8:28 PM, John Andersen wrote:
>
> > Please show us how the view code looks like, maybe we can suggest
> > something based on that.
>
> > If you can't then you may be able to use a virtual field for this,
> > look at the CakePHP book at:
> >http://book.cakephp.org/view/1608/Virtual-fields
>
> > Enjoy,
> >   John
>
> > On Feb 20, 3:45 pm, Tapan Kumar Thapa 
> > wrote:
> > > Unfortunately no(:-
>
> > > I have an export csv option via a html link and i am not presenting this
> > > data to my view.
>
> > > Please suggest if this can be achieved in controller itself.
>
> > > Regards
> > > Tapan Thapa
> > > India
>
> > [snip]
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread Tapan Kumar Thapa
Thanks for your suggestion.

I have implemented this in my model.

var $virtualFields = array(
'newdate' => 'DATE_FORMAT(Incoming.date, "%d-%b-%y")'
);

It works as charm however now i have got another problem.

now my new date is coming in last like this.

SELECT `Incoming`.`time`, `Incoming`.`msisdn`, `Incoming`.`shortcode`,
`Incoming`.`operator`, `Incoming`.`circle`, `Incoming`.`keyword`,
`Incoming`.`answer`, `Incoming`.`age`, `Incoming`.`gender`,
`Incoming`.`status`, *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
`Incoming__newdate`* FROM `incomings` AS `Incoming` WHERE
`Incoming`.`created` >= '2011-02-08 00:00:00' AND `Incoming`.`created` <=
'2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc LIMIT 20, 20

However i want like this:

SELECT *(DATE_FORMAT(`Incoming`.`date`, "%d-%b-%y")) AS
`Incoming__newdate`*,`Incoming`.`time`,
`Incoming`.`msisdn`, `Incoming`.`shortcode`, `Incoming`.`operator`,
`Incoming`.`circle`, `Incoming`.`keyword`, `Incoming`.`answer`,
`Incoming`.`age`, `Incoming`.`gender`, `Incoming`.`status`  FROM `incomings`
AS `Incoming` WHERE `Incoming`.`created` >= '2011-02-08 00:00:00' AND
`Incoming`.`created` <= '2011-02-20 20:55:00' ORDER BY `Incoming`.`id` desc
LIMIT 20, 20

Please suggest.

Regards
Tapan Thapa
India


On Sun, Feb 20, 2011 at 8:28 PM, John Andersen wrote:

> Please show us how the view code looks like, maybe we can suggest
> something based on that.
>
> If you can't then you may be able to use a virtual field for this,
> look at the CakePHP book at:
> http://book.cakephp.org/view/1608/Virtual-fields
>
> Enjoy,
>   John
>
> On Feb 20, 3:45 pm, Tapan Kumar Thapa 
> wrote:
> > Unfortunately no(:-
> >
> > I have an export csv option via a html link and i am not presenting this
> > data to my view.
> >
> > Please suggest if this can be achieved in controller itself.
> >
> > Regards
> > Tapan Thapa
> > India
> >
> [snip]
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: configuration values in database?

2011-02-20 Thread John Andersen
This is just speculations, but you may be able to use the App::import
in order to use a model for your configuration table, thus making it
possible to read the configuration data.
Enjoy,
   John

On Feb 19, 10:16 am, Navi  wrote:
> hi there
> im new to cakephp
> i want to ask how can i save configuration options to database and how
> can i retrive them to a page (bootstrap.php?) where it can be used
> throughout all controllers models views etc?
> thanks
> -Navi

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread John Andersen
Please show us how the view code looks like, maybe we can suggest
something based on that.

If you can't then you may be able to use a virtual field for this,
look at the CakePHP book at:
http://book.cakephp.org/view/1608/Virtual-fields

Enjoy,
   John

On Feb 20, 3:45 pm, Tapan Kumar Thapa 
wrote:
> Unfortunately no(:-
>
> I have an export csv option via a html link and i am not presenting this
> data to my view.
>
> Please suggest if this can be achieved in controller itself.
>
> Regards
> Tapan Thapa
> India
>
[snip]

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread Tapan Kumar Thapa
Unfortunately no(:-

I have an export csv option via a html link and i am not presenting this
data to my view.

Please suggest if this can be achieved in controller itself.

Regards
Tapan Thapa
India

On Sun, Feb 20, 2011 at 8:08 PM, John Andersen wrote:

> Presentation of the data, your date and time fields, should be done in
> the view, not in the controller, so just move the formatting to the
> view. Would that be an acceptable solution for you?
> Enjoy,
>   John
>
> On Feb 20, 2:58 pm, Tapan Kumar Thapa 
> wrote:
> > Hello Community,
> >
> > I have an export function in my controller.
> >
> > function export() {
> > $this->layout = '';
> > $startdate = $this->Session->read('startdate');
> > $enddate = $this->Session->read('enddate');
> > $this->set('Export', $this->Incoming->find('all', array(
> > 'fields' => array('date', 'time', 'msisdn',
> 'shortcode',
> > 'operator', 'circle', 'keyword', 'answer', 'age', 'gender'),
> > 'order' => "Incoming.id desc",
> > 'conditions' => array("Incoming.created >=
> '$startdate'
> > AND Incoming.created <= '$enddate' "),
> > 'contain' => false)));
> > }
> >
> > I want this control look like this.
> >
> > function export() {
> > $this->layout = '';
> > $startdate = $this->Session->read('startdate');
> > $enddate = $this->Session->read('enddate');
> > $this->set('Export', $this->Incoming->find('all', array(
> > 'fields' => array('date_format(date, '%d-%b-%y') as
> > date', 'time', 'msisdn', 'shortcode', 'operator', 'circle', 'keyword',
> > 'answer', 'age', 'gender'),
> > 'order' => "Incoming.id desc",
> > 'conditions' => array("Incoming.created >=
> '$startdate'
> > AND Incoming.created <= '$enddate' "),
> > 'contain' => false)));
> > }
> >
> > Please suggest.
> >
> > Regards
> > Tapan Thapa
> > India
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Urgent Help--Please

2011-02-20 Thread John Andersen
Presentation of the data, your date and time fields, should be done in
the view, not in the controller, so just move the formatting to the
view. Would that be an acceptable solution for you?
Enjoy,
   John

On Feb 20, 2:58 pm, Tapan Kumar Thapa 
wrote:
> Hello Community,
>
> I have an export function in my controller.
>
> function export() {
>         $this->layout = '';
>         $startdate = $this->Session->read('startdate');
>         $enddate = $this->Session->read('enddate');
>         $this->set('Export', $this->Incoming->find('all', array(
>                     'fields' => array('date', 'time', 'msisdn', 'shortcode',
> 'operator', 'circle', 'keyword', 'answer', 'age', 'gender'),
>                     'order' => "Incoming.id desc",
>                     'conditions' => array("Incoming.created >= '$startdate'
> AND Incoming.created <= '$enddate' "),
>                     'contain' => false)));
>     }
>
> I want this control look like this.
>
> function export() {
>         $this->layout = '';
>         $startdate = $this->Session->read('startdate');
>         $enddate = $this->Session->read('enddate');
>         $this->set('Export', $this->Incoming->find('all', array(
>                     'fields' => array('date_format(date, '%d-%b-%y') as
> date', 'time', 'msisdn', 'shortcode', 'operator', 'circle', 'keyword',
> 'answer', 'age', 'gender'),
>                     'order' => "Incoming.id desc",
>                     'conditions' => array("Incoming.created >= '$startdate'
> AND Incoming.created <= '$enddate' "),
>                     'contain' => false)));
>     }
>
> Please suggest.
>
> Regards
> Tapan Thapa
> India

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Variables for Validation

2011-02-20 Thread John Andersen
I would say yes, as it follows the normal way in CakePHP and by using
the Cache feature in the model, the second call will just take the
same data from the cache instead of querying the database again.
Enjoy,
   John

On Feb 20, 2:43 pm, "Krissy Masters" 
wrote:
> Sorry, everything is cached either in memory (Memcache) or plain file
> depending on the data pulled. I was just wondering if it made sense to ask
> for the same data twice in the same action (once for the view and again for
> validation) in these cases.
>
> K
>
[snip]

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Urgent Help--Please

2011-02-20 Thread Tapan Kumar Thapa
Hello Community,

I have an export function in my controller.

function export() {
$this->layout = '';
$startdate = $this->Session->read('startdate');
$enddate = $this->Session->read('enddate');
$this->set('Export', $this->Incoming->find('all', array(
'fields' => array('date', 'time', 'msisdn', 'shortcode',
'operator', 'circle', 'keyword', 'answer', 'age', 'gender'),
'order' => "Incoming.id desc",
'conditions' => array("Incoming.created >= '$startdate'
AND Incoming.created <= '$enddate' "),
'contain' => false)));
}

I want this control look like this.

function export() {
$this->layout = '';
$startdate = $this->Session->read('startdate');
$enddate = $this->Session->read('enddate');
$this->set('Export', $this->Incoming->find('all', array(
'fields' => array('date_format(date, '%d-%b-%y') as
date', 'time', 'msisdn', 'shortcode', 'operator', 'circle', 'keyword',
'answer', 'age', 'gender'),
'order' => "Incoming.id desc",
'conditions' => array("Incoming.created >= '$startdate'
AND Incoming.created <= '$enddate' "),
'contain' => false)));
}

Please suggest.

Regards
Tapan Thapa
India

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: Variables for Validation

2011-02-20 Thread Krissy Masters
Sorry, everything is cached either in memory (Memcache) or plain file
depending on the data pulled. I was just wondering if it made sense to ask
for the same data twice in the same action (once for the view and again for
validation) in these cases.

K

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of John Andersen
Sent: Sunday, February 20, 2011 10:06 AM
To: CakePHP
Subject: Re: Variables for Validation

I would look into using the cache! Start from here in the CakePHP
book:
http://book.cakephp.org/view/1193/Caching

Enjoy,
   John

On Feb 20, 2:22 pm, "Krissy Masters" 
wrote:
> Not sure why I only thought of this now.
>
> Any form: quick dummy function
>
> function edit() {
>
> If(!empty($this->data)) {
>
>        If($this->save());
>
>         // whatever
>        }
> $countries = $this->Model->_getCountries(); // returns list of countries
> $this->set(compact('countries'));
>
> }
>
> So you have a full list of countries in the form user can select from.
>
> $validate array() in model I have a function to check the country_id value
> and that function also uses _getCountries();
>
> public function checkCountryValues( $data, $field ){
>
> $valid = false;
>         if( !empty( $this->data[$this->alias][$field] ) ) {
>                 if ( array_key_exists($this->data[$this->alias][$field],
> $this->_getCountries() ) ){
>                         $valid = true;
>                 }
>         }
>         return $valid;
>
> }
>
> So I am essentially grabbing that data twice. How can I reuse that initial
> $countries throughout the whole process rather than grabbing the same data
> over and over?
> Might sounds trivial but some models might have 6 or more related models
and
> then validating pulling all the same values used in the view / form it is
> just added work.
>
> Thanks,
> K

-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Variables for Validation

2011-02-20 Thread John Andersen
I would look into using the cache! Start from here in the CakePHP
book:
http://book.cakephp.org/view/1193/Caching

Enjoy,
   John

On Feb 20, 2:22 pm, "Krissy Masters" 
wrote:
> Not sure why I only thought of this now.
>
> Any form: quick dummy function
>
> function edit() {
>
> If(!empty($this->data)) {
>
>        If($this->save());
>
>         // whatever
>        }
> $countries = $this->Model->_getCountries(); // returns list of countries
> $this->set(compact('countries'));
>
> }
>
> So you have a full list of countries in the form user can select from.
>
> $validate array() in model I have a function to check the country_id value
> and that function also uses _getCountries();
>
> public function checkCountryValues( $data, $field ){
>
> $valid = false;
>         if( !empty( $this->data[$this->alias][$field] ) ) {
>                 if ( array_key_exists($this->data[$this->alias][$field],
> $this->_getCountries() ) ){
>                         $valid = true;
>                 }
>         }
>         return $valid;
>
> }
>
> So I am essentially grabbing that data twice. How can I reuse that initial
> $countries throughout the whole process rather than grabbing the same data
> over and over?
> Might sounds trivial but some models might have 6 or more related models and
> then validating pulling all the same values used in the view / form it is
> just added work.
>
> Thanks,
> K

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Variables for Validation

2011-02-20 Thread Krissy Masters
Not sure why I only thought of this now.

Any form: quick dummy function 

function edit() {

If(!empty($this->data)) {

   If($this->save());

// whatever
   }
$countries = $this->Model->_getCountries(); // returns list of countries
$this->set(compact('countries'));


}

So you have a full list of countries in the form user can select from.

$validate array() in model I have a function to check the country_id value
and that function also uses _getCountries();

public function checkCountryValues( $data, $field ){

$valid = false;
if( !empty( $this->data[$this->alias][$field] ) ) {
if ( array_key_exists($this->data[$this->alias][$field],
$this->_getCountries() ) ){
$valid = true;
}
}
return $valid;
}



So I am essentially grabbing that data twice. How can I reuse that initial
$countries throughout the whole process rather than grabbing the same data
over and over?
Might sounds trivial but some models might have 6 or more related models and
then validating pulling all the same values used in the view / form it is
just added work.

Thanks,
K

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: virtual fields falling outside normal array scope

2011-02-20 Thread John Andersen
Thanks :)
I just wonder, why the CakePHP book states one thing, when using MySQL
and another when using PostgreSQL in the section "Create virtual
fields" at:
http://book.cakephp.org/#Creating-virtual-fields-1609

Have you tried to do accordingly? That is, changing the statement in
the component to:

[code]
$modelObj->virtualFields = array ('name' => 'CONCAT($modelObj-
>primaryKey, ": ", $modelObj->displayField)');
[/code]

Enjoy,
   John

On Feb 20, 1:21 am, dreamingmind  wrote:
> And I'm using MySQL
>
> Don

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Where to put my own php classes and how to call them

2011-02-20 Thread Slim
Thanks euromark, that's sure helping !


On 19 fév, 18:33, euromark  wrote:
> for your sencod problem
> read about "libs" in cake1.3
> thats the way to go with own custom classes
>
> /libs/my_class.php with MyClass class
>
> App::import('Lib', 'MyClass');
>
> On 19 Feb., 19:09, "Krissy Masters" 
> wrote:
>
> > You're better off using Plugins, "Support for vendor assets have been
> > removed for 1.3.".
>
> > Make your own and simply use it where needed as a Helper / View / Model /
> > Controller /
>
> > There is a specific section in the book dealing with that.
>
> >http://book.cakephp.org/view/1613/Vendor-assets#!/view/1612/Vendor-pa...
>
> > K
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> > Of Slim
> > Sent: Saturday, February 19, 2011 5:22 AM
> > To: CakePHP
> > Subject: Where to put my own php classes and how to call them
>
> > Hello everyone,
>
> > first, I'm new to cakephp and new to the group, so in advance sorry if
> > i'm posting something not in the right place,
>
> > so t started using cakephp 1.3.7, followed the blog tutorial and
> > pushed successfully a little more than the blog tutorial.
>
> > I have 2 questions :
>
> > 1-I wanna use tcpdf in my app ,I know i must put it in vendors , but
> > what vendors directory ? [root]/vendors or app/vendors ? -and then, if
> > wanna call the tcpdf class, I must give it a call like
> > App::import('Vendor', 'tcpdf'); ?
>
> > 2-now, If i have my own php classes, let's say, a Product,Employee
> > classes , where do I mut put them ? and to call them I guess it's same
> > as my firts question : something like  App::import('[directory]',
> > 'Product'); ??
>
> > Thks in advance,
>
> > Slim
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Where to put my own php classes and how to call them

2011-02-20 Thread Slim
Thanks Krissy,
that helps me

On 19 fév, 18:09, "Krissy Masters"  wrote:
> You're better off using Plugins, "Support for vendor assets have been
> removed for 1.3.".
>
> Make your own and simply use it where needed as a Helper / View / Model /
> Controller /
>
> There is a specific section in the book dealing with that.
>
> http://book.cakephp.org/view/1613/Vendor-assets#!/view/1612/Vendor-pa...
>
> K
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of Slim
> Sent: Saturday, February 19, 2011 5:22 AM
> To: CakePHP
> Subject: Where to put my own php classes and how to call them
>
> Hello everyone,
>
> first, I'm new to cakephp and new to the group, so in advance sorry if
> i'm posting something not in the right place,
>
> so t started using cakephp 1.3.7, followed the blog tutorial and
> pushed successfully a little more than the blog tutorial.
>
> I have 2 questions :
>
> 1-I wanna use tcpdf in my app ,I know i must put it in vendors , but
> what vendors directory ? [root]/vendors or app/vendors ? -and then, if
> wanna call the tcpdf class, I must give it a call like
> App::import('Vendor', 'tcpdf'); ?
>
> 2-now, If i have my own php classes, let's say, a Product,Employee
> classes , where do I mut put them ? and to call them I guess it's same
> as my firts question : something like  App::import('[directory]',
> 'Product'); ??
>
> Thks in advance,
>
> Slim
>
> --
> Our newest site for the community: CakePHP Video 
> Tutorialshttp://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php