Re: Unable to save related table information

2010-01-13 Thread John Andersen
How does your data look like before the saveAll statement?
Enjoy,
   John

On Jan 14, 12:41 am, koala kid  wrote:
> Hi all,
>
> using ORM for the first time and I'm having trouble getting my associations
> all worked out. I'm unable to get my associated table data to save.Here's a
> basic overview of my models:
>
> Locations -> Parent
> Rentals -> Belongs to Locations
> Rates -> Belongs to Rentals
>
> My code looks like this:
>
>  class Rental extends AppModel
> {
>        var $name = 'Rental';
>
>        var $hasOne = array(
>        'Rate' => array(
>            'className'    => 'Rate',
>            'dependent'    => true
>        )
>    );
>        var $belongsTo = array(
>        'Location' => array(
>            'className'         => 'Location',
>            'fields'            => 'city'
>        )
>    );
>
> }
>
> ?>
>
> class Rate extends AppModel
> {
>        var $name = 'Rate';
>
>        var $belongsTo = 'Rentals';
>
> }
>
> And my save looks like this:
>
> $this->Rental->saveAll($this->data)
>
> However only data to the Rental table is being saved and not to the Rate
> table. Can anyone tell me what I am missing. I don't have a controller for
> Rates as there are no direct functions to run against them, does this
> matter?
>
> Thanks.
> --
> View this message in 
> context:http://old.nabble.com/Unable-to-save-related-table-information-tp2715...
> Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing Parent Record Data

2010-01-13 Thread emptywalls
That did it! Thanks so much! Took a little figuring out, but I see
what ya did there.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing Parent Record Data

2010-01-13 Thread emptywalls
No, that didn't work. I'm looking at the array thats returned, it
appears to be empty.
Array
(
[Song] => Array
(
[id] => 2394
[title] => Gimme Shelter
)

[ParentSong] => Array
(
[id] =>
)
[Artist] => Array
(
[0] => Array
(
[id] => 770
[name] => Rolling Stones
[ArtistsSong] => Array
(
[id] => 2424
[artist_id] => 770
[song_id] => 2394
)

)

)

)

Here's the query:
SELECT `Song`.`id`, `Song`.`title`, `Song`.`subtitle`,
`ParentSong`.`id` FROM `songs` AS `Song` LEFT JOIN `songs` AS
`ParentSong` ON (`Song`.`parent_id` = `ParentSong`.`id`) WHERE 1 = 1
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread Azril Nazli
try

  "fields" => array(
"GenderSalutation.name",
"User.first_name", "User.middle_name",
"User.last_name", "DATE_FORMAT(User.created, '%d') AS User.created",
"User.dob",
),
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Reserved Word Issue? Just need confirmation.

2010-01-13 Thread euromark
if php only was case-sensitive^^

On 14 Jan., 02:47, Miles J  wrote:
> Ya reserved words can be annoying. Just rename it to Listing.
>
> On Jan 13, 3:07 pm, SonnyBurnette  wrote:
>
> > So even creating a class named "List" causes issues I take it. I guess
> > I can fake the name with routing.
>
> > On Jan 13, 5:22 pm, mike karthauser  wrote:
>
> > > List is indeed a reserved 
> > > wordhttp://www.php.net/manual/en/reserved.keywords.php
>
> > > Mike Karthauser
> > > Brightstorm limited
> > > Tel: 07939252144
>
> > > On 13 Jan 2010, at 22:06, SonnyBurnette  wrote:
>
> > > > I am trying to create a model called "List" but I keep getting "Parse
> > > > error: syntax error, unexpected T_LIST, expecting T_STRING" for the
> > > > line of code "class List extends AppModel {"
>
> > > > I haven't had this issue with my other models so I am assuming that
> > > > this is a reserved word issue. Is that correct?
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 
> > > > others with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this  
> > > > group athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 1.3 on a production server?

2010-01-13 Thread Miles J
Ive been working in 1.3 for a few weeks and have not ran into any
problems. There might be some in those weird "what if" or
unconventional coding standards.

On Jan 13, 3:30 pm, LightDot  wrote:
> I've often been scratching my head while looking at software such as
> osCommerce, which is now at v2.2 RC 2a, and back in 2003 it was at
> v2.2 Milestone 2. LOL
>
> Ah, well... I guess there is limited space for humour in software
> development, so why not.
>
> But CakePHP doesn't strike me as such a software. So... as much as I'm
> tempted to switch existing and future applications to 1.3 ASAP, I've
> decided to wait. Once 1.3 is designated as beta or RC, I'll
> reconsider...
>
> On Jan 12, 8:51 pm, Jamie  wrote:
>
> > Fair enough. In that case, why the 'alpha' designation? What does that
> > mean for CakePHP, and how does it differ from 'beta'? If the alpha
> > release is so stable and has been publicly released, then I can't
> > figure out why it's called alpha and not beta.
>
> > On Jan 12, 11:02 am, "Larry E. Masters aka PhpNut" 
> > wrote:
>
> > > Why would I be sarcastic? How you follow the CakePHP project for any 
> > > length
> > > of time? You will notice the alpha releases are more stable then most
> > > projects stable versions.
>
> > > --
> > > /**
> > > * @author Larry E. Masters
> > > * @var string $userName
> > > * @param string $realName
> > > * @returns string aka PhpNut
> > > * @access  public
> > > */
>
> > > On Tue, Jan 12, 2010 at 12:57 PM, DanielMedia 
> > > wrote:
>
> > > > Just checking if you were being sarcastic Larry?
>
> > > > On Jan 11, 8:20 pm, "Larry E. Masters aka PhpNut" 
> > > > wrote:
> > > > > Yes all client work is on 1.3
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.comFor
> > > >  more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Reserved Word Issue? Just need confirmation.

2010-01-13 Thread Miles J
Ya reserved words can be annoying. Just rename it to Listing.

