Translate error messages

2008-04-09 Thread stefanb

How can I translate the error messages in validate arrays?

example:

 array(
'validtext' => array('rule' => 
array('validTitle', 'name'),
'message' => 'Not a 
valid name, you fool!'),
'between' => array('rule' => 
array('between', 3, 32),
'message' => 'Must be 
between 3 and 32 characters long')),
'description' => array('rule' => array('validText',
'description'),
'message' => 'Not a valid description, 
you fool!'),
'url' => array('rule' => 'url',
'required' => false,
'allowEmpty' => true,
'message' => 'Not a valid URL'));
?>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Functions

2008-04-08 Thread stefanb

Where is one supposed to put generally applicable functions that
should be available throughout the application, or better still;
across several applications?

What I would prefer is to have a class, or several classes, containing
static functions, like:



and be able to call such functions from all controllers, models, views
etc...

Or is there a more cakeish way to 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: Modules?

2007-10-11 Thread stefanb

RTFM:
"Critics say that frequent users of the phrase (or similar variants)
are simply expressing elitism, and that their attitude drives away
newcomers without helping them. Their time could better be spent
adding the question and answer to an FAQ, pointing the user to a
helpful website, or simply not responding."

Why this hostility towards an obvious Cake n00b? Don't you have
anything better to do? I didn't know that the concept was called
plugins in Cake. A simple reply like "Please read the section on
Plugins in the manual" would suffice. No need to add the "did you even
bother" part. Get some social manners...

On Oct 11, 5:10 pm, "Wayne Fay" <[EMAIL PROTECTED]> wrote:
> RTFM is a perfectly reasonable response to a question like this...
>
> Honestly, have you read the manual? Plugins are covered in some depth.
> Your question makes it obvious that you have not (pure laziness?),
> which makes people less likely to bother responding to your
> question(s). Go read it now!! And print it for future reference!!
>
> Wayne
>
> On 10/11/07, Christian Winther <[EMAIL PROTECTED]> wrote:
>
>
>
> > No, the plugin part is right
>
> > But the first part about you not bothering to search for answer first is 
> > also true
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > stefanb
> > Sent: 11. oktober 2007 13:39
> > To: Cake PHP
> > Subject: Re: Modules?
>
> > So a plugin is not the same as a module? Now I'm confused.
>
> > On Oct 11, 12:43 pm, dardosordi <[EMAIL PROTECTED]> wrote:
> > > Though the first half is the correct one.
>
> > > On Oct 10, 10:24 am, stefanb <[EMAIL PROTECTED]> wrote:
>
> > > > Thank you for the second half of your reply. The first half didn't
> > > > help me at all.
>
> > > > On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > > > > Did you even bother to look in the manual or the group ?
>
> > > > > Its called plugins in cake
>
> > > > > -Original Message-
> > > > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf 
> > > > > Of stefanb
> > > > > Sent: 10. oktober 2007 10:36
> > > > > To: Cake PHP
> > > > > Subject: Modules?
>
> > > > > Does Cake support the use of modules?
>
> > > > >www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Modules?

2007-10-11 Thread stefanb

Thank you, finally a reasonable answer! :)

On Oct 11, 3:32 pm, savagekabbage <[EMAIL PROTECTED]> wrote:
> You can consider plugins to be modules of CakePHP as they are built to
> be able to integrate with any Cake installation.
>
> On Oct 11, 7:39 am, stefanb <[EMAIL PROTECTED]> wrote:
>
> > So a plugin is not the same as a module? Now I'm confused.
>
> > On Oct 11, 12:43 pm, dardosordi <[EMAIL PROTECTED]> wrote:
>
> > > Though the first half is the correct one.
>
> > > On Oct 10, 10:24 am, stefanb <[EMAIL PROTECTED]> wrote:
>
> > > > Thank you for the second half of your reply. The first half didn't
> > > > help me at all.
>
> > > > On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > > > > Did you even bother to look in the manual or the group ?
>
> > > > > Its called plugins in cake
>
> > > > > -Original Message-
> > > > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf 
> > > > > Of stefanb
> > > > > Sent: 10. oktober 2007 10:36
> > > > > To: Cake PHP
> > > > > Subject: Modules?
>
> > > > > Does Cake support the use of modules?
>
> > > > >www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Modules?

2007-10-11 Thread stefanb

No, the second half is wrong.

On Oct 11, 2:59 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
> No, the plugin part is right
>
> But the first part about you not bothering to search for answer first is also 
> true
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of stefanb
> Sent: 11. oktober 2007 13:39
> To: Cake PHP
> Subject: Re: Modules?
>
> So a plugin is not the same as a module? Now I'm confused.
>
> On Oct 11, 12:43 pm, dardosordi <[EMAIL PROTECTED]> wrote:
> > Though the first half is the correct one.
>
> > On Oct 10, 10:24 am, stefanb <[EMAIL PROTECTED]> wrote:
>
> > > Thank you for the second half of your reply. The first half didn't
> > > help me at all.
>
> > > On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > > > Did you even bother to look in the manual or the group ?
>
> > > > Its called plugins in cake
>
> > > > -Original Message-
> > > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > > > stefanb
> > > > Sent: 10. oktober 2007 10:36
> > > > To: Cake PHP
> > > > Subject: Modules?
>
> > > > Does Cake support the use of modules?
>
> > > >www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Modules?

2007-10-11 Thread stefanb

So a plugin is not the same as a module? Now I'm confused.

On Oct 11, 12:43 pm, dardosordi <[EMAIL PROTECTED]> wrote:
> Though the first half is the correct one.
>
> On Oct 10, 10:24 am, stefanb <[EMAIL PROTECTED]> wrote:
>
> > Thank you for the second half of your reply. The first half didn't
> > help me at all.
>
> > On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > > Did you even bother to look in the manual or the group ?
>
> > > Its called plugins in cake
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > > stefanb
> > > Sent: 10. oktober 2007 10:36
> > > To: Cake PHP
> > > Subject: Modules?
>
> > > Does Cake support the use of modules?
>
> > >www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Modules?

2007-10-11 Thread stefanb

... and yet you took the time to answer my basic question. How will I
then learn the lesson? ;)


On Oct 11, 12:41 pm, Marcin Domanski aka kabturek <[EMAIL PROTECTED]>
wrote:
> On Oct 10, 3:24 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > Thank you for the second half of your reply. The first half didn't
> > help me at all.
>
> The first part should help you realize that you should first invest
> some time by looking at the manual. If you don't have time to do it
> why do you think ppl have time to answer basic posts all the time?
> hope You learned the lesson ;)
> greets,
>
> > On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
>
> > > Did you even bother to look in the manual or the group ?
>
> > > Its called plugins in cake
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
> > > stefanb
> > > Sent: 10. oktober 2007 10:36
> > > To: Cake PHP
> > > Subject: Modules?
>
> > > Does Cake support the use of modules?
>
> > >www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Validation rules and error messages

