Re: Circularity with beforeFilter calling redirect

2006-05-23 Thread AD7six

Hi GregL,

in your UserController, override the beforeFilter, so that it doesn't
redirect - then you are home free ;).

You could if you want reverse the logic for the login function, so that
logged in users can access the login page.

Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Looking for examples

2006-05-23 Thread Peter

Hello,

I am completely new to CakePHP and somewhat new to web development in
general. I am trying to figure out what the best setup is for web pages
that do not fall within the typical Cake concepts.

Any examples or somewhat extended tutorials going beyond the one table
CRUD pages would be great.

To start with, I need a logon page. There is not really a model
(database table) backing up that page so I am more or less stuck,
unless of course, I just put 'normal' php code up for that page. I am
just not sure that is the way to do it.

Any guidance or references would be greatly appreciated.

Thanks,

Peter


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Circularity with beforeFilter calling redirect

2006-05-23 Thread GregL

I've read some threads that cover my situation, but they end in
solutions that don't work.

If a user is not logged in, I want all URLs a user might try to
redirect to the login page. I thought I could do

class AppController extends Controller {
   function beforeFilter() {
  if(!$this->isLoggedIn()) {
 $this->redirect('/user/login');
  }
   }
}

But this leads to a circular reference, because redirect() leads to a
second call to this beforeFilter(), ad infinitum.

I see two ways around it

1) access whether the requested URL is '/user/login' and make an
exception not to redirect in this case -- how can I do this in Cake?

2) Are new instances of AppController created with each redirect()? If
the same instance is re-used, then I can set a member variable to let
me know I've entered once, and then I can protect against re-entry.
While I'm at it, I'll save the user's requested URL as well, and
redirect them there after they login, as a super-helpful convenience.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Acccessing Helpers from Layout

2006-05-23 Thread modfather

I am attempting to add a Global menu to the layout file (thinking this
is the appropriate place to put it). I tried the css-menu tutorial
available in the wiki and it failed. I then again scaled back to test
the following;

class AppController extends Controller {

var $helpers = array('link');
}//saved in app/app_controller.php

class LinkHelper extends Helper
{
function makeEdit()
{
   echo "linkhelper";
}
}//saved as link.php in helpers directory.

the created this as test.thtml in the elements directory.

line 1> makeEdit() ?>

i then inserted renderElement('test'); ?> in my
views/layoutsdefault.thtml

I have tried a few variations of this but i get a fatal error
 Call to a member function on a non-object in
/cake/app/views/elements/test.thtml on line 1.

would someone like to point me in right direction as to what i am doing
wrong.

cheers.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread Bret Kuhns

Interesting insight nate, thanks very much :) I really should get
around to reading a good book about MVC to learn more...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread hydra12

I'm using XAMPP on Windows XP Pro.  It's in c:\web\xampp.  Here's part
of my httpd.conf file:

#
# This should be changed to whatever you set DocumentRoot to.
#


#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
Multiviews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler cgi-script .cgi .pl

# ReadmeName footer.html
#
# AllowOverride controls what directives may be placed in .htaccess
files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all




Also, make sure to uncomment this line:

#LoadModule rewrite_module modules/mod_rewrite.so

After doing that, restart apache.  That should do it for you.  If not,
post back and I'll try to get you more information tomorrow.

Good luck!
hydra12


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread Larry E. Masters aka PhpNut
Oh BTW,http://www.cakefoundation.org/pages/contributeThis helps with development of cake, not sure if you know this or not, but I work on cake code exclusively, I have one other developer who works on the code, but does not do it full time like I do. 
-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/ 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread Larry E. Masters aka PhpNut
lifebythedrop,My reply to Dave is targeted to you also, not once has someone asked for help when I am on IRC and not got the answers that were helpful, and as the lead developer and the one with the most knowledge of the way cake works. You should appreciate the time I offer, or for that matter anyone offers you for free.
-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/On 5/23/06, 
lifebythedrop <[EMAIL PROTECTED]> wrote:
Dave,I'm relatively new to cake and had a difficult time setting it up aswell.  As you said, irc is undoubtedly useless for in depth questionsor serious help.  Your best bet for help is this group.
If you can outline your webserver directory structure relevant to cakeand any changes you've made to configuration files, I'll try to helpyou out.Regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Need PHP&MySQL Experts For SeniorWebDeveloper Position in Japan.

2006-05-23 Thread ayyavoo

We are a japanese software development company in kobe japan.

we are looking for PHP&My sql senior developers
should have atleast 5+year of experience in web development
should have atleast 3+years of PHP&MySql development experience with
IIS,Tomcat&apache.


If any of you one find the above skills matches your profile

do mail to [EMAIL PROTECTED] with your resume.


excellent packages

salary is negotiable to suitable candidate


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread Larry E. Masters aka PhpNut
Dave,If you are one of the people who come to IRC and expect everyone to drop what there doing and answer your question in 30 seconds, good luck. I am personally on the IRC almost 24 hrs a day, today I have not been since I have been trying to get a wireless network running.
So my advice be patient first.And if you are the same person that came online and asked a question, did not get a reply right away then said F*** it and left the IRC, and I sent you a PM telling you that help is there in the IRC you have to be patient, I would prefer not to help you for your attitude and lack of respect for my time, and others who offer help to people in IRC for free. 
-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/ 
On 5/23/06, DavePorter <[EMAIL PROTECTED]> wrote:
HI All,I still can't get things workingI cannot find a definitive document that tells me how to configurethings.There are mistakes in the docs for configuring Apache  ( AllowOveride
All  spelling error ).I found three occurances of AllowOverride in my httpd.conf.  Do Ireplace all of them with All OR which one of the three is the one !I find a number of different versions of the manual around the place.
This newsgroups appears very quiet.  The irc was no help - no oneresponded to my requests for help !I came to CakePHP after looking at RoR and I'm close to going backthere.  As I know php and not Ruby I thought this would be a way to go.
Can someone please help or recommend a better solution.regards, Dave-- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  public*/ 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread lifebythedrop

Dave,
I'm relatively new to cake and had a difficult time setting it up as
well.  As you said, irc is undoubtedly useless for in depth questions
or serious help.  Your best bet for help is this group.

If you can outline your webserver directory structure relevant to cake
and any changes you've made to configuration files, I'll try to help
you out.

Regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread John Zimmerman [gmail]
Another wiki page that references configuration for XAMPPhttp://wiki.cakephp.org/faq:how_do_i_set_up_mod_rewriteIt relates to virtual hosts but the configuration suggestions there might help you key in on the root of the problem.
On 5/23/06, John Zimmerman [gmail] <[EMAIL PROTECTED]> wrote:
Also, if you want to look at a hosting setup that supports PHP, MySQL, Rails (if you choose), and various other things  
http://dreamhost.com is a great host that allows for commad line SSH access.
I am doing my development and most of my deployment on their servers and have had 0 problems with Cake.Something like this would allow you to not have to worry about apache configuration on your local machine.
On 5/23/06, John Zimmerman [gmail] <
[EMAIL PROTECTED]> wrote:
http://wiki.cakephp.org/docs:mod_rewriteHere is a link to an XAMPP specific reference in the wiki.
Just to reiterate and add to what was said before.
Apache Problems are not Cake ProblemsCake is FreeThe List is in fact active.  Just count the TOTAL number of posts to the group today.Have you logged onto IRC to ask questions?