On Jan 13, 3:07 pm, SonnyBurnette  wrote:
> So even creating a class named "List" causes issues I take it. I guess
> I can fake the name with routing.
>
> On Jan 13, 5:22 pm, mike karthauser  wrote:
>
> > List is indeed a reserved 
> > wordhttp://www.php.net/manual/en/reserved.keywords.php
>
> > Mike Karthauser
> > Brightstorm limited
> > Tel: 07939252144
>
> > On 13 Jan 2010, at 22:06, SonnyBurnette  wrote:
>
> > > I am trying to create a model called "List" but I keep getting "Parse
> > > error: syntax error, unexpected T_LIST, expecting T_STRING" for the
> > > line of code "class List extends AppModel {"
>
> > > I haven't had this issue with my other models so I am assuming that
> > > this is a reserved word issue. Is that correct?
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp  
> > > others with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google  
> > > Groups "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this  
> > > group athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 1.3 on a production server?

2010-01-13 Thread LightDot
I've often been scratching my head while looking at software such as
osCommerce, which is now at v2.2 RC 2a, and back in 2003 it was at
v2.2 Milestone 2. LOL

Ah, well... I guess there is limited space for humour in software
development, so why not.

But CakePHP doesn't strike me as such a software. So... as much as I'm
tempted to switch existing and future applications to 1.3 ASAP, I've
decided to wait. Once 1.3 is designated as beta or RC, I'll
reconsider...

On Jan 12, 8:51 pm, Jamie  wrote:
> Fair enough. In that case, why the 'alpha' designation? What does that
> mean for CakePHP, and how does it differ from 'beta'? If the alpha
> release is so stable and has been publicly released, then I can't
> figure out why it's called alpha and not beta.
>
> On Jan 12, 11:02 am, "Larry E. Masters aka PhpNut" 
> wrote:
>
> > Why would I be sarcastic? How you follow the CakePHP project for any length
> > of time? You will notice the alpha releases are more stable then most
> > projects stable versions.
>
> > --
> > /**
> > * @author Larry E. Masters
> > * @var string $userName
> > * @param string $realName
> > * @returns string aka PhpNut
> > * @access  public
> > */
>
> > On Tue, Jan 12, 2010 at 12:57 PM, DanielMedia 
> > wrote:
>
> > > Just checking if you were being sarcastic Larry?
>
> > > On Jan 11, 8:20 pm, "Larry E. Masters aka PhpNut" 
> > > wrote:
> > > > Yes all client work is on 1.3
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to secure product code in a client installation

2010-01-13 Thread LightDot
In my experience, protecting PHP code is a pain. Two best known
solutions are Zend Guard and ionCube. Both require special PHP
modules, but these are quite common on hosting servers.

AFAIK, ionCube has provided the most secure solution in the past. It's
also quite affordable when compared with Zend Guard. I haven't checked
if it's protection has been broken, though, so you might want to look
into this before purchasing. There were some hints that it was broken
a couple of months back, but I couldn't find an actual proof.

Everything else is even worse than Zend Guard... and Zend Guard
protected applications can easily be decompiled at the moment. There
are other solutions but some of them are a complete joke - I did an
extensive research some months back and couldn't find anything else
really worth mentioning.

I'd say the best protection is one of the above solutions, combined
with the complexity of your application. Once you have thousands of
lines of code, without comments, etc Well hackers, good luck
stealing that, continuing development, providing support, etc. :)

Anyway, if you find a better solution, I'd be glad to hear about it.


On Jan 13, 3:21 am, IRoute  wrote:
> I want to develop a product using CakePHP which would be installed on client
> machines. How to develop the product using CakePHP in such a way that the
> code cannot be pirated, modified and used as a different product. Thanks in
> advance for any suggestions.
> --
> View this message in 
> context:http://old.nabble.com/How-to-secure-product-code-in-a-client-installa...
> Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Reserved Word Issue? Just need confirmation.

2010-01-13 Thread SonnyBurnette
So even creating a class named "List" causes issues I take it. I guess
I can fake the name with routing.

On Jan 13, 5:22 pm, mike karthauser  wrote:
> List is indeed a reserved 
> wordhttp://www.php.net/manual/en/reserved.keywords.php
>
> Mike Karthauser
> Brightstorm limited
> Tel: 07939252144
>
> On 13 Jan 2010, at 22:06, SonnyBurnette  wrote:
>
> > I am trying to create a model called "List" but I keep getting "Parse
> > error: syntax error, unexpected T_LIST, expecting T_STRING" for the
> > line of code "class List extends AppModel {"
>
> > I haven't had this issue with my other models so I am assuming that
> > this is a reserved word issue. Is that correct?
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help  
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google  
> > Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this  
> > group athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Capture views output into a file?

2010-01-13 Thread Nancy
Thanks for the suggestions!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Unable to save related table information

2010-01-13 Thread koala kid

Hi all,

using ORM for the first time and I'm having trouble getting my associations
all worked out. I'm unable to get my associated table data to save.Here's a
basic overview of my models:

Locations -> Parent
Rentals -> Belongs to Locations
Rates -> Belongs to Rentals

My code looks like this:

 array(
   'className'=> 'Rate',
   'dependent'=> true
   )
   );
   var $belongsTo = array(
   'Location' => array(
   'className' => 'Location',
   'fields'=> 'city'
   )
   );

}
?>

class Rate extends AppModel
{
   var $name = 'Rate';

   var $belongsTo = 'Rentals';

}

And my save looks like this:

$this->Rental->saveAll($this->data)

However only data to the Rental table is being saved and not to the Rate
table. Can anyone tell me what I am missing. I don't have a controller for
Rates as there are no direct functions to run against them, does this
matter?


Thanks.
-- 
View this message in context: 
http://old.nabble.com/Unable-to-save-related-table-information-tp27153345p27153345.html
Sent from the CakePHP mailing list archive at Nabble.com.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Reserved Word Issue? Just need confirmation.

2010-01-13 Thread mike karthauser

List is indeed a reserved word
http://www.php.net/manual/en/reserved.keywords.php

Mike Karthauser
Brightstorm limited
Tel: 07939252144

On 13 Jan 2010, at 22:06, SonnyBurnette  wrote:


I am trying to create a model called "List" but I keep getting "Parse
error: syntax error, unexpected T_LIST, expecting T_STRING" for the
line of code "class List extends AppModel {"

I haven't had this issue with my other models so I am assuming that
this is a reserved word issue. Is that correct?
Check out the new CakePHP Questions site http://cakeqs.org and help  
others with their CakePHP related questions.


You received this message because you are subscribed to the Google  
Groups "CakePHP" group.

To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this  
group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Reserved Word Issue? Just need confirmation.