2007-10-10 Thread stefanb

OK, assuming the validation message is placed in the model, how can I
then display an error message like this:

The username "abba" is already registered


On Oct 10, 8:49 pm, abba bryant <[EMAIL PROTECTED]> wrote:
> Instead of trolling how about you re-read what I wrote.
> A message is data - how that message is presented is not. An error message
> or a string of text is a great deal less than the html / javascript / css
> used to display that message.
>
> Putting data into a model whether it maps to a field in a table or not is
> the CORRECT implementation of an MVC pattern. Use the view to output said
> data and to format and mark it up how you would like.
>
> Abba
>
>
>
> stefanb-3 wrote:
>
> > So you're saying I should put HTML and javascript code in my model
> > too. All I need in my view is a variable sent from the model
> > containing the display code, and echo that out...
>
> > On Oct 10, 1:58 am, abba bryant <[EMAIL PROTECTED]> wrote:
> >> That isn't accurate either.
> >> The model can set any data it wants. The controller should then forward
> >> that
> >> data onto the view. There is no definitive right or wrong way to generate
> >> the error messages - simply a correct layer for displaying them.
>
> >> If the error pertains to the data the model is supposed to recieve or is
> >> related to a problem fetching data that should be available then by all
> >> means allow the model to store the error messages. Just don't output them
> >> from anything that isn't a view file.
>
> >> Wayne Fay wrote:
>
> >> >> > Yes, but according to the MVC pattern, what the user sees (like
> >> error
> >> >> > messages) really is supposed to go into the view, not the model...
>
> >> >> Are you saying that a model cannot generate error messages that need
> >> >> to be displayed in a view?
>
> >> > You *can*... But according to MVC principles, you *shouldn't*.
>
> >> > Wayne
>
> >> --
> >> View this message in
> >> context:http://www.nabble.com/Validation-rules-and-error-messages-tf4581362.h...
> >> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> View this message in 
> context:http://www.nabble.com/Validation-rules-and-error-messages-tf4581362.h...
> Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Modules?