The creators and maintainers of Cake really aren't here to support infividuals (although I am sure everyone is trying to help as many people as possible, for free, as often as possible).  They are here to support their project and the group.  Individualized attention and support is usually something that comes with commercial software.
Be patient.  Cake is a good framework which will become more robust over time (including the documentation)If you can post your htaccess file maybe someone who is also running XAMPP can analyze it, comparing it to their setup and suggest some changes.
If you require XAMPP help specifically you can also try to find someone with XAMPP experience on their support forums

http://www.apachefriends.org/f/?language=english
People will help.  Just be patient and be sure to give us as much relevent info as possible.On 5/23/06, 
John David Anderson (_psychic_) <
[EMAIL PROTECTED]> wrote:

On May 23, 2006, at 6:50 PM, DavePorter wrote:
>> HI All,>> I still can't get things working>> I cannot find a definitive document that tells me how to configure> things.>> There are mistakes in the docs for configuring Apache  ( AllowOveride
> All  spelling error ).>> I found three occurances of AllowOverride in my httpd.conf.  Do I> replace all of them with All OR which one of the three is the one !Well, it should only be for the part of the server that  you have
Cake in. Its usually not the manual or the icons but just the '/'directory. Maybe it would help for you to supply examples of whatyou're referencing.> I find a number of different versions of the manual around the place.
http://manual.cakephp.org is the official manual.> This newsgroups appears very quiet.  The irc was no help - no one
> responded to my requests for help !
Sorry - we try hard to be available. You can't really complain aboutfree, though.> I came to CakePHP after looking at RoR and I'm close to going back> there.  As I know php and not Ruby I thought this would be a way to
> go.Do whatever you think is best. Please realize that Apacheconfiguration problems are not CakePHP configuration problems, thoughthey are closely related. Cake doesn't require mod_rewrite, so if


push comes to shove, we can help you use Cake without it.-- John






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread John Zimmerman [gmail]
Also, if you want to look at a hosting setup that supports PHP, MySQL, Rails (if you choose), and various other things  http://dreamhost.com is a great host that allows for commad line SSH access.
I am doing my development and most of my deployment on their servers and have had 0 problems with Cake.Something like this would allow you to not have to worry about apache configuration on your local machine.
On 5/23/06, John Zimmerman [gmail] <[EMAIL PROTECTED]> wrote:
http://wiki.cakephp.org/docs:mod_rewriteHere is a link to an XAMPP specific reference in the wiki.
Just to reiterate and add to what was said before.
Apache Problems are not Cake ProblemsCake is FreeThe List is in fact active.  Just count the TOTAL number of posts to the group today.Have you logged onto IRC to ask questions?

The creators and maintainers of Cake really aren't here to support infividuals (although I am sure everyone is trying to help as many people as possible, for free, as often as possible).  They are here to support their project and the group.  Individualized attention and support is usually something that comes with commercial software.
Be patient.  Cake is a good framework which will become more robust over time (including the documentation)If you can post your htaccess file maybe someone who is also running XAMPP can analyze it, comparing it to their setup and suggest some changes.
If you require XAMPP help specifically you can also try to find someone with XAMPP experience on their support forums
http://www.apachefriends.org/f/?language=english
People will help.  Just be patient and be sure to give us as much relevent info as possible.On 5/23/06, 
John David Anderson (_psychic_) <
[EMAIL PROTECTED]> wrote:
On May 23, 2006, at 6:50 PM, DavePorter wrote:
>> HI All,>> I still can't get things working>> I cannot find a definitive document that tells me how to configure> things.>> There are mistakes in the docs for configuring Apache  ( AllowOveride
> All  spelling error ).>> I found three occurances of AllowOverride in my httpd.conf.  Do I> replace all of them with All OR which one of the three is the one !Well, it should only be for the part of the server that  you have
Cake in. Its usually not the manual or the icons but just the '/'directory. Maybe it would help for you to supply examples of whatyou're referencing.> I find a number of different versions of the manual around the place.
http://manual.cakephp.org is the official manual.> This newsgroups appears very quiet.  The irc was no help - no one
> responded to my requests for help !
Sorry - we try hard to be available. You can't really complain aboutfree, though.> I came to CakePHP after looking at RoR and I'm close to going back> there.  As I know php and not Ruby I thought this would be a way to
> go.Do whatever you think is best. Please realize that Apacheconfiguration problems are not CakePHP configuration problems, thoughthey are closely related. Cake doesn't require mod_rewrite, so if

push comes to shove, we can help you use Cake without it.-- John




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread John Zimmerman [gmail]
http://wiki.cakephp.org/docs:mod_rewriteHere is a link to an XAMPP specific reference in the wiki.Just to reiterate and add to what was said before.
Apache Problems are not Cake ProblemsCake is FreeThe List is in fact active.  Just count the TOTAL number of posts to the group today.Have you logged onto IRC to ask questions?
The creators and maintainers of Cake really aren't here to support infividuals (although I am sure everyone is trying to help as many people as possible, for free, as often as possible).  They are here to support their project and the group.  Individualized attention and support is usually something that comes with commercial software.
Be patient.  Cake is a good framework which will become more robust over time (including the documentation)If you can post your htaccess file maybe someone who is also running XAMPP can analyze it, comparing it to their setup and suggest some changes.
If you require XAMPP help specifically you can also try to find someone with XAMPP experience on their support forumshttp://www.apachefriends.org/f/?language=english
People will help.  Just be patient and be sure to give us as much relevent info as possible.On 5/23/06, John David Anderson (_psychic_) <
[EMAIL PROTECTED]> wrote:On May 23, 2006, at 6:50 PM, DavePorter wrote:
>> HI All,>> I still can't get things working>> I cannot find a definitive document that tells me how to configure> things.>> There are mistakes in the docs for configuring Apache  ( AllowOveride
> All  spelling error ).>> I found three occurances of AllowOverride in my httpd.conf.  Do I> replace all of them with All OR which one of the three is the one !Well, it should only be for the part of the server that  you have
Cake in. Its usually not the manual or the icons but just the '/'directory. Maybe it would help for you to supply examples of whatyou're referencing.> I find a number of different versions of the manual around the place.
http://manual.cakephp.org is the official manual.> This newsgroups appears very quiet.  The irc was no help - no one> responded to my requests for help !
Sorry - we try hard to be available. You can't really complain aboutfree, though.> I came to CakePHP after looking at RoR and I'm close to going back> there.  As I know php and not Ruby I thought this would be a way to
> go.Do whatever you think is best. Please realize that Apacheconfiguration problems are not CakePHP configuration problems, thoughthey are closely related. Cake doesn't require mod_rewrite, so if
push comes to shove, we can help you use Cake without it.-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Very Frustrated - No help for newbies !!!!

