Validation: at least one associated object

2009-06-25 Thread Greg Baker

Suppose I have the following model:

Game hasMany Moves
Move belongsTo Game

Is it possible to specify in the Game model that a game should only be
created when at least one move is associated with the data?

For example, a call to Game::save( array('Game'=array
('title'='foo)) ) should fail but a call to Game::save( array
('Game'=array('title'='foo), 'Move'=array('data'='bar')) ) should
succeed because there is a move attached.

Also, obviously if the Move object can't be saved for some reason then
the entire thing fails also.
Thanks for any input.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: TreeBehavior across different models

2009-06-21 Thread Greg Baker

Thanks for the reply.  I actually did kind of what you said.  I
abstracted my objects into a chainable object and then extended that.
It worked quite nicely and now I can use the useful methods in
TreeBehavior to get the data I need easily.

On Jun 18, 9:40 am, delocalizer conrad.leon...@hotmail.com wrote:
 Hi Greg;
 Yes my experience is that if it's not easily implemented with the core
 Tree behaviour then there is probably a better or at least alternative
 way to do it. Once (and only once) was I determined (desperate?)
 enough to have a heterogeneous model tree, and in that case I used a
 separate model with Tree behaviour just for the structure, with fields
 for the class name  UUID of the model object referred to by each
 node. Worked quite well but had to be careful to keep the the
 structure tree in sync with its models using callbacks so that adding/
 editing/deleting a model did likewise to the tree and vice versa
 Sounds like it all worked out for you anyway.

 cheers mate.

 On Jun 17, 8:28 pm, Greg Baker greg.baker@gmail.com wrote:

  Basically I wanted to create a chain of alternating objects.  For
  example:

  document-comment-document-comment-document-comment

  Not really a tree I guess but I thought I could make use of some of
  the tree behaviour to help me.  I've since come up with my own
  solution so I don't have to use tree.

  On Jun 9, 7:52 am, delocalizer conrad.leon...@hotmail.com wrote:

   Can you describe the context of the problem? ie. what is it that you
   want to achieve?

   On Jun 6, 1:38 am, Greg Baker greg.baker@gmail.com wrote:

Is it possible to use TreeBehavior where parent_id points to an id in
another model, which also uses TreeBehavior?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Webroot and prefix in Router::connect()

2009-06-18 Thread Greg Baker

Hey Adam.  I actually trashed that idea when I noticed it was causing
me problems elsewhere.  You are right that everything seems to work
without prepending this /fb/ to my URLs...  except the webroot
stuff :)

On Jun 17, 11:57 pm, Adam Royle a...@sleekgeek.com.au wrote:
 I see from a previous email you overrode your AppHelper to automatically
 prepend /fb onto all of your links which is causing the prob. Short of
 re-writing your links everywhere, you could modify this method so absolute
 files are not prepended with /fb.

 Cheers,
 Adam

 - Original Message -
 From: Greg Baker greg.baker@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Thursday, June 18, 2009 10:51 AM
 Subject: Webroot and prefix in Router::connect()

  I am working on my facebook app (you may have seen other messages here
  by me about this) and I have hit another small problem.

  Having set up my routing so that I may enter my app either via
  facebook or via a webpage I find that I cannot access files in the
  folders in my webroot in facebook.

  For example, some of my routes:
  Router::connect('/fb', array('controller'='pages',
  'action'='display', 'facebook'=true, 'canvas'));
  Router::connect('/fb/help', array('controller'='pages',
  'action'='display',  'facebook'=true, 'help'));
  Router::connect('/fb/:controller/:action/*', array
  ('facebook'=true));

  Router::connect('/', array('controller'='pages',
  'action'='display', 'canvas'));
  Router::connect('/help', array('controller'='pages',
  'action'='display', 'help'));

  Now facebook hits my app using /fb/whatever.  This works so far for
  everything except for my .swf files which reside in my webroot/flash
  directory./

  If I go to /flash/flash.swf I get my file
  If I go to /fb/flash/flash.swf it looks for a FlashController.

  I am so close to getting this working just as I need it.  I think this
  will be my last snag.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



find('threaded') first last

2009-06-18 Thread Greg Baker

Is it possible to use find('threaded') to find only the first and last
objects in a thread?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Changing view file in controller

2009-06-17 Thread Greg Baker

Is it possible to change the view file easily in the AppController?
Basically I want to check $this-params['facebook'] and if it exists I
want the view to render to be, say fbindex.ctp instead of
index.ctp...or fbadd.ctp instead of add.ctp.  I want to do this
because the facebook pages contains fbml while the other pages contain
xhtml.

I know I can do this in every action in my controllers by using $this-
render('fbindex')but is there a more elegant solution?  Perhaps
adding something to AppController::beforeRender() ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: routing to control layout

2009-06-17 Thread Greg Baker

Just as an addition, your solution worked great.  I overcame the
Helper::url() problem by making a custom AppHelper with the following
code:

function url($url = null, $full = false) {
$url = parent::url($url, $full);

if (!empty($this-params['facebook'])) {
$url = str_replace($this-base, $this-base . '/fb', $url);
}

return $url;
}

That way I can use html helper, etc. without it breaking my URLs.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: TreeBehavior across different models

2009-06-17 Thread Greg Baker

Basically I wanted to create a chain of alternating objects.  For
example:

document-comment-document-comment-document-comment

Not really a tree I guess but I thought I could make use of some of
the tree behaviour to help me.  I've since come up with my own
solution so I don't have to use tree.

On Jun 9, 7:52 am, delocalizer conrad.leon...@hotmail.com wrote:
 Can you describe the context of the problem? ie. what is it that you
 want to achieve?

 On Jun 6, 1:38 am, Greg Baker greg.baker@gmail.com wrote:

  Is it possible to use TreeBehavior where parent_id points to an id in
  another model, which also uses TreeBehavior?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Webroot and prefix in Router::connect()

2009-06-17 Thread Greg Baker

I am working on my facebook app (you may have seen other messages here
by me about this) and I have hit another small problem.

Having set up my routing so that I may enter my app either via
facebook or via a webpage I find that I cannot access files in the
folders in my webroot in facebook.

For example, some of my routes:
Router::connect('/fb', array('controller'='pages',
'action'='display', 'facebook'=true, 'canvas'));
Router::connect('/fb/help', array('controller'='pages',
'action'='display',  'facebook'=true, 'help'));
Router::connect('/fb/:controller/:action/*', array
('facebook'=true));

Router::connect('/', array('controller'='pages',
'action'='display', 'canvas'));
Router::connect('/help', array('controller'='pages',
'action'='display', 'help'));

Now facebook hits my app using /fb/whatever.  This works so far for
everything except for my .swf files which reside in my webroot/flash
directory./

If I go to /flash/flash.swf I get my file
If I go to /fb/flash/flash.swf it looks for a FlashController.

I am so close to getting this working just as I need it.  I think this
will be my last snag.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: routing to control layout

2009-06-16 Thread Greg Baker

Yes I will be using fbml also.  I guess I can use explicit URLs.  No
big deal.
Thanks for the excellent help.

On Jun 15, 11:49 pm, Adam Royle a...@sleekgeek.com.au wrote:
 Sorry, I never used reverse routing like that. Maybe someone else with more
 experience can help out?

 With my facebook app I used fbml so my views were custom anyway which meant
 I had to use explicit urls.

 Cheers,
 Adam

 - Original Message -
 From: Greg Baker greg.baker@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Tuesday, June 16, 2009 11:36 AM
 Subject: Re: routing to control layout

 Ahh thank you, that works nicely.
 How about if I want the URLs to persist throughout the app, so that
 $html-link(), say, would point to /AppName/facebook/controller/action
 if $this-params['facebook'] were set?  Would this be possible using
 routing or would I have to do something else?

 On Jun 15, 10:36 pm, Adam Royle a...@sleekgeek.com.au wrote:
  Sure...

  Router::connect('/AppName/facebook/:controller/:action/*',
  array('facebook'
  = 1));

  then in your app controller just check for

  $this-param['facebook']

  - Original Message -
  From: Greg Baker greg.baker@gmail.com
  To: CakePHP cake-php@googlegroups.com
  Sent: Tuesday, June 16, 2009 10:28 AM
  Subject: routing to control layout

   I'm trying to make an app that works standalone as well as with
   facebook. Is it possible to define routing so that if the URL
   matches /AppName/facebook/* it will route to /AppName/* and set a
   parameter facebook=true so I can catch this in the AppController and
   render it using my facebook layout?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



App.base and routing problem

2009-06-16 Thread Greg Baker

I'm writing a facebook app and am having problems with my routing.

First off I changed App.base to point to my facebook canvas path:

Configure::write('App.base', '/my_app');

I did this so I could use $html-url() to construct my URLs in my
views.  It works great except for one problem.  I have a route defined
as follows:

Router::connect('/', array('controller'='pages',
'action'='display', 'canvas'));

Before I changed the App.base it would display the canvas page fine.
With App.base changed to '/my_app' I get an error when visiting '/
my_app/':

Error:  MyAppController could not be found.

If I go to '/my_app/index.php' I get the canvas page fine.
Can anyone understand what is going on here?  Thanks for any advice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



routing to control layout

2009-06-15 Thread Greg Baker

I'm trying to make an app that works standalone as well as with
facebook.  Is it possible to define routing so that if the URL
matches /AppName/facebook/* it will route to /AppName/* and set a
parameter facebook=true so I can catch this in the AppController and
render it using my facebook layout?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: routing to control layout

2009-06-15 Thread Greg Baker

Ahh thank you, that works nicely.
How about if I want the URLs to persist throughout the app, so that
$html-link(), say, would point to /AppName/facebook/controller/action
if $this-params['facebook'] were set?  Would this be possible using
routing or would I have to do something else?

On Jun 15, 10:36 pm, Adam Royle a...@sleekgeek.com.au wrote:
 Sure...

 Router::connect('/AppName/facebook/:controller/:action/*', array('facebook'
 = 1));

 then in your app controller just check for

 $this-param['facebook']

 - Original Message -
 From: Greg Baker greg.baker@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Tuesday, June 16, 2009 10:28 AM
 Subject: routing to control layout

  I'm trying to make an app that works standalone as well as with
  facebook.  Is it possible to define routing so that if the URL
  matches /AppName/facebook/* it will route to /AppName/* and set a
  parameter facebook=true so I can catch this in the AppController and
  render it using my facebook layout?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



TreeBehavior across different models

2009-06-05 Thread Greg Baker

Is it possible to use TreeBehavior where parent_id points to an id in
another model, which also uses TreeBehavior?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Chaining together objects

2009-06-05 Thread Greg Baker

Sorry I wan't explicit in my description.  My tables are named as
such.  I just hastily typed in my description of the problem without
regard to those details.

On Jun 5, 5:31 am, OptimusS optim...@gmail.com wrote:
 Hi i am new in cakephp but i think your problem is with cake's naming
 conventions. Your tables should be named comments and docs

 On Fri, Jun 5, 2009 at 3:28 AM, Greg Baker greg.baker@gmail.com wrote:

  I have the following scenario..  A user can upload a document, that
  document can be commented on, then a new document can be uploaded and
  'attached' to that comment.  This gives a chain of objects kind of
  like this:

  doc-comment-doc-comment-doc-comment

  Where the cardinality of associations is 0..1 for each association.
  In my tables I have the fields doc (comment_id) and a field in comment
  (doc_id).
  I have tried making the following associations in my models:

  doc belongsTo comment
  doc hasOne comment

  comment belongsTo doc
  comment hasOne doc

  ...but this gives me a weird SQL error: Not unique table/alias:
  'Comment'.  I'm kind of lost, can anyone help me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



passedArgs vs. function parameters

2009-06-05 Thread Greg Baker

Why would one choose passing arguments like object_id:whatever over /
view/whaver or vice versa?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Chaining together objects

2009-06-04 Thread Greg Baker

I have the following scenario..  A user can upload a document, that
document can be commented on, then a new document can be uploaded and
'attached' to that comment.  This gives a chain of objects kind of
like this:

doc-comment-doc-comment-doc-comment

Where the cardinality of associations is 0..1 for each association.
In my tables I have the fields doc (comment_id) and a field in comment
(doc_id).
I have tried making the following associations in my models:

doc belongsTo comment
doc hasOne comment

comment belongsTo doc
comment hasOne doc

...but this gives me a weird SQL error: Not unique table/alias:
'Comment'.  I'm kind of lost, can anyone help me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



item hasMany images form

2008-12-22 Thread Greg Baker

Does anybody have an example of how to make a form with a hasMany
image association?

I have Items which have Images and I want to be able to upload these
images when an Item is created.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM invalidation

2008-04-15 Thread Greg Baker

I have two classes, Application  Package, that are related through
HABTM.

I want it such that when a user is creating an application she must
choose a package as well.  I don't think I can do this in the
application model, so I guess I have to do it in the controller.  My
problem is I am not sure how to go about this.  I tried doing a $this-
Application-invalidate('Package'); but that doesn't work.

Any thoughts?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Custom html helper

2008-04-04 Thread Greg Baker

Very interesting fixexactly what I was looking for.  Thanks

On Apr 4, 12:26 pm, grigri [EMAIL PROTECTED] wrote:
 There should be an official solution sometime involving aliased
 helpers.

 In the meantime, check out my hack here:

 http://groups.google.com/group/cake-php/browse_thread/thread/1c1c3701...

 On Apr 4, 3:02 pm, Greg Baker [EMAIL PROTECTED] wrote:

  I want to create a custom HTML helper that extends htmlhelper..
  However because of the code I have already that I don't want to
  change, I want to name this helper so that I can use $html-... in my
  views.

  Any way I can do this?
  Normally if this was a new project I'd just create a new class and use
  that in my views, but I have a lot of code changing to do in this one
  if I do 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?hl=en
-~--~~~~--~~--~--~---



Custom html helper

2008-04-04 Thread Greg Baker

I want to create a custom HTML helper that extends htmlhelper..
However because of the code I have already that I don't want to
change, I want to name this helper so that I can use $html-... in my
views.

Any way I can do this?
Normally if this was a new project I'd just create a new class and use
that in my views, but I have a lot of code changing to do in this one
if I do 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?hl=en
-~--~~~~--~~--~--~---



Catching MySQL errors

2008-03-28 Thread Greg Baker

How can I capture a MySQL error like the following:

Warning (512): SQL Error: 1062: Duplicate entry
'TestSlot-47e9547d-6570-4e3e-9834-16b88699522c' for key 2 [CORE/cake/
libs/model/datasources/dbo_source.php, line 459]

Basically I have a unique key set across two fields in a table so that
if I add a 'Slot' which belongsTo a 'Conference' the slot name must be
unique within that conference.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Catching MySQL errors

2008-03-28 Thread Greg Baker

yah, okay..  I just figured that since I _could_ do it in the database
schema, I _should_ do it there.  I'll make a custom method.

thanks

On Mar 28, 2:12 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Fri, Mar 28, 2008 at 12:09 PM, Dardo Sordi Bogado

 [EMAIL PROTECTED] wrote:

   Wouldn't be better to validate the uniqueness before saving the data?

 Dardo beat me to it...I was going to suggest the same thing:  a custom
 validation method to make sure you have a unique slot name

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Catching MySQL errors

2008-03-28 Thread Greg Baker

Thanks Jon, the unique field is actually a pairwise uniqueness.  So I
believe I do need a custom method.  I just did a $this-findCount() in
my model with the fields that need to be unique.  Works well.

On Mar 28, 2:36 pm, jonknee [EMAIL PROTECTED] wrote:
  Dardo beat me to it...I was going to suggest the same thing:  a custom
  validation method to make sure you have a unique slot name

 No need to make it custom, it's built into 1.2 Model::isUnique() and
 can be accessed as a validation rule:

 'rule' = 'isUnique'

 It works great, I'm using it for usernames/email addresses.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Homepage Troubles

2008-03-09 Thread Greg Baker

or
Router::connect('/admin', array('controller' = 'dashboard', 'action'
= 'index', 'admin' = true));

On Mar 9, 6:15 am, rtconner [EMAIL PROTECTED] wrote:
 Router::connect('/admin', array('controller' = 'dashboard',
 'action'= 'index', 'prefix'='admin'));

 On Mar 8, 5:53 pm, Kyle Decot [EMAIL PROTECTED] wrote:

  I have turned on admin routing and I have put the following in my
  routes.php file:

  Router::connect('/admin', array('controller' = 'dashboard', 'action'
  = 'admin_index'));

  The problem is that I get the following error:

  Error: DashboardController::admin_index() cannot be accessed directly.

  How do I fix this? Thanks for any help you can provide me with.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: CookBook PDF

2008-03-09 Thread Greg Baker

with add due respect, Chris..  How much time would be wasted creating
a PDF?  30 seconds?

I would gladly do it if my PDF writer didn't crap out after page 2 of
the document.

On Mar 8, 11:01 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Sat, Mar 8, 2008 at 6:14 PM, Mech7 [EMAIL PROTECTED] wrote:

   The API in pdf would be nice too :p

 A pony to ride would be nice as well, but that's not happening either.

 The API is likely to change before 1.2 is labeled as being final, so I
 would say providing a PDF of it is a waste.

 The Cookbook is a living and breathing document, so again, creating
 a PDF of that would be a waste of time as well.

 Just my opinion.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: CookBook PDF

2008-03-09 Thread Greg Baker

Sorry Nate.  I really didn't think my request would cause such a
burden.  I didn't mean to offend anyone, I was just asking if someone
already had the cookbook in PDF format (not create it for me).
Believe me if I knew you guys felt so strongly about the issue I
wouldn't have 'pressed it'.

Thanks koko for the PDF, I appreciate it.

On Mar 9, 2:11 pm, nate [EMAIL PROTECTED] wrote:
 Again Greg, that's 30 seconds of someone else's time.  But it's really
 more than that, since it would also have to be someone's
 responsibility to keep said PDF updated with the Cookbook, which
 changes often, sometimes hourly.  Not to mention that it exists in a
 dozen languages.  So that's creating an uploading 12 PDFs anywhere
 from once a week to once a day.  Gets to be over 30 seconds pretty
 quickly.

 But that ignores the larger problem, which is this: by continually
 pressing the issue, you're essentially trying to take your own problem
 and make it someone else's.  This is not cool.  Now the beauty of Open
 Source, that I've found, is that when you have a problem, rather than
 trying to get someone else to fix it for you, you fix it for
 yourself.  Not only for yourself, but for everyone.

 So Greg, you've now been presented with an opportunity, and thank God
 there is more than one way to convert HTML to PDF (html2pdf anyone?).
 Once you are able to solve this problem for yourself, you could not
 only share the benefits with everyone, you could even automate it so
 that we never have to solve this problem again.  I know everyone on
 the team would be very grateful, especially John.

 Just my two pennies.  Think about it.

 On Mar 9, 8:51 am, Greg Baker [EMAIL PROTECTED] wrote:

  with add due respect, Chris..  How much time would be wasted creating
  a PDF?  30 seconds?

  I would gladly do it if my PDF writer didn't crap out after page 2 of
  the document.

  On Mar 8, 11:01 pm, Chris Hartjes [EMAIL PROTECTED] wrote:

   On Sat, Mar 8, 2008 at 6:14 PM, Mech7 [EMAIL PROTECTED] wrote:

 The API in pdf would be nice too :p

   A pony to ride would be nice as well, but that's not happening either.

   The API is likely to change before 1.2 is labeled as being final, so I
   would say providing a PDF of it is a waste.

   The Cookbook is a living and breathing document, so again, creating
   a PDF of that would be a waste of time as well.

   Just my opinion.

   --
   Chris Hartjes
   Internet Loudmouth
   Motto for 2008: Moving from herding elephants to handling snakes...
   @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: CookBook PDF

2008-03-09 Thread Greg Baker

Okay I know I opened a Pandora's box here, but I really didn't mean
to.  When I requested a PDF, I was requesting that someone who had one
send it to me.  I wasn't asking that the CookBook authors create me
one, nor was I asking for one to be published anywhere for public
use.  I certainly wasn't asking that the CookBook site be modified to
provide live snapshots of the document.  I simply wanted to know if
someone had a version that I could have since my PDF writer seems to
have kicked the bucket.

I don't understand how so much could be read into such a simple
request.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Indexing a HABTM table

2008-03-08 Thread Greg Baker

Is it normally good practice to index a HABTM table?  If so how do you
do this?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Using a model in app_controller

2008-03-08 Thread Greg Baker

I want to generate a few routes automatically in my application by
finding all 'conferences' and using the 'path' field from each.  Do do
this I need to findAll conferences in my app_controller, but I don't
know how.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Using a model in app_controller

2008-03-08 Thread Greg Baker

Thanks, I actually did what I was trying to do by adding an
App::import() to my routes.php and using my model in there.  It works
perfect.

On Mar 8, 1:58 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 AppController var $uses = array('Conference');
 AppController::beforeFilter() { $this-Conference-find('all'); // do
 your stuff here }

 You are better encapsulating this in a component.

 On Sat, Mar 8, 2008 at 12:06 PM, Greg Baker [EMAIL PROTECTED] wrote:

   I want to generate a few routes automatically in my application by
   finding all 'conferences' and using the 'path' field from each.  Do do
   this I need to findAll conferences in my app_controller, but I don't
   know how.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: textarea

2008-03-08 Thread Greg Baker

You could also wrap your text in a pre or a special p with styles
set to preserve whitespace.

http://webdesign.about.com/od/styleproperties/p/blspwhitespace.htm

On Mar 7, 6:59 pm, bob [EMAIL PROTECTED] wrote:
 In a textarea, how do you retain the spacings and carriage returns when you
 save to the database or output in the view?

 for example, if i enter
 first line

 third line

 I want to output to the user keeping all the carriage returns. But right
 now, it just outputs first line   third line
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



CookBook PDF

2008-03-08 Thread Greg Baker

Anyone have the cookbook in PDF format?  I tried printing it using my
pdf writer in linux but it only prints the first two pages for some
reason.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: overriding tags

2008-03-08 Thread Greg Baker

thanks, works perfectly.

On Mar 7, 1:58 pm, Mariano Iglesias [EMAIL PROTECTED]
wrote:
 If you are on 1.2:

 http://www.cricava.com/blogs/index.php?blog=6title=overriding_specif...
 _tags_before_usimore=1c=1tb=1pb=1

 -MI

 ---

 CakeFest Hispano: December, 2008 - Buenos Aires, Argentina 
 -http://es.cakefest.org

 Remember, smart coders answer ten questions for every question they ask.
 So be smart, be cool, and share your knowledge.

 BAKE ON!

 blog:http://www.MarianoIglesias.com.ar

 -Mensaje original-
 De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
 de Greg Baker
 Enviado el: Viernes, 07 de Marzo de 2008 9:08 a.m.
 Para: Cake PHP
 Asunto: Re: overriding tags

 Is there a standard way of changing a tag format?  I notice in 1.2
 they're moved to htmlhelper..  I don't want to create a custom helper
 just to override a tag in htmlhelper.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



overriding tags

2008-03-07 Thread Greg Baker

Is there a standard way of changing a tag format?  I notice in 1.2
they're moved to htmlhelper..  I don't want to create a custom helper
just to override a tag in htmlhelper.

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Optional Form Field

2008-03-07 Thread Greg Baker

I did this by adding 'required' = false, 'allowEmpty' = true in my
validation array

On Mar 7, 8:32 am, Kyle Decot [EMAIL PROTECTED] wrote:
 I want to have an optional field in my form but I also want to
 validate it if they do decide to fill it in. How would I do this?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP v1.2 stable enough for production?

2008-03-06 Thread Greg Baker

thanks for the tips.  sorry to rehash an already answered question.
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Baking via web

2008-03-06 Thread Greg Baker

Is it possible to run the bake script through the web?  Is it strictly
a console 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?hl=en
-~--~~~~--~~--~--~---



Problem with parameter:value notation

2008-03-06 Thread Greg Baker

I can't seem to get parameter passing in URLs to work when using the
':' separator...

$html-link(__('List Registration Fees', true), array('controller'=
'registration_fees', 'action'='index', 'conference'=
$conference['Conference']['id']));

generates a link like this:

http://localhost/conferences/admin/registration_fees/index/conference:47d02855-7270-430f-a533-2e55cabe3434

and in my admin_index($conference = null) {} method I echo out my
$conference variable and its always empty...
however if I change the URL to conference/47d02855-7270-430f-
a533-2e55cabe3434 the echo works.

So is there a special switch I have to turn on to get the former to
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?hl=en
-~--~~~~--~~--~--~---



Re: Problem with parameter:value notation

2008-03-06 Thread Greg Baker

OMG nevermind I found the solution about 5 seconds after I posted
this...  $this-params

On Mar 6, 3:02 pm, Greg Baker [EMAIL PROTECTED] wrote:
 I can't seem to get parameter passing in URLs to work when using the
 ':' separator...

 $html-link(__('List Registration Fees', true), array('controller'=
 'registration_fees', 'action'='index', 'conference'=
 $conference['Conference']['id']));

 generates a link like this:

 http://localhost/conferences/admin/registration_fees/index/conference...

 and in my admin_index($conference = null) {} method I echo out my
 $conference variable and its always empty...
 however if I change the URL to conference/47d02855-7270-430f-
 a533-2e55cabe3434 the echo works.

 So is there a special switch I have to turn on to get the former to
 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?hl=en
-~--~~~~--~~--~--~---



Model-find('list') with conditions

2008-03-06 Thread Greg Baker

Anybody know how to use Model-find('list') but supply conditions to
that?

Or

Anybody know how to generate a similar list using another method so I
can use conditions?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



CakePHP v1.2 stable enough for production?

2008-02-23 Thread Greg Baker

I know its beta..  But I'm wondering if people are using 1.2 in
production environments?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



'required' field in form view

2008-01-23 Thread Greg Baker

I have two models: Application  CreditCard...
The application requires a user to input their credit card
information, so instead of having a credit_cards_controller and
related views, I just use the application add view.

My problem is that the credit card information is required, but since
I'm using $form-input('CreditCard.') in my view it doesn't add
the 'required' class to the input div.

Is there a way to get $form-input() to check whether or not the
credit card fields are required?
Greg
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Postal code validation for multiple countries

2008-01-21 Thread Greg Baker

I need to check my postal code field for Canada and US postal codes..
I tried using the following postal validation but it doesn't work..

'postal_code' = array(
'zip' = array(
'rule'  = array('postal', 
null, 'us'),
'required'  = true,
'allowEmpty'= false,
'message'   = 'Invalid postal/zip 
code'
),
'postal' = array(
'rule'  = array('postal', 
null, 'ca'),
'required'  = true,
'allowEmpty'= false,
'message'   = 'Invalid postal/zip 
code'
)
)

it seems perhaps this type of validation is ANDed and not ORd .. Is
this correct?  Is there a way I can check for both countries without
writing my own validation routine?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Routing problem when using admin urls

2008-01-11 Thread Greg Baker

I want to route www.example.com/admin to www.example.com/admin/foo/index

so I tried the following routes, none of which work..

 $Route-connect('/admin/', array('controller' = 'foo', 'action'
= 'admin_index')) // gives me a Private Method in Controller error
 $Route-connect('/admin/', array('controller' = 'foo', 'action'
= 'index'))  //kinda works, but doesn't connect me to
Foo::admin_index() but rather just Foo::index()

Is it possible to do what I am looking for here?
--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Rendering a different main page

2008-01-10 Thread Greg Baker

Yes, that's exactly what I wanted. Thank you.

On Jan 9, 5:38 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Jan 9, 2008 3:24 PM, Greg Baker [EMAIL PROTECTED] wrote:



  How can I get the root of my site to display a different page, without
  using a redirect?

  For example..  www.example.com/registrationshould in fact actually
  renderwww.example.com/registrant/addbut the URL should not change.

 Have you tried using custom routes?

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Getting information from an external database

2007-12-03 Thread Greg Baker

Thanks, Grant.  Didn't think it would be that easy...

The only issue I have is that the tables in this external database are
not standard.  For example student IDs are not stored in an 'id'
field.
However I'm sure I will get past that limitation.

Greg

On Dec 3, 3:02 am, Grant Cox [EMAIL PROTECTED] wrote:
 Connecting to multiple databases is easy.  Just add the extra
 connection to your /app/config/database.php, and have the appropriate
 var $useDbConfig in your Student model class.

 On Dec 3, 4:54 am, Greg Baker [EMAIL PROTECTED] wrote:

  How would one go about gathering information from an external
  database?  My application contains all the relevant information
  required except for one 'object'students.

  My student information is stored in an oracle database which I can
  read from.  So would I be correct to create a new model class for my
  students and override all the relevant methods for the class such as
  findAll, etc?

  The student objects are linked using HABTM tables to the objects in
  the local database using a unique student number.

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Using Pear with Oracle

2007-12-03 Thread Greg Baker

I seem to be having a little trouble getting cake to connect to Oracle
using Pear.  The config file says to use 'driver' = 'pear-
drivername' (which I assume would be pear-oci8), but this does not
work.  So I tried using 'driver' = 'pear' which got me a little
further..  Here's a snippet of my configuration, please tell me if I
am correct..

var $oracle = array(
'driver' = 'pear',
'connect' = 'oci_connect',
'host' = 'my.hostname.com',
'login' = 'user',
'password' = 'password',
'database' = 'database'
);

When I attempt to view my app I get the following error:
Warning: Missing argument 1 for DboPear::connect(), called in /usr/
share/php/cake/libs/model/datasources/dbo_source.php on line 90 and
defined in /usr/share/php/cake/libs/model/dbo/dbo_pear.php on line 61.

Argument 1 being the $connect variable.

So anyway, I cannot find any extensive documentation on using pear
with Cake, so any help would be greatly appreciated.  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?hl=en
-~--~~~~--~~--~--~---



Re: Using Pear with Oracle

2007-12-03 Thread Greg Baker

I think I have it working using the dbo_oracle from the new version of
Cake.  I scrapped trying to use pear.

On Dec 3, 1:16 pm, Greg Baker [EMAIL PROTECTED] wrote:
 I seem to be having a little trouble getting cake to connect to Oracle
 using Pear.  The config file says to use 'driver' = 'pear-
 drivername' (which I assume would be pear-oci8), but this does not
 work.  So I tried using 'driver' = 'pear' which got me a little
 further..  Here's a snippet of my configuration, please tell me if I
 am correct..

 var $oracle = array(
 'driver' = 'pear',
 'connect' = 'oci_connect',
 'host' = 'my.hostname.com',
 'login' = 'user',
 'password' = 'password',
 'database' = 'database'
 );

 When I attempt to view my app I get the following error:
 Warning: Missing argument 1 for DboPear::connect(), called in /usr/
 share/php/cake/libs/model/datasources/dbo_source.php on line 90 and
 defined in /usr/share/php/cake/libs/model/dbo/dbo_pear.php on line 61.

 Argument 1 being the $connect variable.

 So anyway, I cannot find any extensive documentation on using pear
 with Cake, so any help would be greatly appreciated.  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?hl=en
-~--~~~~--~~--~--~---



Getting information from an external database

2007-12-02 Thread Greg Baker

How would one go about gathering information from an external
database?  My application contains all the relevant information
required except for one 'object'students.

My student information is stored in an oracle database which I can
read from.  So would I be correct to create a new model class for my
students and override all the relevant methods for the class such as
findAll, etc?

The student objects are linked using HABTM tables to the objects in
the local database using a unique student number.

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---