2010-01-13 Thread SonnyBurnette
I am trying to create a model called "List" but I keep getting "Parse
error: syntax error, unexpected T_LIST, expecting T_STRING" for the
line of code "class List extends AppModel {"

I haven't had this issue with my other models so I am assuming that
this is a reserved word issue. Is that correct?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Add new items to a select box?

2010-01-13 Thread McScreech
I went on to another problem for now, will extract an example soon.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cache filenaming

2010-01-13 Thread Josh
i have a cache engine set up but i'm still working out the filename
format. I was thinking something like:

microtime() - md5($userId) - $datatype

is there a significant performance issue with longer filenames? these
would be around 35 chars. i was hoping to keep the microtime as-is to
facilitate a garbage collector chron job.

any thoughts?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: App::import at the beginning of a file?

2010-01-13 Thread Josh
thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Pagination with 2nd order recursive conditions filter

2010-01-13 Thread John Andersen
You are welcome :)

I just have a lot of HABTM relationships, but I have no wish to define
all these joins. It is kind of non-object oriented solution, that the
controller needs to know how to define relationships/joins for
pagination.

My change to Containable mostly ensures that I can make conditions on
HABTM related tables without having the need to present their content.
And that is what I require most.

Wish you luck, enjoy,
   John

On Jan 13, 9:13 pm, thomaus  wrote:
> Thanks for your help. You method perfectly works (unless the OR
> condition with pagination filters) but I think the smartest way (and
> simpliest way) to do is the one I found in this 
> blog:http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-...
>
> But still, Cake should let the include pagination with
> hasAndBelongsToMany.
>
> Thanks again!
>
> On Jan 12, 8:29 pm, John Andersen  wrote:
>
> > Hej Thomaus,
>
> > I have a modified Containable behaviour, that may help you solve your
> > problem.
>
> > Find it herehttp://bin.cakephp.org/view/763226357andplace it in
> > your app/models/behaviours directory, it will then replace the CakePHP
> > Containable behaviour.
>
> > I can now make finds that looks like:
> > [code]
> >       $rows = $this->find(
> >          'all', array(
> >             'contain' => array('Author'),
> >             'conditions' => array('Collection.name' => 'recent'),
> >             'order' => array('Article.created' => 'DESC')
> >          )
> >       );
> > [/code]
>
> > The above will find all Article with their Author, for which it
> > applies that the article is included in the Collection with the name
> > "recent"
>
> > The models are related as:
> > Author hasMany Article / Article belongsTo Author
> > Article hasAndBelongsToMany Collection & reverse
>
> > The change to Containable takes the Collection model in the condition
> > and makes an INNER JOIN through the join table and an INNER JOIN with
> > the collections table.
>
> > The final SQL statement looks as:
> > [code]
> > SELECT `Article`.`id`, `Article`.`title`, ..., `Author`.`id`,
> > `Author`.`name`, ...
> > FROM `articles` AS `Article`
> > INNER JOIN articles_collections AS `ArticlesCollection` ON
> > (`ArticlesCollection`.`article_id` = `Article`.`id`)
> > INNER JOIN collections AS `Collection` ON (`Collection`.`id` =
> > `ArticlesCollection`.`collection_id`)
> > LEFT JOIN `authors` AS `Author` ON (`Article`.`author_id` =
> > `Author`.`id`)
> > WHERE `Collection`.`name` = 'recent' ORDER BY `Article`.`created` DESC
> > [/code]
>
> > I have tried it with Paginate and it is Paginate friendly :)
>
> > If you can use it, take it and have fun :)
> > Enjoy,
> >    John
>
> > On Jan 12, 8:30 pm, thomaus  wrote:
>
> > > I can't believe there are no solution to this problem. I mean, it's
> > > just paginating a model with a second order filter!
>
> > > HELP! HELP! HELP! This is urgent!
>
> > > On Jan 11, 8:50 am, Fran Iglesias  wrote:
>
> > > > Hi,
> > > > El 11/01/2010, a las 8:35, Jeremy Burns escribió:
>
> > > > > I have had the very same annoying problem and couldn't solve it. I  
> > > > > wanted to do (effectively - using the good old blog as an example):
>
> > > > If you are writing your custom find types to perform the search as in
>
> > > >http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define...
>
> > > > you could try this sort of hack:
>
> > > >http://code.assembla.com/milhojas/subversion/nodes/app_model.php?rev=394
>
> > > > (I override the method in the app_model to avoid touch the core).
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Pagination with 2nd order recursive conditions filter

2010-01-13 Thread thomaus
Thanks for your help. You method perfectly works (unless the OR
condition with pagination filters) but I think the smartest way (and
simpliest way) to do is the one I found in this blog:
http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/

But still, Cake should let the include pagination with
hasAndBelongsToMany.

Thanks again!

On Jan 12, 8:29 pm, John Andersen  wrote:
> Hej Thomaus,
>
> I have a modified Containable behaviour, that may help you solve your
> problem.
>
> Find it herehttp://bin.cakephp.org/view/763226357and place it in
> your app/models/behaviours directory, it will then replace the CakePHP
> Containable behaviour.
>
> I can now make finds that looks like:
> [code]
>       $rows = $this->find(
>          'all', array(
>             'contain' => array('Author'),
>             'conditions' => array('Collection.name' => 'recent'),
>             'order' => array('Article.created' => 'DESC')
>          )
>       );
> [/code]
>
> The above will find all Article with their Author, for which it
> applies that the article is included in the Collection with the name
> "recent"
>
> The models are related as:
> Author hasMany Article / Article belongsTo Author
> Article hasAndBelongsToMany Collection & reverse
>
> The change to Containable takes the Collection model in the condition
> and makes an INNER JOIN through the join table and an INNER JOIN with
> the collections table.
>
> The final SQL statement looks as:
> [code]
> SELECT `Article`.`id`, `Article`.`title`, ..., `Author`.`id`,
> `Author`.`name`, ...
> FROM `articles` AS `Article`
> INNER JOIN articles_collections AS `ArticlesCollection` ON
> (`ArticlesCollection`.`article_id` = `Article`.`id`)
> INNER JOIN collections AS `Collection` ON (`Collection`.`id` =
> `ArticlesCollection`.`collection_id`)
> LEFT JOIN `authors` AS `Author` ON (`Article`.`author_id` =
> `Author`.`id`)
> WHERE `Collection`.`name` = 'recent' ORDER BY `Article`.`created` DESC
> [/code]
>
> I have tried it with Paginate and it is Paginate friendly :)
>
> If you can use it, take it and have fun :)
> Enjoy,
>    John
>
> On Jan 12, 8:30 pm, thomaus  wrote:
>
> > I can't believe there are no solution to this problem. I mean, it's
> > just paginating a model with a second order filter!
>
> > HELP! HELP! HELP! This is urgent!
>
> > On Jan 11, 8:50 am, Fran Iglesias  wrote:
>
> > > Hi,
> > > El 11/01/2010, a las 8:35, Jeremy Burns escribió:
>
> > > > I have had the very same annoying problem and couldn't solve it. I  
> > > > wanted to do (effectively - using the good old blog as an example):
>
> > > If you are writing your custom find types to perform the search as in
>
> > >http://rafaelbandeira3.wordpress.com/2008/08/28/the-new-way-to-define...
>
> > > you could try this sort of hack:
>
> > >http://code.assembla.com/milhojas/subversion/nodes/app_model.php?rev=394
>
> > > (I override the method in the app_model to avoid touch the core).
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Using pagination with added fields