2006-05-23 Thread John David Anderson (_psychic_)


On May 23, 2006, at 6:50 PM, DavePorter wrote:

>
> HI All,
>
> I still can't get things working
>
> I cannot find a definitive document that tells me how to configure
> things.
>
> There are mistakes in the docs for configuring Apache  ( AllowOveride
> All  spelling error ).
>
> I found three occurances of AllowOverride in my httpd.conf.  Do I
> replace all of them with All OR which one of the three is the one !

Well, it should only be for the part of the server that  you have  
Cake in. Its usually not the manual or the icons but just the '/'  
directory. Maybe it would help for you to supply examples of what  
you're referencing.

> I find a number of different versions of the manual around the place.

http://manual.cakephp.org is the official manual.

> This newsgroups appears very quiet.  The irc was no help - no one
> responded to my requests for help !

Sorry - we try hard to be available. You can't really complain about  
free, though.

> I came to CakePHP after looking at RoR and I'm close to going back
> there.  As I know php and not Ruby I thought this would be a way to  
> go.

Do whatever you think is best. Please realize that Apache  
configuration problems are not CakePHP configuration problems, though  
they are closely related. Cake doesn't require mod_rewrite, so if  
push comes to shove, we can help you use Cake without it.

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Very Frustrated - No help for newbies !!!!

2006-05-23 Thread DavePorter

HI All,

I still can't get things working

I cannot find a definitive document that tells me how to configure
things.

There are mistakes in the docs for configuring Apache  ( AllowOveride
All  spelling error ).

I found three occurances of AllowOverride in my httpd.conf.  Do I
replace all of them with All OR which one of the three is the one !

I find a number of different versions of the manual around the place.

This newsgroups appears very quiet.  The irc was no help - no one
responded to my requests for help !

I came to CakePHP after looking at RoR and I'm close to going back
there.  As I know php and not Ruby I thought this would be a way to go.

Can someone please help or recommend a better solution.

regards, Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Model subclass

2006-05-23 Thread jobu

Thanks 100rk, I believe I have solved this problem with your help.

This is what I got when I called pr($agent):

Array
(
[Agent] => Array
(
[id] => 1
[customer_id] => 1
[portraitImage] =>
[realtor_id] => 0
[agenttype_id] => 0
[slogan] => This isn't working right :(
)

[Listing] => Array
(
[0] => Array
(
[id] => 1
[mlsNumber] => 317954
[price] => 217000
[bedrooms] => 4
[bedrooms2] => 1
[fullBathrooms] => 2
[halfBathrooms] => 1
[sqfeet] => 717.89
[lotSize] => 30x50
[builtIn] => 2003
[address1] => Somewhere over the
[address2] =>
[doDisplayAddress] => 1
[postalCode] => L8M 3B4
[description] => Here is a big description.
[hasVirtualTour] => 0
[virtualtour_id] => 0
[externalVirtualTour] =>
[views] => 0
[customer_id] => 1
[board_id] => 0
[region_id] => 0
[vendorEmail] =>
[vendorEmail2] =>
[doSendAgentStats] => 0
[availability_id] => 0
[pinNumber] => 0
[created] => 2006-05-19 17:24:59
[modified] => 2006-05-19 17:25:29
)

)

)

The [Listing] came from an association linked to the Customer model.
Therefore, it was obvious that the Agent model was picking up some
information from its parent class. I had previously commented out the
$belongsTo line in the Agent class because it caused errors when I also
had a $hasOne line in the Customer class. However, once I uncommented
the line, a [Customer] array appeared which had all the information I
needed. In order to make it work, I had to keep the $hasOne line
commented out.

Anyway, I'm not sure if it really makes sense to say that a subclass
"belongs" to its parent class, but I'm not going to argue when it works
:)

Thanks for all of your help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



HABTM Manual foriegn key error?

2006-05-23 Thread lifebythedrop

In the Cake manual chapter for models, in HABTM associations section
there is the example code for Post/Tag relationship pasted below...

Shouldn't foreignKey and associationForeignKey be swapped?

I tried the way the manual has, but no records returned, swapping these
2 fields return the expected results.  I dont know for sure though, so
figured I'd ask the experts.

class Post extends AppModel
{
var $name = 'Post';
var $hasAndBelongsToMany = array('Tag' =>
   array('className'  => 'Tag',
 'joinTable'  => 'posts_tags',
 'foreignKey' => 'tag_id',
 'associationForeignKey'=>
'post_id',
 'conditions' => '',
 'order'  => '',
 'limit'  => '',
 'uniq'   => true,
 'finderSql'  => '',
 'deleteQuery'=> '',
   )
   );
}


Regards,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Easy Association Question

2006-05-23 Thread [EMAIL PROTECTED]

PS - If I have to name the fields in `courses` uniquely, that's fine.
That would be, I think, an even more basic hasMany association.  I
can't get that to work, either.

That would look more like:

CREATE TABLE `courses` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `epp_id` int(10) NOT NULL default '0',
  `course_name1` varchar(64) default NULL
  `course_name2` varchar(64) default NULL
  `course_name3` varchar(64) default NULL
  ...
  PRIMARY KEY  (`id`)
) 

Then I'd have:

1,10,'foo1','bar1',...
2,11,'foo2','bar2',...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to get an array of objects 'Category' together with related 'Posts'?

2006-05-23 Thread nate

You can do this using model associations.  For example:

class Post extends AppModel {
   var $name = 'Post';
   var $belongsTo = 'Category';
}

class Category extends AppModel {
var $name = 'Category';
var $hasMany = 'Post';
}

As long as your posts table has a category_id field, it should just
work.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Easy Association Question

2006-05-23 Thread [EMAIL PROTECTED]

I think this is an easy association question but Cake is not behaving
like I expect.

In my app, users complete a form called an Epp.  Included on the form
are a bunch of repititive input fields where the users key in text
about their current courses.

Example:
Question: List the courses you are enrolled in this term:
  ...
  ...
  ...

Where each  is a unique $html->input.

I'd like to have the course info stored in its own table rather than in
the same table as the rest of my form data.  Thus I can use a
one-to-many relationship to associate them.

Here's my SQL:

CREATE TABLE `courses` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `epp_id` int(10) NOT NULL default '0',
  `course_name` varchar(64) default NULL
  ...
  PRIMARY KEY  (`id`)
)

CREATE TABLE `epps` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  ...
  PRIMARY KEY  (`id`)
)

So let's say I have Epps with ids of 10 and 11.  The courses table
might contain:

1,10,'foo1'...
2,10,'bar1'...
3,11,'foo2'...
4,11,'bar2'...

Courses do not need to know about their Epps, but each Epp needs to be
able to save/get it's list of courses.

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

var $hasMany = array('course_association' =>
array(
'className' => 'Course',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'epp_id'
)
);

var $recursive = 1;

//var $hasMany = 'Course';
}

Is there any way to support this with hasMany?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



How to get an array of objects 'Category' together with related 'Posts'?

