A regex validation question

2008-03-09 Thread Deane
This may be more of a regex question, but I can't seem to get some validation working inside Cake that seems to work fine outside of Cake. A field needs to either be (1) a valid number, or (2) nothing. So, in effect, "You don't have to enter this, but if you do, it better be a number." This...

Using CakePHP's ACL system in a non-CakePHP site?

2007-10-29 Thread Deane
How feasible is it to use the CakePHP ACL system in a non-CakePHP site? I'm hoping to just use the ACL-related objects and database tables independent of the rest of the CakePHP system. Nothing against CakePHP -- there's a very specific reason why I have to do it this way. --~--~-~--~-

Model not saving HABTM relations -- I'm missing something simple here...

2007-10-30 Thread Deane
gt;save($this->data['User']) That's strikes me as not workable on the surface, since I'm not passing the 'Zone' element of the data array to the save() method. So the model can't save the relationships because I'm n

Re: Model not saving HABTM relations -- I'm missing something simple here...

2007-10-30 Thread Deane
Chris: Thanks. What I found was that I needed to pass the entire $this->data structure, rather than just the "User" element. So, not this -- $this->User->save($this->data['User']) -- but this -- $this->User->save($this->data) This seems to have w

Question about inconsistency in the Cake Manual code samples

2007-11-01 Thread Deane
I'm using the boilerplate code from the manual for some basic CRUD operations, and it's led to a question about how data gets into the template. In the "index" method of a controller, you see this: $this->set('Users', $this->User->findAll()); So, we're explicitly assigning the results of fin

HABTM weirdness when no relationships are specified

2007-11-01 Thread Deane
I know I'm not the first to notice this, but I can't find a solution -- My HABTM works fine if there's at least one relationship. In these cases, Cake deletes everything from the interstitial table and inserts the specified relationships. However, if there are NO relationships, Cake never does

Creating and persisting objects independent of the controller

2007-12-04 Thread Deane
If I want to create an object, set some properties, and save it, can I do this in my controller: $MyObject = new ThingaMajig(); $MyObject->some_property = "some value"; $MyObject->save() This object has nothing to do with my controller. This just needs to happen in one of the methods. We've tr

Controller theory question

2007-12-10 Thread Deane
Say I need to make some functionality globally available to all my controllers. What's the functional difference between (1) putting the method on the app_controller, or (2) creating a component and importing it where needed? I can think of two differences, but are there are things I'm not consi

Why doesn't Find* return a group of model objects?

2008-01-04 Thread Deane
My firm is new to CakePHP, and we're struggling with a piece of "Cake Theory." Perhaps you can help -- When you do a Find or a FindAll, why do you get back a big, nested array? When I do Widget->FindAll() why do I not get back an array of Widget objects? Isn't that what a model is for? We wan

Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread Deane
Thanks for the reply. We couldn't disagree more strenuously, and we think you're wrong beyond belief in your reasoning, but we appreciate the response. Deane On Jan 4, 10:17 am, gwoo <[EMAIL PROTECTED]> wrote: > Speed, simplicity, clarity. We feel that a model object in t

Re: Why doesn't Find* return a group of model objects?

2008-01-04 Thread Deane
Gwoo: Let me retract my remarks. I was frustrated, and what I wrote was insulting. You have my apologies. Deane On Jan 4, 11:27 am, gwoo <[EMAIL PROTECTED]> wrote: > Everyone is entitled to their opinion and their choice of f

Using model objects in the controllers

2008-01-07 Thread Deane
A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be "too tempting" to start inserting business logic in the views if you had objects available there. Fine. I'll concede tha

Re: Using model objects in the controllers

2008-01-07 Thread Deane
del, do *this*..." If I can't get clean access to model objects in my controllers, how am I to do this? Deane On Jan 7, 8:14 am, MrTufty <[EMAIL PROTECTED]> wrote: > Deane, > > I have to disagree with your opinion that the business logic belongs > in the controllers. Fr

Re: Using model objects in the controllers

2008-01-07 Thread Deane
ontroller.. > > $results = $this->ModelName- > > >someFunctionYouWroteToGetSomDataBackFromTheDb(); > > unfortunately cake returns an array of results instead of an object.. > so there no doing something like.. > $results->sortBy('date ASC'); > > On Jan 7

Re: Using model objects in the controllers

2008-01-07 Thread Deane
p, and 20 to hydrate the resulting objects, one-by-one...) Deane On Jan 7, 4:12 pm, the_woodsman <[EMAIL PROTECTED]> wrote: > I had similar feelings to this when I first had to get some complex > data through CakePHP, thinking the results of a simple mysql_query or > an object wo

Re: Using model objects in the controllers

2008-01-07 Thread Deane
Good enough. I'll concede this one, then. Thanks, everyone, for your input. Deane On Jan 7, 5:21 pm, AD7six <[EMAIL PROTECTED]> wrote: > On Jan 7, 11:35 pm, Deane <[EMAIL PROTECTED]> wrote: > > > Assume this scenario: > > > I need to retrieve 20 reco