2010-01-13 Thread dw
In my app i have an index of Proposals. I this view i need to show if
a proposal has been rated yet by the user. What i am doing is grabbing
all the proposals with a find('all'), then looping through and calling
a method in the Rating model to check for ratings for that proposal by
the current User. If the method returns true, then a new field Proposal
['rated'] is added to the Proposals array which in turn is checked in
the view whether to display a check mark or something for that
Proposal. Actually, the field is added either way, but with a true or
false, depending.

Set up (in case it's not clear):
Proposal hasMany Rating
Rating belongsTo Proposal
Rating belongsTo User

(there is a Criteria field on the ratings table, too, so that's why i
didn't do a HABTM, but the criteria aren't important in this example.)

When i try to use the paginator helper, i lose that 'rated' field. Is
there a way to use pagination and keep records in the array which have
been added?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: A simple User Management Plugin

2010-01-13 Thread robustsolution
Azril, believe me you did a very good job. just keep trusting
yourself / be yourself and you are the winner soon or later

Dear BrendonKoz, I agree with you, some points are application
specific.

On Jan 13, 5:04 pm, BrendonKoz  wrote:
> I disagree with 1-3, 5, and 8.  These are all project specific
> requirements that may change depending on the project.  Obviously 4
> and 6 can be argued as project specific as well, but much less often
> do I see these fluctuate.  7 is good because you mentioned that if
> further permissions are needed, an entirely different system should be
> used.  ;)
>
> There is no single "right" or "wrong" approach.  If it works, it
> should help *at least* one other person!  :)
>
> Good job on your first plugin attempt, Azril Nazli!
>
> On Jan 13, 8:05 am, robustsolution  wrote:
>
> > thanks for sharing us your work.
> > It was a very good start.
> > some quick notes:
> > 1)after signup user should receive an activation link to activate his
> > account not to activate the account by default. in this case use
> > should autologin
> > 2)user should be able to login using the password with (either his
> > username or his email)
> > 3)user should not be able to change his username in edit mode, but he
> > could change always his email address in edit mode, in this case his
> > account will be deactivated(banned) until he verifies that he is the
> > owner of the new email address
> > 4)the resetpassword link should be used only for one reset password
> > operation, for security reason. same for activation link
> > 5)after successfully resetting the password, or activating the account
> > user should autologin to the system
> > 6) user life cycle: created,activated,banned then ,activated,banned,
> > activated,banned, activated,banned,activated,banned, etc... so just
> > three status is enough.
> > 7)in case you have either user or admin account for the user record,
> > is_admin is enough, otherwise a light or heavy weight permission
> > system should be required
> > 8)cookies should always be a user choice that developer could not
> > ignore it
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Remove query String from URL

2010-01-13 Thread Miles J
And to answer your question, you can store these values in the Session
for the duration of the redirect.

On Jan 12, 4:08 pm, David Brisebois  wrote:
> Actually you could send a POST request using PHP's 
> header()http://www.php.net/manual/fr/function.header.php#89447
>
> Otherwise, you will have to pass parameters through a session or a
> cookie... I guess there is nothing else available.
>
> On 12 jan, 13:16, Ankesh27  wrote:
>
> > I can not have post, It is something that i am redirecting from some page to
> > some page.
>
> > Now i need those IDS to be hidden in the URL
>
> > David Brisebois wrote:
>
> > > Uh by doing a POST request ?
>
> > > On 12 jan, 07:57, Ankesh27  wrote:
> > >> Hello All,
>
> > >> Can any 1 let me know how can i remove the parameters from the URL and
> > >> show
> > >> a simple URL on browser
>
> > >> Something like  http://mysite.com/users/view/1/2/3Shouldlook
> > >> likehttp://mysite.com/users/view
>
> > >> Do let me know if i am not clear on putting up the question
>
> > >> Thanks,
> > >> Ankesh
> > >> --
> > >> View this message in
> > >> context:http://n2.nabble.com/Remove-query-String-from-URL-tp4291372p4291372.html
> > >> Sent from the CakePHP mailing list archive at Nabble.com.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > --
> > View this message in 
> > context:http://n2.nabble.com/Remove-query-String-from-URL-tp4291372p4293375.html
> > Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Remove query String from URL

2010-01-13 Thread Miles J
Yes a POST would work, BUT if this is like a users profile (which it
seems like), or any type of page where you need to view data based on
an ID, this is the only approach (i.e., GET).

POST is just taking a step backwards in design.