2006-05-23 Thread Michael Yevdokimov

Hello everyone

I am very new to Cake (still digging it) and I got a question.

Let's say I have a few Posts and related Categories.

In old times of splitting business logic and presentation I'd write a
function which would generate an array of objects 'Category'. Each
category would have an array of items. So, in the view I would just use
'foreach' to iterate through the objects and "inner" 'foreach' to
iterate through an array of items per current category in the loop.

It would look something like this:

  arrCategories = array(object_1,object_2)

where:

  object_1:
.id = 1
.title = Category1
.posts = array (objPost11,objPost12,objPost13)
  object_2:
.id = 2
.title = Category2
.posts = array (objPost21,objPost22,objPost23)

How to make the same logic (or more or less the same) with Cake (so,
basically i am interested in the approximate content of controller and
model)?

I hope you understand what I mean.
Thank you very much in advance!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Global variables?

2006-05-23 Thread 100rk

File bootstrap is included in method Configure::__loadBootstrap() so
You have to mark Your global variables by keyword 'global' as global -
otherwise they are valid only in scope inside of above mentioned
method.

About global variables: if this solution is good enough for You, then
it is perfect and do not listen to me, it is only question of personal
taste, You know ;-) Truth is: file bootstrap.php is mentioned for such
a things.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Model subclass

2006-05-23 Thread 100rk

how looks output of code

pr($agent);

in view?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread nate

> Isn't that what the $uses variable is for?

It can be, but that's not strict MVC.  Generally, it is used to load
additional models for purposes of querying them, in cases where the
data you need exists outside an association of the primary model.
However, the proper way to do updates is to set up one controller
action to perform a particular update on a model, and call that action
from other controllers (i.e. with requestAction).  That would be the
DRYest thing to do, and clearly much more so than manipulating the same
data in different parts of an app.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

nate wrote:
"you should never have a situation where more than one controller would
need validation rules for the same model"

I agree, using MVC suggests a complete seperation of the M-V-C
components... in a perfect world. But we know that won't always hold
100% true.


"because only one controller should be manipulating the model."

In "classic" web applications I've written, multiple scripts manipulate
the same database table. Models represent db tables in cake, so
wouldn't it make sense for multiple controllers to access a single
model? Isn't that what the $uses variable is for?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

Rasmus, thank you for the excellent link. It's very helpful :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread nate

According to strict MVC separation, you should never have a situation
where more than one controller would need validation rules for the same
model, because only one controller should be manipulating the model.

Also, when it comes to MVC, data validation is sort of in a grey area
between the model and the controller.  Some
interpretations/implementations of the pattern define it as being in
the controller, and in others it is in the model, so there's not really
one universal answer.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: No Database table for model

2006-05-23 Thread nate

Fixed it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread Rasmus Lauridsen
Hello fellow cakePHP noob :-)
 
You might also want to read one of the advanced validation tutorials in the wiki...
They allow you to do more advanced checking also in the model.
Ive used this one
http://wiki.cakephp.org/tutorials:advanced_validation
Its pretty good since it lets you specify a function to run instead of just a regex pattern, which is very useful if you want to compare two emails check if a username is unique and the like. (make sure though that the username has been checked for for valid characters first dont want to potentially open ourselves up for exploits already in our validation scripts.
 
 
On 5/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I think I may have answered my own question... Looking *outside* of thedata validation chapter in the manual and skimming through the "model"
chapter, I found the beforeValidate() method. With a description:"Use this callback to modify model data before it is validated. It canalso be used to add additional, more complex validation rules, using
Model::invalidate()."So I assume beforeValidate() can be used to run custom validation fromwithin the model and trigger the invalidate() method if somethingfails. I suppose this topic just turned into a note for other "n00bs"
with similiar issues...-- Rasmus LauridsenAarhus C, Denmark 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

I think I may have answered my own question... Looking *outside* of the
data validation chapter in the manual and skimming through the "model"
chapter, I found the beforeValidate() method. With a description:

"Use this callback to modify model data before it is validated. It can
also be used to add additional, more complex validation rules, using
Model::invalidate()."

So I assume beforeValidate() can be used to run custom validation from
within the model and trigger the invalidate() method if something
fails. I suppose this topic just turned into a note for other "n00bs"
with similiar issues...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

Troy,

Thank you for the reply. I thought of doing that, but realized I would
have a conglomerate of validation methods that would get lugged around
throughout my application. I suppose I could use a naming scheme like:

validateModelNameFieldName()

but I don't want the controller to care at all about validating. The
regexp feature lets the model do all the validation and just notify the
controller. Which, from my understanding of MVC, is how it should work.
The controller shouldn't care *how* the model validates, it should only
care *if* the model validates.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

You can use the global app_controller.php in your app directory to add
application wide methods.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Model subclass

2006-05-23 Thread jobu

OK, I have managed to avoid the error by wrapping this around the class
definition code in customer.php:

if ( !class_exists("Customer") ) {
.
.
.
}

I no longer get errors when attempting to view agents, but the data
from the customer class does not seem to be available. I have set up
the following test function in the AgentsController:

function test($id = null) {

$this->Agent->id = $id;
$this->set('agent', $this->Agent->read());

}

Accompanied by the corresponding test.thtml:



This gives me the warning:

Notice: Undefined index: username in
/srv/www/htdocs/cake/app/views/agents/test.thtml on line 4

I also tried the following code, just to see if it would work:

echo "Username: " . $agent['Agent']['username'];

Which gave the error:

Notice: Undefined index: Customer in
/srv/www/htdocs/cake/app/views/agents/test.thtml on line 4

Anyway, if anyone could shed some light on this I would be very
grateful.

Thanks,
Joel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

And just as an example, I'm planning to create an application that will
have multiple "wizard" controllers that will be responsible for all
sorts of tasks like creating customers, adding inventory to a sale and
apply that sale to the customer's record, etc. It would be clumsy to
have the validation code copied into each wizard controller, but I
don't see where the manual addresses a better way to do this within the
model...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Global variables?

2006-05-23 Thread felle42

Thanks 100rk. setting the variables in bootstrap.php global did it for
me!
But why do I have to do this? isn´t the file(bootstrap.php) included
by a php-include or -require?

I need the global varibals for implementing submenues. I define them as
an array an the controller selects the right one. is there a better way
of doing this?

greets
felle42


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Model subclass

2006-05-23 Thread jobu

Hi 100rk,

I tried what you suggested, but I get the same error I got when I used
the loadModel("Customer") function:

Fatal error: Cannot redeclare class customer in
/srv/www/htdocs/cake/app/models/customer.php on line 28


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Global variables?

2006-05-23 Thread 100rk

if You defined those vars in bootstrap.php by code

global $abc, $def;
$abc = true;
$def = 'XXX';

then You can acces them in Controller::beforeFilter() method by

global $def;
$this->set('def', $def);

But You IMO have to consider, if You really need global variable. I'm
trying to say there will be probably 'more clean' way how to achieve
this, if You aren't just include some foreign code.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Model subclass

2006-05-23 Thread 100rk

This should work fine, if You will load file with Customer definition,
so put

require_once dirname(__FILE__) . DS . 'customer.php';

before class Agent definition.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



data validation quirks

2006-05-23 Thread [EMAIL PROTECTED]

I'm pretty new to cake, but while reading through the manual, I picked
up on something odd and just wanted to see how others felt about this.
For basic regular expression validation, that information is placed
within the model. Which makes sense, the controller really doesn't care
about validation, it just wants to hand the information to the model
and see if the data is valid or not. This sounds perfect to me until we
reach the section about custom validation.

Let's say we have a few fields that work fine with basic regexp checks,
so those go in the model. But according to the manual, if we have any
custom validation (like checking if a username is already taken), that
goes in a controller action... something about that doesn't seem right.
Now we have part of our validation in the model and the other part in
the controller. If a model is used by multiple controllers, then we
have to copy that validation across the controllers? So much for DRY.

I could be understanding this wrong, but that's what I'm getting out of
the manual. Is there any better way to do this? I would think something
like validateFieldName() functions within the model that are called
automagically when the model saves/validates would make more sense for
custom validation, but I don't see that in the manual.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Model subclass

2006-05-23 Thread jobu

Hello,

I have been searching for a while now and haven't found any information
about this, so I apologize if this is covered somewhere.

I am wondering if it is possible to create a subclass of a model in
CakePHP. To be more specific, I have a model called Customer. I would
like to create a subclass of this model called Agent, which contains
all the same data and associations as Customer, but also has some extra
data unique to Agents.

In the database, this relationship is represented by having a separate
table for agents which includes a foreign key linked to the id field of
the customers table.

In my code for agent.php, I have the following:

class Agent extends Customer
{
var $name = 'Agent';

var $belongsTo = array('Customer' =>
   array('className'  => 'Customer',
 'conditions' => '',
 'order'  => '',
 'foreignKey' => 'customer_id'
   )
 );

}

I get this error when attempting to view the agents (viewing customers
works fine):

Fatal error: Class 'Customer' not found in
/srv/www/htdocs/cake/app/models/agent.php on line 5

I have also tried adding this line above the class declaration:

loadModel("Customer");

I got the idea from something I read about extending controllers.
However, if I do this I get the following error:

Fatal error: Cannot redeclare class customer in
/srv/www/htdocs/cake/app/models/customer.php on line 28

I am not sure if this is important, but I have also set up the
AgentsController to extend CustomersController with the following code:

loadController('Customers');

class AgentsController extends CustomersController
{
var $name = 'Agents';
var $scaffold;
}

Is what I am attempting to do possible? If so, what am I doing wrong?

Thanks,
Joel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: New templating component: "Icing"

2006-05-23 Thread calzone

Thank you for the support guys.

There is one important issue I forgot to mention before, which is that
the component currently has no error handling.  Being new to Cake, I
haven't yet gotten a chance to learn error management under Cake.

Another important issue is that changes to the .tpl require two
refreshes to the view before they appear in a browser.  I tried using a
temp file and including the contents on the first go-round, but failed.

I'm also tempted to use .htm instead of .tpl for the file suffixes so
that the templates display as-is in a web browser.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Global variables?

2006-05-23 Thread felle42

Hello,

I'm new to CakePHP. I found some comments on how to access global
variables so
i've put an array-variable into the /app/conf/bootstrap.php but i
can´t access it in my
AppController::beforeFilter()-Method. The file(bootstrap.php) is loaded
by the framework. I have verified that by putting a php-syntax error in
it. But I can´t access the variables defined in it. I know I have to
set them global where I try to access them...
I use version 1.0.x.x of the framework.
Any ideas?

greets
felle42


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread Grant Cox

Well, that's an authentication issue, which is certainly a topic in
itself.  I don't really have any recommendations (there seems to be a
number of authentication modules for cake, in various stages of
development).  So far I have just stored the PK in the session when the
user is authenticated, and it uses that when saving.

