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

Re: TreeBehavior across different models

2009-06-21 Thread Greg Baker
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

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

2009-06-18 Thread Greg Baker
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

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

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

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 =

Re: TreeBehavior across different models

2009-06-17 Thread Greg Baker
. 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

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

Re: routing to control layout

2009-06-16 Thread Greg Baker
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

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.

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?

Re: routing to control layout

2009-06-15 Thread Greg Baker
, 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

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

Re: Chaining together objects

2009-06-05 Thread Greg Baker
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

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

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

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

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

Re: Custom html helper

2008-04-04 Thread Greg Baker
/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

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

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

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

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

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

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]

Re: CookBook PDF

2008-03-09 Thread Greg Baker
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

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

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

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

Re: Using a model in app_controller

2008-03-08 Thread Greg Baker
() { $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

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

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

Re: overriding tags

2008-03-08 Thread Greg Baker
: 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

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

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?

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

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

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:

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

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

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

'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

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,

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/',

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

Re: Getting information from an external database

2007-12-03 Thread Greg Baker
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

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

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

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