2007-10-10 Thread stefanb

Thank you for the second half of your reply. The first half didn't
help me at all.

On Oct 10, 3:12 pm, "Christian Winther" <[EMAIL PROTECTED]> wrote:
> Did you even bother to look in the manual or the group ?
>
> Its called plugins in cake
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of stefanb
> Sent: 10. oktober 2007 10:36
> To: Cake PHP
> Subject: Modules?
>
> Does Cake support the use of modules?
>
> www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: Validation rules and error messages

2007-10-10 Thread stefanb

So you're saying I should put HTML and javascript code in my model
too. All I need in my view is a variable sent from the model
containing the display code, and echo that out...

On Oct 10, 1:58 am, abba bryant <[EMAIL PROTECTED]> wrote:
> That isn't accurate either.
> The model can set any data it wants. The controller should then forward that
> data onto the view. There is no definitive right or wrong way to generate
> the error messages - simply a correct layer for displaying them.
>
> If the error pertains to the data the model is supposed to recieve or is
> related to a problem fetching data that should be available then by all
> means allow the model to store the error messages. Just don't output them
> from anything that isn't a view file.
>
>
>
> Wayne Fay wrote:
>
> >> > Yes, but according to the MVC pattern, what the user sees (like error
> >> > messages) really is supposed to go into the view, not the model...
>
> >> Are you saying that a model cannot generate error messages that need
> >> to be displayed in a view?
>
> > You *can*... But according to MVC principles, you *shouldn't*.
>
> > Wayne
>
> --
> View this message in 
> context:http://www.nabble.com/Validation-rules-and-error-messages-tf4581362.h...
> Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Modules?

2007-10-10 Thread stefanb

Does Cake support the use of modules?

www.example.com/module/controller/action/var1/val1/var2/val2


--~--~-~--~~~---~--~~
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: public function, but not action

2007-10-10 Thread stefanb

No, I did not try to access them via browser. I think you're missing
my point.
I don't want to use underscore on my public method, since I already
use that convention on my protected methods.
And this public method should be placed in the controller, not the
model...

On 10 Okt, 05:16, rtconner <[EMAIL PROTECTED]> wrote:
> lol, did you actually try to access these methods via browser? if you
> start it with and underscore, it does not get dispatched.
>
> but yeah if you have too many methods in your controller you are
> likely doing something wrong. most logic should go in your models.
>
> On Oct 9, 2:56 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > Hmm, I already use _foo() for protected methods and __bar() for
> > private methods.
>
> > What I'm looking for, is some sort of config that allows my to say
> > "don't dispatch these methods" in an array or something...
>
> > On Oct 9, 10:34 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > use an underscore...
>
> > > _functionName() {}
>
> > > On Oct 9, 12:43 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > How can I specify that a public function in a controller should NOT be
> > > > an action?


--~--~-~--~~~---~--~~
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: public function, but not action

2007-10-09 Thread stefanb

Hmm, I already use _foo() for protected methods and __bar() for
private methods.

What I'm looking for, is some sort of config that allows my to say
"don't dispatch these methods" in an array or something...

On Oct 9, 10:34 pm, rtconner <[EMAIL PROTECTED]> wrote:
> use an underscore...
>
> _functionName() {}
>
> On Oct 9, 12:43 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > How can I specify that a public function in a controller should NOT be
> > an action?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