But no, the Save function does not care where you call it from.  I
personally see this as a benefit :)


[EMAIL PROTECTED] wrote:
> Thanks first,
> Whether you disable the primary key input field or use a hidden
> field,the users can make a html  file by view the source of you file
> and then modify it(cancel your disable property or changes the hidden
> filed to visible input).after make a file ,he login in,choose the data
> which has the PK value he want to edit,then open the html doc he
> modified from IE's file menu...
>
> I thought that the save method will judge if it was called by 'Edit'
> action it only do a update query,if it was called by 'Add' action then
> it do insert query,but it does not do such a judgement.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



HABTM setup, allow for extra colimns in join table

2006-05-23 Thread Jon Bennett

Hi,

I have a question regarding how to setup extra columns in a HABTM join
table, for instance, if I have the following DB structure:

products
- id (pk)
- name default 'my lovely pair of shoes'
- etc

product_sizes
- id (pk)
- name default 'medium'
- etc

products_sizes
- id (pk)
- product_id (fk)
- product_size_id (fk)
- quantity
- price

I can get a standard HABTM association working here fine, my problem
lies with adding the info into the DB for the extra columns: quantity
& price, in the join table.

Clearly I can't use a standard multi-selectTag, instead using a
combination of 4 fields for each (product, size, quantity, price).

To enable me to do this is I've created a new Model ProductPrice, and
then I loop through the form fields and manaually insert a new row for
each join:

$i = 0;
foreach ($this->data['Product']['sizes'] as $size_id)
{
$data['ProductSize']['id'] = null;
$data['ProductSize']['product_id'] = $product_id;
$data['ProductSize']['size_id'] = $size_id;
$data['ProductSize']['quantity'] = $this->data['Product']['quantities'][$i];
$data['ProductSize']['price'] = $this->data['Product']['prices'][$i];
$this->ProductSize->save($data);
++$i;
}

Now this works, but it's left me a little stumped, as it would be nice
if you could save a HABTM with more info than just an ID
automatically, but what I'm finding more tricky is getting the
quantity and price returned when I do a standard
$this->Product->findAll() etc.

Many thanks,

Jon
-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Caching Model-Descriptions to Memcache?

2006-05-23 Thread nate

Sure, post it to CakeForge.

The easiest way to implement custom model description caching is to
copy app_model.php into your app/ folder, then copy the loadInfo( )
method out of cake/libs/model/model_php4/5.php into your AppModel, and
add a hook to look to pull the data from memcache, and only hit the db
if it isn't found.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Scaffold (prompt forms)

2006-05-23 Thread nate

Again, you can't.  I will refer you to my reply from your previous
scaffold-related post.  Scaffold is for *prototyping*, not *building*
applications.  If you want to customize the scaffold view, bake it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to run cake in a subfolder?

2006-05-23 Thread [EMAIL PROTECTED]

Always use the constant DS to make sure all the paths are absolute
path,then wherever you move cake it can works well,I found.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread 100rk

And what about SecurityComponent::requireAuth() method?

