On Oct 23, 2006, at 12:04 PM, [EMAIL PROTECTED] wrote:
>
>
> John David Anderson (_psychic_) wrote:
>>
>>> I did try some of the snippets out there for overriding
>>> invalidate in
>>> app_model.php. I mainly just encountered preg-match errors all over
>>> the
>>> place and they didn't work.
>>
>> You shouldn't need to override it.. just perform your non-regex
>> validation (date checking, CC number checking, uniqueness, etc.) and
>> use invalidate to flag fields as problmatic so Cake can take it from
>> there.
>>
>
> I might be using the wrong reference to the method I was talking
> about,
> I'm at work, this is a home project. But I think I get what you're
> saying, and I think it's what I was believing I should do. Do my extra
> validation in the controller before passing it on to the model?
Yep. Do your custom logic before trying to call $this->ModelName->save
().
> Using
> this->invalidate (think that's the syntax)?
$this->ModelName->invalidate('fieldname'). Check the API link I
provided in the original message.
> This does give me a chance
> to pass specific error messages on also.
When used with tagErrorMsg(), yes.
> I'll post an example in the
> next day or so in this thread just to make sure i'm on the right page
> and doing things the Cake way.
Good luck! Seems you're on the right track.
-- John
>
>
>
>>> Database Access - Right now I'm just building a simple registration
>>> form for users. I noticed with sql debugging turned on that on the
>>> initial page view, before any of the data is submitted, a sql
>>> query is
>>> made to describe the table (DESC `users`). It appears that every
>>> page
>>> view using the model/controller/view setup does this query? This
>>> looks
>>> to me like unnecessary sql queries. Is there a way to set it so it
>>> only
>>> queries when it actually needs to interact with the database?
>>
>> Yeah, set DEBUG to 0 in /app/config/core.php (production mode).
>>
>> -- John
>
>
> So turning off debug also stops these calls to the database? Or
> does it
> just not log that it's doing them anymore?
>
> ( rest of questions and answers snipped to save bandwidth as they were
> answered more than well enough :) )
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---