On Jan 12, 4:08 pm, David Brisebois  wrote:
> Actually you could send a POST request using PHP's 
> header()http://www.php.net/manual/fr/function.header.php#89447
>
> Otherwise, you will have to pass parameters through a session or a
> cookie... I guess there is nothing else available.
>
> On 12 jan, 13:16, Ankesh27  wrote:
>
> > I can not have post, It is something that i am redirecting from some page to
> > some page.
>
> > Now i need those IDS to be hidden in the URL
>
> > David Brisebois wrote:
>
> > > Uh by doing a POST request ?
>
> > > On 12 jan, 07:57, Ankesh27  wrote:
> > >> Hello All,
>
> > >> Can any 1 let me know how can i remove the parameters from the URL and
> > >> show
> > >> a simple URL on browser
>
> > >> Something like  http://mysite.com/users/view/1/2/3Shouldlook
> > >> likehttp://mysite.com/users/view
>
> > >> Do let me know if i am not clear on putting up the question
>
> > >> Thanks,
> > >> Ankesh
> > >> --
> > >> View this message in
> > >> context:http://n2.nabble.com/Remove-query-String-from-URL-tp4291372p4291372.html
> > >> Sent from the CakePHP mailing list archive at Nabble.com.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > --
> > View this message in 
> > context:http://n2.nabble.com/Remove-query-String-from-URL-tp4291372p4293375.html
> > Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Get number of found records of previously performed find query

2010-01-13 Thread Miles J
Just use the same conditions and query, but change the type from all
to count.

find("count", array("limit" => 10));

It'll do another query, but it would get the exact number.

On Jan 13, 3:44 am, Deine Mutter
 wrote:
> will that execute the same query again as in making a request to the
> db or is that automagically retrieved from the cache? or do i need to
> configure special cage settings for that?
>
> On 13 Jan., 07:02, "Dr. Loboto"  wrote:
>
> > Only make same "count" query.
>
> > On Jan 13, 12:54 am, Deine Mutter
>
> >  wrote:
> > > hey as i said count($array) is useless because the array containing
> > > the select query result has also a limit clause -> means: count
> > > ($array) will always result in the value i gave to the limit clause in
> > > my sql statement.
>
> > > any other ideas?
>
> > > On 12 Jan., 15:50, scs  wrote:
>
> > > > you could just use the php array count :
> > > > 
>
> > > > On Jan 12, 7:21 am, Deine Mutter
>
> > > >  wrote:
> > > > > Hey,
>
> > > > > does Cake give me a way to find out the number of records retrieved by
> > > > > a find("all", array("limit" => 10));? It's basically what
> > > > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of
> > > > > course i could make the same query twice, first a find("all") and then
> > > > > a find("count") without the LIMIT clause, but that doesn't seem very
> > > > > clever to me considering performance.
> > > > > Is that mabye solved via query caching or sth like that? I'm unable to
> > > > > find clues how to solve it anywhere :(
>
> > > > > Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


RE: Forms: HABTM with additional fields in join table

2010-01-13 Thread Dave
I had the same problem with very little help but my situation was different
and had multiple models using the join table, but after a lot of trial an
error I managed to get it.

I scrapped the HABTM joins and went with the hasMany aproach. Uses the same
number of models, use you standard modela_modelb join table add all the
fields you want. I needed a checkbox but ended up switching to a select as
it was more ideal for my setup but the problem that I had was population of
the fields because the data array came back as [0][1][2] and it never lined
up with my field keys so I had to edit the array info to return the array
like 
[6]=> something
[9]=> you get the idea

And my fields were

modelA.6.name
modelA.9.name

Degug your data to see what comes back and from there figure out how to get
what you need from what you have.

Dave



-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Ernesto
Sent: January-13-10 12:31 PM
To: CakePHP
Subject: Forms: HABTM with additional fields in join table

Hello.

Person HABTM Training

i'm coding the Person::add and Person::edit views

there's plenty of examples/tutorials wich explains how to code an HABTM
form... but unfortunately none of them explains how to add additional
information in the join table (in my case "who_added_this_relationship",
"expiration_date" and "notes").

almost forgot... training_id should be a select box.

can someone help me plz?




No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/13/10
04:05:00

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How can I perform a redirct on an invalid page request

2010-01-13 Thread David Brisebois
It would be way much better to redirect pages with a Moved permanently
status (301) to tell search engines that the URL changed

If your pages name are the same as they were before, here would be the
code to put in your .htaccess (didn't tested thought ) :
RedirectMatch 301 (.*)\.asp$ http://myserver.com/pages$1

On 13 jan, 04:41, John Andersen  wrote:
> I would think that a rewrite rule would take care of that. Don't know
> how to write one, but look into it and in case of questions, ask :)
> Enjoy,
>    John
>
> On Jan 13, 10:26 am, CapeTownGuy  wrote:
>
>
>
> > Hi, I migrated my website from ASP to cake.  How do I get my pages
> > which are indexed under Google as xxx.com/xxx.asp to redirect to a
> > default page on my new website instead of showing an error message ?
>
> > Thank you in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: A simple User Management Plugin

2010-01-13 Thread BrendonKoz
I disagree with 1-3, 5, and 8.  These are all project specific
requirements that may change depending on the project.  Obviously 4
and 6 can be argued as project specific as well, but much less often
do I see these fluctuate.  7 is good because you mentioned that if
further permissions are needed, an entirely different system should be
used.  ;)

There is no single "right" or "wrong" approach.  If it works, it
should help *at least* one other person!  :)

Good job on your first plugin attempt, Azril Nazli!

On Jan 13, 8:05 am, robustsolution  wrote:
> thanks for sharing us your work.
> It was a very good start.
> some quick notes:
> 1)after signup user should receive an activation link to activate his
> account not to activate the account by default. in this case use
> should autologin
> 2)user should be able to login using the password with (either his
> username or his email)
> 3)user should not be able to change his username in edit mode, but he
> could change always his email address in edit mode, in this case his
> account will be deactivated(banned) until he verifies that he is the
> owner of the new email address
> 4)the resetpassword link should be used only for one reset password
> operation, for security reason. same for activation link
> 5)after successfully resetting the password, or activating the account
> user should autologin to the system
> 6) user life cycle: created,activated,banned then ,activated,banned,
> activated,banned, activated,banned,activated,banned, etc... so just
> three status is enough.
> 7)in case you have either user or admin account for the user record,
> is_admin is enough, otherwise a light or heavy weight permission
> system should be required
> 8)cookies should always be a user choice that developer could not
> ignore it
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing Parent Record Data

2010-01-13 Thread emptywalls
You make it sound so easy! I will give this a try tonight, and then
report back. Thank you so much for the response.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Associations to other models

2010-01-13 Thread Kareem Sabri
Excellent, thank you!