- if You will not use any ajax calls (where will be controller with
Security component) in Your page (where protected form is)
- and if visitor will not open any link (where will be controller with
Security component) from Your protected page in other browser tab
- and if visitor will not visit other page (where will be controller
with Security component) from another browser window with same session
id
- and if session will not expire until form is sended back

it could IMHO fill this security need.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Just can't get started !!!!!!

2006-05-23 Thread DavePorter


HI everyone,

Read lots on Cake and it looks exactly what I am looking for

Tried working through the blog tutorial, but just can't get it going.

I am using Windows XP Pro & have Apache-Friends XAMPP installed in:
c:\program files\xampp\
with htdocs being where all the development stuff goes.

So I then have Cake installed in the htdocs folder ( app folder, cake
folder, vendors folder ).

So for the blog I'm just entering it in the app folder.  But the
localhost to view posts/index just does not work !

I placed phpinfo.php in the folder and it works fine !
http://localhost/app/views/posts/phpinfo.php( here is it's
location.)
So apache/php/mysql are all working fine

I know this has to be something really simple, but it's got me stumped.

Appreciate any help !

regards, Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread AD7six

I don´t think it´s wise to trust the referrer ;)

One of many links:
http://www.mustap.com/phpzone_post_62_how-to-bypass-the-referer-se

Still thinking (or hoping that one of the CakeGods will chip in),

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread 100rk

Off course, but it is not possible do this by locally saved html page
with modified form


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: HABTM setup, allow for extra colimns in join table

2006-05-23 Thread Jon Bennett

Hi Jon,

If I understand correctly..

To quote Nate: "Cake only supports HABTM join tables
for joining.  In other words, you can't store any extra information in
the join table".
If you want to, use a hasMany belongsTo type arangement.

hmm, well, the products and sizes example is for my next project, my
current project is a little more complicated :)

I'm building a playlist generator, users create 'Slides' (based on
client definable templates, but that's not important here) and can
then assign slides to a playlist, easy, accept each playlist really
consists of 3 playlists (3 sets to be shown synced across 3 screens),
my current setup is as follows:

playlists
- id (pk)
- name
etc etc

slides
- id (pk)
- template_id (fk)
- name
etc etc

playlists_slides
- id (pk)
- playlist_id (fk)
- slide_id (fk)
- screen ENUM ('top','middle','bottom')
- order_id

Slide HABTM Playlist
Playlist HABTM Slide

I have tweaked 'finderQuery' to include the value of screen and can
now return that, but now I'm realising that what I actually need is 3
join tables, one for each screen. The problem I immediately ran into
was if I changed the name of the association to something other than
'Slide' it balked, even though I left the class name as slide

What would be nice would be to have a single join table, but have 3
associations, 'Top, Middle, Bottom', which had a little bit of custom
finder/insert/delete Query sql to set the screen value, so when it
returned the associated models, it did so like this:

[Top] => Array
(
[0] => Array
(
[id] => 23
[template_id] => 23
[client_id] => 1
[user_id] => 1
[name] => ABC
[description] =>
[status] => online
[created] => 2006-05-19 01:53:26
[modified] => 2006-05-19 01:53:26
)

[Middle] => Array
(
[0] => Array
(
[id] => 25
[template_id] => 16
[client_id] => 1
[user_id] => 1
[name] => ABC
[description] =>
[status] => online
[created] => 2006-05-19 01:53:26
[modified] => 2006-05-19 01:53:26
)

but I'm not sure if that's possible]

any ideas?

jon

PS: Isn´t that you in the reference thread all those moons ago ;)

haha, yeah!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



New templating component: "Icing"

2006-05-23 Thread calzone

To all who are interested in using some form of templating solution,
especially those who may feel that Smarty is overkill or somewhat
conflicting with Cake:

I have just added a snippet at CakeForge called Icing.

Icing is just a component you drop into your components folder. You'll
have to create a new templates dir and set permissions accordingly.
But that's all there is to it for installation.

Icing is a very simple templating system that I specifically designed
to work with Cake as opposed to instead of Cake.  Caching would still
be controlled by Cake's view caching and you can enable it per
controller and per view.

It is extensively documented and available here:

http://cakeforge.org/snippet/detail.php?type=snippet&id=67

Any and all feedback would be very appreciated.  If anyone feels
motivated to improve on Icing, by all means, do so, but please let me
know and share.

Thanks

Chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread Grant Cox

Well, what do you want it to do?  My solution is not to let the user
change the primary key.  Perhaps you should have a hidden field for the
original PK, so you can remove it when you save the new one.  But
letting the user modify the PK gives them the power to overwrite any
other entry, which is asking for trouble...


[EMAIL PROTECTED] wrote:
> If you allow user to change the table's primary key from a form and you
> use $this->modelname->save($this->params['data'])) in controller ,there
> will be a new record has the new PK value apprears,but the old one
> stills there,how to avoid that?
> 
> Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: New templating component: "Icing"

2006-05-23 Thread Mika

This looks brilliant. Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread Olivier percebois-Garve

Hi
You're right I understood the issue as "changing the id of given db row".
I'll follow your discussion because I may soon have the issue as I want 
to discriminate access to nodes
in my tree structure.


As a side note, to test that you don't need to save and change a form. 
In firefox the developer toolbar
allows to make form field writable. I even used it to cheat  in  an 
Internet game  some  times ago.
(In that game you could go fishing every week and some fishes were more 
worth than others, and the developers
made that module by passing the id of the fish category in a form, so I 
had just to change that id in order to fish every week the most 
expensive fish...)


AD7six wrote:
> Hi Olivier,
>
> I think the point is, that you could save the form locally, change the
> hidden field value , and edit/overwrite other entries in the database.
>
> Asume there is some data ACL here´s a real E.g.
>
> Access http://www.noswad.me.uk/tutorials/posts/edit/9
> save the form locally
> set the form action to be an absolute url
> change the hidden field value to "1"
> submit the form
>
> And you just edited entry number 1.
>
> If we make the assumption that the user had access to edit post 9, they
> just got around the restriction. This is just a trivial example to
> demonstrate the question raised.
>
> It raises another problem, which I´ve been pondering for a little
> while I might aswell chip in:
>
> If someone knows the name of a database field they shouldn´t have
> access to edit, they can easily save an edit a form and update fields.
>
> I´m still thinking about generic solutions to this generic problem ;)
>
> Cheers,
>
> AD7six
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread [EMAIL PROTECTED]

Thanks again

Haha...
I make it!
I use the model->db->update method:

first I construct parmaters for 'update',
$fields=array();
foreach (($this->params['data']['audit']) as $k => $v)
//$this->params['data']['audit'] is the post form data for table
'audit'
{
if ($this->audit->hasField($k) && 
!array_key_exists($k,
$fields))//use model->hasField to check fileds,
{
$fields[] = $k;
  //the fields saved
$values[] = htmlspecialchars($v);
//
}

}
$this->audit->setId($_POST["oid"]);//$_POST["oid"] is 
the origin
PK's value.