public function, but not action

2007-10-09 Thread stefanb

Hi,

How can I specify that a public function in a controller should NOT be
an action?


--~--~-~--~~~---~--~~
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: Validation rules and error messages

2007-10-09 Thread stefanb

Yes, but according to the MVC pattern, what the user sees (like error
messages) really is supposed to go into the view, not the model...

On Oct 9, 8:09 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 10/6/07, stefanb <[EMAIL PROTECTED]> wrote:
>
> > In my view:
> > $form->input('name', array('type' => 'text', 'class' => 'input_text',
> > 'error' => array('required' => 'Name is required', 'length' => 'This
> > field can only be 20 characters long')))
>
> > How can I avoid this? Can I fetch the rule in my view or controller in
> > some way?
>
> Well, you can set the message in the model as well.  WARNING: this
> code is not tested
>
> var $validates = array('foo' => array('rule' => VALID_NOT_EMPTY,
> 'message' => 'Foo cannot be empty'));
>
> That way, you only change it one place.
>
> Hope that helps.
>
> --
> Chris Hartjes
> Cake Development Corporationhttp://www.cakedevelopment.com
>
> My motto for 2007:  "Just build it, damnit!"
>
> @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: Validation rules and error messages

2007-10-09 Thread stefanb

So, I take it this is not possible in Cake?

On Oct 7, 7:46 pm, "R. Rajesh Jeba Anbiah"
<[EMAIL PROTECTED]> wrote:
> On Oct 6, 11:24 pm, stefanb <[EMAIL PROTECTED]> wrote:> How can I fetch the 
> validation parameters from my models?
>
>   
>
>   You may check related links 
> inhttp://groups.google.com/group/cake-php/web/frequent-discussions
>
> --
>   
> Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Best/proper way to save HABTM?

2007-10-07 Thread stefanb

What is the proper/best way to save HABTM?

This is what I have:
Resources HABTM Categories

I save the Resource like this: $this->Resource->save($this-
>data['Resource']);

But how do I save the categories?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Checkboxes instead of multiple select

2007-10-06 Thread stefanb

Is it possible to use checkboxes instead of a multiple select to
represent data in a many-to-many relation?

I have a categories table connected to a resources table via a
categories_resources table, and have set up the HABTM relations in the
two models.

Now, in my resource add/edit views, I want to let the user select, via
checkboxes, which categories the resource belongs to. (One resource
can belong to many categories, and one category can contain many
resources).

How can I do this in Cake 1.2?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Validation rules and error messages

2007-10-06 Thread stefanb

How can I fetch the validation parameters from my models?

Example: I have a field with maxLength set to 20, and I want to
display an error message like "This field can only be 20 characters
long". Now, if I update the validation rule in my model to allow max
30 chars, I need to update my view as well:

In my view:
$form->input('name', array('type' => 'text', 'class' => 'input_text',
'error' => array('required' => 'Name is required', 'length' => 'This
field can only be 20 characters long')))

How can I avoid this? Can I fetch the rule in my view or controller in
some way?


--~--~-~--~~~---~--~~
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: Objects instead of arrays

2007-10-04 Thread stefanb

Still get the same error. I'll just wait for Cake 2

On Oct 3, 3:56 pm, gwoo <[EMAIL PROTECTED]> wrote:
> function beforeRender() {
>  $this->data = Set::reverse($this->data);
>
> }


--~--~-~--~~~---~--~~
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: Objects instead of arrays

2007-10-03 Thread stefanb

Well, that didn't seem to work:
"Fatal error: Cannot use object of type stdClass as array in C:\xampp
\htdocs\cake\cake\libs\view\helpers\form.php on line 136"

Is there a way to set "objectify = true" in just one place, and have
everything work just fine? Or will I have to write "objectify=true" /
"objectify=false" in all sorts of places to make this work?

On Oct 3, 2:28 pm, gwoo <[EMAIL PROTECTED]> wrote:
> ok, i had to dig a bit 
> deeperhttp://groups.google.com/group/cake-php/browse_thread/thread/fc7ef676...


--~--~-~--~~~---~--~~
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: Objects instead of arrays

2007-10-03 Thread stefanb

Yes, and I found this:

http://groups.google.com/group/cake-php/browse_thread/thread/a1699f504009f873/439d3756be935f9c?lnk=gst&q=objects+arrays&rnum=6#439d3756be935f9c
"There is no such functionality available in CakePHP so you have to
write it yourself. "

But that post was written in February, so I was wondering if this
feature had been added since then. But I guess not?

On Oct 3, 2:02 pm, gwoo <[EMAIL PROTECTED]> wrote:
> have you searched this group?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Objects instead of arrays

2007-10-03 Thread stefanb

Hello,

Is there a way to access data from my models as objects instead of
arrays?

// In my view:

foreach ( $categories as $category ) {
 echo $category->name; // I want this
 echo $category['Category']['name']; // Instead of 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: Why are all properties public?

2007-10-01 Thread stefanb

Even if getters and setters really were "evil" (which I don't agree
upon), wouldn't public properties have to be even more so?

Anyway, seems to me that there is no way around this at the moment?

On 1 Okt, 19:42, gwoo <[EMAIL PROTECTED]> wrote:
> http://www.google.com/search?q=getters%20and%20setters%20are
> %20evil&sourceid=mozilla2&ie=utf-8&oe=utf-8">getters and setters are
> evil.
>
> Cake Conventions are below and allow us to make the change to access
> modifiers when the time is right.
>
> var $__private
>
> var $_protected
>
> var $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?hl=en
-~--~~~~--~~--~--~---



Re: Why are all properties public?

2007-10-01 Thread stefanb

This is what I would like to do:

private $validate = array();

public getValidate()
{
return $this->validate;
}

But I can't see how that would be possible (without modifying Cake
itself, that is...)


On 1 Okt, 16:17, AD7six <[EMAIL PROTECTED]> wrote:
> On Oct 1, 2:48 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > The benefit would be encapsulation.
>
> > Yes, Cake is stopping me:
>
> > WHen I try to set $validate to private in my Category model, I get the
> > following error:
> > "Access level to Category::$validate must be public (as in class
> > AppModel)"
>
> I stand corrected ;), although there is a reason it's commented as
> public in that case (I would assume). Still doesn't stop you from
> creating getter setters and modifying the code appropriately to use
> them (if you must).
>
> Cheers,
>
> AD


--~--~-~--~~~---~--~~
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: Why are all properties public?

2007-10-01 Thread stefanb

The benefit would be encapsulation.

Yes, Cake is stopping me:

WHen I try to set $validate to private in my Category model, I get the
following error:
"Access level to Category::$validate must be public (as in class
AppModel)"

On Oct 1, 2:25 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Oct 1, 12:29 pm, stefanb <[EMAIL PROTECTED]> wrote:
>
> > Yes, but couldn't set/get methods still have been implemented, so that
> > Cake would be forward compatible?
>
> To what benefit (apart from bloat)?
>
> There is nothing stopping you from defining fields to be private, or
> writing get/set methods if you must.
>
> Cheers,
>
> AD


--~--~-~--~~~---~--~~
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: Why are all properties public?

2007-10-01 Thread stefanb

Yes, but couldn't set/get methods still have been implemented, so that
Cake would be forward compatible?

On Oct 1, 9:51 am, "Christian Winther" <[EMAIL PROTECTED]> wrote:
> CakePHP is PHP4 compatiable, and PHP4 does not support access modifiers.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of stefanb
> Sent: 1. oktober 2007 09:19
> To: Cake PHP
> Subject: Why are all properties public?
>
> Why are all properties public? Why doesn't Cake use private properties
> and public get/set methods so that encapsulation is achieved? Or did I
> miss something here?
>
> - stefanb


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why are all properties public?

2007-10-01 Thread stefanb

Why are all properties public? Why doesn't Cake use private properties
and public get/set methods so that encapsulation is achieved? Or did I
miss something here?

- stefanb


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---