On Jan 13, 2:44 am, John Andersen  wrote:
> You have to specify recursive 2 in your find statement. 
> See:http://book.cakephp.org/view/73/Retrieving-Your-Data#find-449
> andhttp://book.cakephp.org/view/439/recursive
> for information on the recursive option.
> Enjoy,
>    John
>
> On Jan 13, 2:35 am, Kareem Sabri  wrote:
>
>
>
> > Hello,
>
> > I have a model called sites. A Site hasAndBelongToMany Entries. An
> > Entry belongsTo one Type and one Saving.
>
> > So, I have an entries_sites table, and an entry has a type_id and a
> > saving_id
>
> > I want to fetch all Entries that belong to a Site, and also get the
> > associated Type and Saving for each Entry. The problem is, if I fetch
> > a Site it will fetch all associated Entries along with it, but won't
> > also fetch the Type and Saving associated with each entry. If I fetch
> > Entries I can't query them based on site_id (as far as I know) because
> > that field isn't in the table, it's in the entries_sites table.
>
> > Is there a way to fetch a Site and get all associated Entries and the
> > associated Type and Saving for each Entry? Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Forms: HABTM with additional fields in join table

2010-01-13 Thread Ernesto
Hello.

Person HABTM Training

i'm coding the Person::add and Person::edit views

there's plenty of examples/tutorials wich explains how to code an
HABTM form... but unfortunately none of them explains how to add
additional information in the join table (in my case
"who_added_this_relationship", "expiration_date" and "notes").

almost forgot... training_id should be a select box.

can someone help me plz?



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Query for fetching data from two tables

2010-01-13 Thread John Andersen
I assume that you have defined the following associations/
relationships in your models:
Detail belongsTo User / User hasMany Details

If you have the Detail record, then you can make the following query
from the Detail controller side:
[code]
$this->Detail->User->find(
   'all', array(
  'recursive' => 1,
  'conditions' => array(
 'User.id' => $this->data['Detail']['user_id']
  )
   )
);
[/code]

Enjoy,
   John

On Jan 13, 9:51 am, Manu  wrote:
> I have two tables details and users . I am getting the Detail.id from
> this i will be able to know User.id and then from users table i have
> to fetch user data like(name, email, etc). so i want to make query in
> cake pattern that in result should give me data of both the table.
> Here's simple query that i have made but couldnt get it going in cake
> pattern.
>
> SELECT d.vps_name, d.machine_type, d.ipAddress, d.rdp_user,d.rdp_pass,
> d.dc_user, d.dc_pass, d.status, d.user_id, d.order_id,u.email,
> u.fname, u.lname         FROM details as d
> LEFT JOIN users as u
> ON d.user_id = u.id
> WHERE d.user_id = u.id
>
> Thanks in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: for getting some information

2010-01-13 Thread John Andersen
Are you using CakePHP?
If yes, then pass the user data to the view and present what you need
of it to the user.
Enjoy,
   John

On Jan 13, 11:27 am, Azeem  wrote:
> iam a php developer and i have a task but iam liitle bit confuse
> because i have a task in which ihave show the user data which is login
> but when a user login the whole data from databse is fetched so how
> can i solve this problem
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: trying to retrieve data from two tables

2010-01-13 Thread John Andersen
If you really want to do a UNION then use the models query method.
http://book.cakephp.org/view/456/query
Enjoy,
   John

On Jan 13, 2:24 pm, remotb  wrote:
> hi
> i have two tables, quite similar to each other. i want to show the
> data from both tables(same columns) in one HTML table using cakephp.
> i already tried making a UNION view in the DB, which cannot be done in
> cakephp(it is not recognize "view" as "table").
>
> retrieving data from each table seperatly and combine them later is
> hard to sort.
>
> what can i do?
>
> thx,
> remotb
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread John Andersen
Do not format the date when you are retrieving it from the database.
Format the date when you are presenting it to the user in a view. Use
the Time helper for this!
Enjoy,
   John

On Jan 13, 4:27 pm, codef0rmer  wrote:
> It already ate my 1+ hour to figure out the problem. I hope, i'll get
> a help here...
>
> User Table Structure:
> id
> gender_salutation_id
> first_name
> middle_name
> last_name
> dob
> email
>
> GenderSalutation table Structure:
> id
> name
>
> I used below code to fetch the full name and formatted dob:
> $arrUser = $this->User->find("first", array(
>                         "conditions" => array("User.email" => 
> $this->Session->read
> ("email")),
>                         "fields" => array(
>                                 "GenderSalutation.name", "User.first_name", 
> "User.middle_name",
> "User.last_name", "DATE_FORMAT(User.created, '%d') AS created",
> "User.dob",
> ),
>                 ));
>
> which returns:
> Array
> (
>     [GenderSalutation] => Array
>         (
>             [name] => Mr.
>         )
>
>     [User] => Array
>         (
>             [first_name] => foo
>             [middle_name] => bar
>             [last_name] => foo
>             [dob] => 1985-10-29 19:13:29
>         )
>
>     [0] => Array
>         (
>             [created] => 13
>         )
>
> )
>
> I want [created] => 13 in [User] key.
> What do i do? please help...
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)

2010-01-13 Thread codef0rmer
It already ate my 1+ hour to figure out the problem. I hope, i'll get
a help here...

User Table Structure:
id
gender_salutation_id
first_name
middle_name
last_name
dob
email

GenderSalutation table Structure:
id
name

I used below code to fetch the full name and formatted dob:
$arrUser = $this->User->find("first", array(
"conditions" => array("User.email" => 
$this->Session->read
("email")),
"fields" => array(
"GenderSalutation.name", "User.first_name", 
"User.middle_name",
"User.last_name", "DATE_FORMAT(User.created, '%d') AS created",
"User.dob",
),
));

which returns:
Array
(
[GenderSalutation] => Array
(
[name] => Mr.
)

[User] => Array
(
[first_name] => foo
[middle_name] => bar
[last_name] => foo
[dob] => 1985-10-29 19:13:29
)

[0] => Array
(
[created] => 13
)

)

I want [created] => 13 in [User] key.
What do i do? please help...
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: A simple User Management Plugin

2010-01-13 Thread Azril Nazli
TQVM !
Your comments shed a brighter light for beginner cake developer like
me.

In my country,Malaysia, doing things using a framework is very very
new. For example, out of 5 programmer, only 1 or 2 have  heard of Ruby
On Rails

The code is written in minimal way so others can extend it easily.