if($this->audit->hasAny($this->audit->primaryKey."='".$this->audit->id."'")){//if
the PK value is exists in database
if($this->audit->db->update($this->audit, $fields, 
$values)){
$this->set("ajaxsubscr","new
Ajax.Updater('ajax_update','/audit/index'+qstr+'',
{onComplete:function(request){Effect.Fade('".$this->action."_audit');stripe();initDrag();},asynchronous:true,evalScripts:true});");//ajax
update,update audit list
}
}
$this->render('posterror'); //do something


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread 100rk

>> I´m still thinking about generic solutions
RequestHandler::getReferrer()


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread [EMAIL PROTECTED]

Thanks first,
Whether you disable the primary key input field or use a hidden
field,the users can make a html  file by view the source of you file
and then modify it(cancel your disable property or changes the hidden
filed to visible input).after make a file ,he login in,choose the data
which has the PK value he want to edit,then open the html doc he
modified from IE's file menu...

I thought that the save method will judge if it was called by 'Edit'
action it only do a update query,if it was called by 'Add' action then
it do insert query,but it does not do such a judgement.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Just can't get started !!!!!!

2006-05-23 Thread DavePorter

Thanks for your help.

http://localhost confirms that cake is happy &
http://localhost/cake displays the directory structure.

Acording to the manual this confirms that everything is OK ( or NOT ???
)

cheers, Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: HABTM setup, allow for extra colimns in join table

2006-05-23 Thread AD7six

Hi Jon,

If I understand correctly..

To quote Nate: "Cake only supports HABTM join tables
for joining.  In other words, you can't store any extra information in
the join table".
If you want to, use a hasMany belongsTo type arangement.

Ref:
http://groups.google.com/group/cake-php/browse_thread/thread/729d7feae5f61825/5dab44a87864d277?q=habtm+join&rnum=2#5dab44a87864d277

Cheers,

AD7six
PS: Isn´t that you in the reference thread all those moons ago ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: unset($this->params['data']) Not Working???

2006-05-23 Thread John Zimmerman [gmail]
http://wiki.cakephp.org/tutorials:flashingFor some reason I missed this page in the wiki before I got started and mucked around writing new functions.
On 5/22/06, josh southern <[EMAIL PROTECTED]> wrote:
stephenrs, thanks for the reply. That will work fine with minimalchanges to my app.I still would like to know why the unset() function stopped workingwith 1.0? It could help me solve other problems down the road...
X-Google-Language: ENGLISH,ASCII-7-bitReceived: by 10.11.88.14 with SMTP id l14mr42075cwb;Mon, 22 May 2006 08:53:37 -0700 (PDT)X-Google-Token: j1BK8AwAAAD_n4v4ENmRTIH6jH2K7NuB
Received: from 68.216.187.39 by y43g2000cwc.googlegroups.com with HTTP;Mon, 22 May 2006 15:53:37 + (UTC)From: "josh southern" <
[EMAIL PROTECTED]>To: "Cake PHP" Subject: Re: unset($this->params['data']) Not Working???
Date: Mon, 22 May 2006 08:53:37 -0700Message-ID: <[EMAIL PROTECTED]>In-Reply-To: <
[EMAIL PROTECTED]>References: <[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <[EMAIL PROTECTED]>   <
[EMAIL PROTECTED]>   <[EMAIL PROTECTED]>User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.2,gzip(gfe),gzip(gfe)X-HTTP-Via: 1.1 proxy2-jan.integrity.com:80
 (squid/2.5.STABLE12)Mime-Version: 1.0Content-Type: text/plainstephenrs, thanks for the reply. That will work fine with minimalchanges to my app.I still would like to know why the unset() function stopped working
with 1.0? It could help me solve other problems down the road...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Caching Model-Descriptions to Memcache?

2006-05-23 Thread [EMAIL PROTECTED]

Okaaay, I took a deeper look.
IMHO it's a bit dirty that the Cache-Stuff is implemented as normal
Functions in basics.php.

Wouldn't it be much nicer if it was implemented in a nice class that
can be extended/overridden in the app?

This way it would be possible to write caching classes for memcache,
filecaching, shm caching etc...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Caching Model-Descriptions to Memcache?

2006-05-23 Thread [EMAIL PROTECTED]

but then it's double-cached to files as well, huh?
I want to cache it to memcache instead, seems to be harder.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: New templating component: "Icing"

2006-05-23 Thread [EMAIL PROTECTED]

Hi there,

ok i havent tested it but it really looks simple and useful !!

I'll try to use it and report 

thanks a lot !!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: HABTM setup, allow for extra colimns in join table

2006-05-23 Thread Jon Bennett

On 5/23/06, Jon Bennett <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a question regarding how to setup extra columns in a HABTM join
> table, for instance, if I have the following DB structure:
>
> products
> - id (pk)
> - name default 'my lovely pair of shoes'
> - etc
>
> product_sizes
> - id (pk)
> - name default 'medium'
> - etc
>
> products_sizes
> - id (pk)
> - product_id (fk)
> - product_size_id (fk)
> - quantity
> - price
>
> I can get a standard HABTM association working here fine, my problem
> lies with adding the info into the DB for the extra columns: quantity
> & price, in the join table.
>
> Clearly I can't use a standard multi-selectTag, instead using a
> combination of 4 fields for each (product, size, quantity, price).
>
> To enable me to do this is I've created a new Model ProductPrice, and
> then I loop through the form fields and manaually insert a new row for
> each join:
>
> $i = 0;
> foreach ($this->data['Product']['sizes'] as $size_id)
> {
> $data['ProductSize']['id'] = null;
> $data['ProductSize']['product_id'] = $product_id;
> $data['ProductSize']['size_id'] = $size_id;
> $data['ProductSize']['quantity'] = 
> $this->data['Product']['quantities'][$i];
> $data['ProductSize']['price'] = $this->data['Product']['prices'][$i];
> $this->ProductSize->save($data);
> ++$i;
> }
>
> Now this works, but it's left me a little stumped, as it would be nice
> if you could save a HABTM with more info than just an ID
> automatically, but what I'm finding more tricky is getting the
> quantity and price returned when I do a standard
> $this->Product->findAll() etc.


to answer my first question (above), I needed to implement the
'finderQuery' sql in the association like so:

var $hasAndBelongsToMany = array(
   'Size'  =>
   array('className' => 'Size',
 'joinTable' => 
'products_sizes',
 'foreignKey'=> 'product_id',
 'associationForeignKey' => 'size_id',
 'conditions'=> '',
 'order' => '',
 'uniq'  =>  true,
 'finderQuery'   => 'SELECT
`Size`.`id`, `Size`.`name`, `Size`.`description`, `Size`.`status`,
`Slide`.`created`, `Slide`.`modified`, `products_sizes`.`quantity`,
`products_sizes`.`price` FROM `sizes` AS `Size` JOIN `products_sizes`
ON `products_sizes`.`product_id`={$__cakeID__$} AND
`products_sizes`.`size_id` = `Size`.`id` WHERE 1 = 1',
 'deleteQuery'   => '',
 'insertQuery'   => '')

that gives you

[Top] => Array
   (
   [0] => Array
   (
   [id] => 23
   [template_id] => 23
   [client_id] => 1
   [user_id] => 1
   [name] => ABC
   [description] =>
   [status] => online
   [created] => 2006-05-19 01:53:26
   [modified] => 2006-05-19 01:53:26
   [products_sizes] => Array
   (
[quantity] => 500
[price] => 9.99
   )
   )

hth,

jb

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Just can't get started !!!!!!

2006-05-23 Thread Olivier percebois-Garve

This is probably a mod_rewrite issue.
http://manual.cakephp.org/chapter/3
see section 4

DavePorter wrote:
> HI everyone,
>
> Read lots on Cake and it looks exactly what I am looking for
>
> Tried working through the blog tutorial, but just can't get it going.
>
> I am using Windows XP Pro & have Apache-Friends XAMPP installed in:
> c:\program files\xampp\
> with htdocs being where all the development stuff goes.
>
> So I then have Cake installed in the htdocs folder ( app folder, cake
> folder, vendors folder ).
>
> So for the blog I'm just entering it in the app folder.  But the
> localhost to view posts/index just does not work !
>
> I placed phpinfo.php in the folder and it works fine !
> http://localhost/app/views/posts/phpinfo.php( here is it's
> location.)
> So apache/php/mysql are all working fine
>
> I know this has to be something really simple, but it's got me stumped.
>
> Appreciate any help !
>
> regards, Dave
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: What's wrong with this little HABTM query?

2006-05-23 Thread stephenrs

Thanks for replying, but I should have come back sooner to close this
out. The problem wasn't the query, or my Cake setup. One of the tables
in the HABTM relationship had a screwed up index on the key field. Once
I fixed the table, the query worked fine...and now I'm getting pretty
comfortable with HABTM in Cake - pretty cool.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread AD7six

Hi Olivier,

I think the point is, that you could save the form locally, change the
hidden field value , and edit/overwrite other entries in the database.

Asume there is some data ACL here´s a real E.g.

Access http://www.noswad.me.uk/tutorials/posts/edit/9
save the form locally
set the form action to be an absolute url
change the hidden field value to "1"
submit the form

And you just edited entry number 1.

If we make the assumption that the user had access to edit post 9, they
just got around the restriction. This is just a trivial example to
demonstrate the question raised.

It raises another problem, which I´ve been pondering for a little
while I might aswell chip in:

If someone knows the name of a database field they shouldn´t have
access to edit, they can easily save an edit a form and update fields.

I´m still thinking about generic solutions to this generic problem ;)

Cheers,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread Olivier percebois-Garve

Hi

first a sidenote: you are using setId() which is deprecated.Should be 
replaced with

$this->audit->id = $_POST["oid"];

Then I'm not sure of your vision of the issue. I think you the edit 
function should always
receive $id as parameter, and modify the row corresponding to that id 
only. This way the $id can't be changed only the corresponding value.
I my scripts I even merged add() and edit() in edit($id = "") and my way 
to make the difference between  adding and editing is  to check weather  
$id is empty or not.

olivvv


[EMAIL PROTECTED] wrote:
> Thanks again
>
> Haha...
> I make it!
> I use the model->db->update method:
>
> first I construct parmaters for 'update',
> $fields=array();
>   foreach (($this->params['data']['audit']) as $k => $v)
> //$this->params['data']['audit'] is the post form data for table
> 'audit'
> {
>   if ($this->audit->hasField($k) && 
> !array_key_exists($k,
> $fields))//use model->hasField to check fileds,
>   {
>   $fields[] = $k;
>   //the fields saved
>   $values[] = htmlspecialchars($v);
> //
>   }
>
> }
>   $this->audit->setId($_POST["oid"]);//$_POST["oid"] is 
> the origin
> PK's value.
>   
> if($this->audit->hasAny($this->audit->primaryKey."='".$this->audit->id."'")){//if
> the PK value is exists in database
>   if($this->audit->db->update($this->audit, $fields, 
> $values)){
>   $this->set("ajaxsubscr"," language=\"javascript\">new
> Ajax.Updater('ajax_update','/audit/index'+qstr+'',
> {onComplete:function(request){Effect.Fade('".$this->action."_audit');stripe();initDrag();},asynchronous:true,evalScripts:true});");//ajax
> update,update audit list
>   }
> }
>   $this->render('posterror'); //do something
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread Langdon Stevenson

Hi AD7six

My solution to the problem of tampering with record numbers and the like 
sprang out of the Wizards discussion late last week.

The Post-Redirect-Get pattern requires that the record be held in a 
server side session between the post and the get.  I now always put a 
retrieved or new record into a session before it is sent for editing.

This allows me to check for stale data, and also for tampering with 
things like ID numbers and field names when processing a post since the 
data can be validated against the original held in the session.

Regards,
Langdon


AD7six wrote:
> Hi Olivier,
> 
> I think the point is, that you could save the form locally, change the
> hidden field value , and edit/overwrite other entries in the database.
> 
> Asume there is some data ACL here´s a real E.g.
> 
> Access http://www.noswad.me.uk/tutorials/posts/edit/9
> save the form locally
> set the form action to be an absolute url
> change the hidden field value to "1"
> submit the form
> 
> And you just edited entry number 1.
> 
> If we make the assumption that the user had access to edit post 9, they
> just got around the restriction. This is just a trivial example to
> demonstrate the question raised.
> 
> It raises another problem, which I´ve been pondering for a little
> while I might aswell chip in:
> 
> If someone knows the name of a database field they shouldn´t have
> access to edit, they can easily save an edit a form and update fields.
> 
> I´m still thinking about generic solutions to this generic problem ;)
> 
> Cheers,
> 
> AD7six

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Scaffold (prompt forms)

2006-05-23 Thread Fernando

how to change the (promp/caption) of scaffold forms?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread nate

> If someone knows the name of a database field they shouldn´t have
> access to edit, they can easily save an edit a form and update fields.

That's where the $fieldList parameter of Model::save( ) comes in handy.
 It allows you to specify a whilelist of fields in a situation where
the user has control over the data they're submitting (i.e. form
posting).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Caching Model-Descriptions to Memcache?

2006-05-23 Thread nate

Yeah, we have plans in the works for something similar to that.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: bake.php Maximum execution time of 60 seconds exceeded

2006-05-23 Thread [EMAIL PROTECTED]

I have the same problem and the order I bake makes no difference

I have risen my max exec time to 60 and it still shows a time of 30
seconds exceeded ...

is it not possible to disable the max exec time per scripts ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



How to avoid the 'EDIT' action 'ADD' a new record when you changed PK.

2006-05-23 Thread [EMAIL PROTECTED]

If you allow user to change the table's primary key from a form and you
use $this->modelname->save($this->params['data'])) in controller ,there
will be a new record has the new PK value apprears,but the old one
stills there,how to avoid that?

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Help: Advanced Setup: Alternative Installation Options

2006-05-23 Thread Kotekar

Hey thanx, i got fixed


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---