On how the plugin's app_controller loaded in main application
app_controller is something to look upon. Actually I was planning to
use requestAction() way.

On Jan 13, 9:05 pm, robustsolution  wrote:
> thanks for sharing us your work.
> It was a very good start.
> some quick notes:
> 1)after signup user should receive an activation link to activate his
> account not to activate the account by default. in this case use
> should autologin
> 2)user should be able to login using the password with (either his
> username or his email)
> 3)user should not be able to change his username in edit mode, but he
> could change always his email address in edit mode, in this case his
> account will be deactivated(banned) until he verifies that he is the
> owner of the new email address
> 4)the resetpassword link should be used only for one reset password
> operation, for security reason. same for activation link
> 5)after successfully resetting the password, or activating the account
> user should autologin to the system
> 6) user life cycle: created,activated,banned then ,activated,banned,
> activated,banned, activated,banned,activated,banned, etc... so just
> three status is enough.
> 7)in case you have either user or admin account for the user record,
> is_admin is enough, otherwise a light or heavy weight permission
> system should be required
> 8)cookies should always be a user choice that developer could not
> ignore it
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


trying to retrieve data from two tables

2010-01-13 Thread remotb
hi
i have two tables, quite similar to each other. i want to show the
data from both tables(same columns) in one HTML table using cakephp.
i already tried making a UNION view in the DB, which cannot be done in
cakephp(it is not recognize "view" as "table").

retrieving data from each table seperatly and combine them later is
hard to sort.

what can i do?

thx,
remotb
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


for getting some information

2010-01-13 Thread Azeem
iam a php developer and i have a task but iam liitle bit confuse
because i have a task in which ihave show the user data which is login
but when a user login the whole data from databse is fetched so how
can i solve this problem
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Query for fetching data from two tables

2010-01-13 Thread Manu
I have two tables details and users . I am getting the Detail.id from
this i will be able to know User.id and then from users table i have
to fetch user data like(name, email, etc). so i want to make query in
cake pattern that in result should give me data of both the table.
Here's simple query that i have made but couldnt get it going in cake
pattern.

SELECT d.vps_name, d.machine_type, d.ipAddress, d.rdp_user,d.rdp_pass,
d.dc_user, d.dc_pass, d.status, d.user_id, d.order_id,u.email,
u.fname, u.lname FROM details as d
LEFT JOIN users as u
ON d.user_id = u.id
WHERE d.user_id = u.id

Thanks in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Form app_helper output

2010-01-13 Thread RhythmicDevil
Mark,
thanks for the reply. I am inclined to agree with you. I was just
experimenting with the CakePHP helpers to see what was available. I
was just very surprised at how that failed.

Thanks
Steve


On Jan 12, 4:21 pm, euromark  wrote:
> actually i dont like that approach
> but i guess thats everybody's own opinion
>
> not without reason even the very famous flash() function now
> finally returns the values in cake1.3 instead of echoing it
> same with the debug sql table
>
> there might still be some cases where you have to chain the strings
> and return them to somewhere else
> this way you put a spoke in your wheel
>
> so better returning everything and echoing it extactly where you want
> to have it.
> there is no overhead to this at all - quite the opposite actually
>
> greets
> mark
>
> On 12 Jan., 21:21, RhythmicDevil  wrote:
>
> > Hi,
> > I did not want to type echo statements into my views so I took the
> > suggestion of the CakePHP docs and added the following function to my
> > app_helper:
>
> > public function output($string)
> > {
> >      echo parent::output($string."\n");
>
> > }
>
> > And I use it like this:
>
> >          >                 $form->create($options = array('action' => 'login'));
> >                 $form->input('User.username');
> >                 $form->input('User.password');
> >                 $form->button(__('Login', true), array('type'=>'submit',
> > 'class'=>'ui-state-default'));
> >                 $form->end();
> >         ?>
>
> > The output looks like this:
>
> > 
> > Username
> >  > id="UserUsername" />
> > 
> > Password
> >  > id="UserPassword" />
> > 
>
> > 
> > 
>
> > Why are the inputs not inside the divs where they belong? If I remove
> > the function and replace the echos for each of the form elements it
> > works. Seems wrong that I can write a function so that I dont have to
> > type an echo when using the helpers but then I have to manually add
> > the containing div.
>
> > One other related question. How do I accomplish using  the Html helper
> > method tableCells and placing form elements in the cells? I put the
> > form element method as an element of the array that is passed to the
> > tableCells method I get no output.
>
> > Any help would be appreciated.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: highest traffic cakePHP 1.2 sites?

2010-01-13 Thread Maurits van der Schee


Hi,

On most days we serve over 600k pageviews on http://www.rekentuin.nl
I had to switch to memcache, but I can still run it on a single machine.

Maurits

keymaster wrote:

This is not meant to be a post on "evaluating cake's performance" or
anything like that.  I use cake alot and have no issues.

I also know that for those who utilize cake 1.2's various features for
performance optimization to the fullest, there are very few issues of
performance remaining even for the busiest apps.

So, this is really just a curiosity question. The kind of thing one
thinks about when one doesn't feel like working :-)

By chance, does anyone have a feel for which sites (other than
addons.mozilla.org which is cakePHP1.1 anyways) might be among the
highest traffic'ed cakePHP 1.2 sites ?




Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: A simple User Management Plugin

2010-01-13 Thread robustsolution
thanks for sharing us your work.
It was a very good start.
some quick notes:
1)after signup user should receive an activation link to activate his
account not to activate the account by default. in this case use
should autologin
2)user should be able to login using the password with (either his
username or his email)
3)user should not be able to change his username in edit mode, but he
could change always his email address in edit mode, in this case his
account will be deactivated(banned) until he verifies that he is the
owner of the new email address
4)the resetpassword link should be used only for one reset password
operation, for security reason. same for activation link
5)after successfully resetting the password, or activating the account
user should autologin to the system
6) user life cycle: created,activated,banned then ,activated,banned,
activated,banned, activated,banned,activated,banned, etc... so just
three status is enough.
7)in case you have either user or admin account for the user record,
is_admin is enough, otherwise a light or heavy weight permission
system should be required
8)cookies should always be a user choice that developer could not
ignore it

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


named parameters in pages_controller

2010-01-13 Thread blickensdoer...@googlemail.com
hi everyone,

i have a problem with the url helper in the pages_controller:

i want to append a named parameter to the current url .

in all controllers this works fine, but the pages_controller does
always something like this:

/pages/display/pages/info/param:name

i've tried various ways to pass the url to the helper, even things
like:

$html->url($this->here.'/param:name')

but nothing works

anyone knows help?

ty+regards
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: highest traffic cakePHP 1.2 sites?

2010-01-13 Thread Jon Bennett
> We serve >35M PVs (>2M visits) per month.

Who/what is 'we'?

j


-- 
jon bennett - www.jben.net - blog.jben.net
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Get number of found records of previously performed find query

2010-01-13 Thread Deine Mutter
will that execute the same query again as in making a request to the
db or is that automagically retrieved from the cache? or do i need to
configure special cage settings for that?

On 13 Jan., 07:02, "Dr. Loboto"  wrote:
> Only make same "count" query.
>
> On Jan 13, 12:54 am, Deine Mutter
>
>  wrote:
> > hey as i said count($array) is useless because the array containing
> > the select query result has also a limit clause -> means: count
> > ($array) will always result in the value i gave to the limit clause in
> > my sql statement.
>
> > any other ideas?
>
> > On 12 Jan., 15:50, scs  wrote:
>
> > > you could just use the php array count :
> > > 
>
> > > On Jan 12, 7:21 am, Deine Mutter
>
> > >  wrote:
> > > > Hey,
>
> > > > does Cake give me a way to find out the number of records retrieved by
> > > > a find("all", array("limit" => 10));? It's basically what
> > > > SQL_CALC_FOUND_ROWS in combination with SELECT FOUND_ROWS does. Of
> > > > course i could make the same query twice, first a find("all") and then
> > > > a find("count") without the LIMIT clause, but that doesn't seem very
> > > > clever to me considering performance.
> > > > Is that mabye solved via query caching or sth like that? I'm unable to
> > > > find clues how to solve it anywhere :(
>
> > > > Thanks in advance!
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: [imz.bazet] A simple User Management Plugin

2010-01-13 Thread mufti ali
Great job  Azril Nazli, this plugin very useful for beginner. I will review
this plugin in my website.Very nice :D

http://wordtaps.com
http://blogfreakz.com
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


[imz.bazet] A simple User Management Plugin

2010-01-13 Thread Azril Nazli
Hi, I just wrote my first plugin using various knowledge gathered from
the internet.

URL : http://jobber.my/imz/ ( demo and downloads )

Features

* User signup
* User login
* User logout
* User change profile
* User forgot password ( tickets )
* Administration via Admin Scaffold

Source code
1. http://mamakspot.googlecode.com/files/cake_projects.zip ( with
sample app )
2. http://mamakspot.googlecode.com/files/bazet.zip ( plugin only )

** just for learning guide, not optimized for production
** targetted usergroup ( cakephp beginner )
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing Parent Record Data

2010-01-13 Thread Alexandru Ciobanu

Use containable in your song model:

var $actsAs = array('Containable');

 var $belongsTo = array(
'ParentSong' => array(
'className' => 'Song',
'foreignKey' => 'parent_id',
));

When retrieving records contain ParentSong.

E.g.

$this->find('all', array('contain' => array('ParentSong')));

http://book.cakephp.org/view/474/Containable
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: ORM Help -> Unable to save related table information

2010-01-13 Thread Alexandru Ciobanu

On 1/13/2010 4:10 AM, koala kid wrote:


$this->Rental->saveAll($this->data)

   

http://book.cakephp.org/view/75/Saving-Your-Data

It's all there.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How can I perform a redirct on an invalid page request

2010-01-13 Thread John Andersen
I would think that a rewrite rule would take care of that. Don't know
how to write one, but look into it and in case of questions, ask :)
Enjoy,
   John

On Jan 13, 10:26 am, CapeTownGuy  wrote:
> Hi, I migrated my website from ASP to cake.  How do I get my pages
> which are indexed under Google as xxx.com/xxx.asp to redirect to a
> default page on my new website instead of showing an error message ?
>
> Thank you in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP HABTM Plugin table naming conventions (for 1.3)

2010-01-13 Thread Grzegorz Pawlik
Is it hard to check?

On 12 Sty, 20:06, Parris  wrote:
> Would that not cause namespace issues if there were more than one
> controller with the same name in the entire app? Doesn't the model
> need to be named PollPoll not just Poll?
>
> On Jan 12, 12:32 am, Grzegorz Pawlik  wrote:
>
> > In 1.2 I would name model Poll, and Tag, and in PollAppModel set
> > $tablePrefix = "poll_"
> > So You would have poll_polls, poll_tags and poll_posts_tags. As fas as
> > I remember - that worked :)
>
> > Btw, when You define relations It would be for Poll model
> > var $habtm = array("Poll.Tag");
>
> > Good luck
>
> > I'm not familiar with 1.3
>
> > On 12 Sty, 04:39, Parris  wrote:
>
> > > I posted this on stackoverflow, but didn't really get the response I
> > > was looking for
>
> > > Hi everyone,
> > > I know naming conventions for tables used by plugins generally start
> > > with the name of the plugin and then the model pluralized. For example
> > > lets say I had a plugin called Poll, with a model also called PollPoll
> > > and another model called PollTag then the resulting table names would
> > > be poll_polls and poll_tags. They would also have a habtm relationship
> > > so what is the convention for that table name? I believe it would
> > > poll_poll_polls_poll_tags, although it is a little redundant it makes
> > > sense since the first poll_ represents the name of the plugin, while
> > > poll_polls and poll_tags relates to the models.
>
> > > Also have any naming conventions changed for plugins in 1.3? Is the
> > > above stated correct? Thanks!
>
> > > By the way,  just to make this clear, no other models would really
> > > access this plugin's tables, which would make it suitable as a
> > > plugin.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


How can I perform a redirct on an invalid page request

2010-01-13 Thread CapeTownGuy
Hi, I migrated my website from ASP to cake.  How do I get my pages
which are indexed under Google as xxx.com/xxx.asp to redirect to a
default page on my new website instead of showing an error message ?

Thank you in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: highest traffic cakePHP 1.2 sites?

2010-01-13 Thread Matt Bianco
We serve >35M PVs (>2M visits) per month.

Alexa isn't really relevant here in Germany, so I assume we have quite
a bad rank.

M
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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