Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread ludwig.prepoint
PM To: Maghiel Dijksman Cc: fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Validate_NotEmpty and Object One such "empty" object would be an iterator that has nothing to iterate. There are other examples, but there's no way to test if an object is empty without a method to

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Maghiel Dijksman
In that case it is empty but still, it is an object. But I understand what you mean! "Empty" is just to vague as a word to describe this. Maybe the english vocabulary needs a new term! :p On 4-3-2010 19:21, Hector Virgen wrote: One such "empty" object would be an iterator that has nothing to i

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Hector Virgen
One such "empty" object would be an iterator that has nothing to iterate. There are other examples, but there's no way to test if an object is empty without a method to determine it because various objects would have different implementations on how to determine if it is empty. -- Hector On Thu,

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Maghiel Dijksman
How can an object be empty? It's an instance of a class. So it is something. On 4-3-2010 17:55, Alayn Gortazar wrote: El jue, 04-03-2010 a las 08:32 -0800, Hector Virgen escribió: You could create an "Empty" interface (or rather, Emptiable since I don't think you can use Empty): interface

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Alayn Gortazar
El jue, 04-03-2010 a las 08:32 -0800, Hector Virgen escribió: > You could create an "Empty" interface (or rather, Emptiable since I > don't think you can use Empty): > > > interface Emptiable > { > public function isEmpty(); > } > > > Then make your validator accept Emptiable objects along

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Hector Virgen
You could create an "Empty" interface (or rather, Emptiable since I don't think you can use Empty): interface Emptiable { public function isEmpty(); } Then make your validator accept Emptiable objects along with strings, arrays, ints, etc. Maybe you can come up with a better name than Emptia

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Alayn Gortazar
El jue, 04-03-2010 a las 16:20 +0100, Giorgio Sironi escribió: > > I'll take advantage of this thread and ask: > How do you test if an object is empty or not?? > > Actually empty object should not exist as testing for one would break > encapsulation. An "empty" object is

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Giorgio Sironi
On Thu, Mar 4, 2010 at 12:05 PM, Alayn Gortazar wrote: > El jue, 04-03-2010 a las 11:43 +0100, Giorgio Sironi escribió: > >> I guess it has to do with the way it is used in Zend_Form... usually > > you pass scalar values in a form. > > I'll take advantage of this thread and ask: > How do you test

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Stefan Sturm
Hello, I don't use the validator to validate a form, I use it to validate my models. So I wrote my own little "Required" validator to handel this... Greetings, Stefan Sturm

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread ludwig.prepoint
ow, I just validate scalars before I change them into objects. Ludwig From: Giorgio Sironi Sent: Thursday, March 04, 2010 11:43 AM To: Stefan Sturm Cc: fw-general@lists.zend.com Subject: Re: [fw-general] Zend_Validate_NotEmpty and Object On Thu, Mar 4, 2010 at 10:26 AM, Stefan Sturm

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Alayn Gortazar
El jue, 04-03-2010 a las 11:43 +0100, Giorgio Sironi escribió: > On Thu, Mar 4, 2010 at 10:26 AM, Stefan Sturm > wrote: > Hello, > > when I test a variable containing an Object with > Zend_Validate_NotEmpty. I get this error: > Invalid type given, value sho

Re: [fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Giorgio Sironi
On Thu, Mar 4, 2010 at 10:26 AM, Stefan Sturm wrote: > Hello, > > when I test a variable containing an Object with > Zend_Validate_NotEmpty. I get this error: > Invalid type given, value should be float, string, array, boolean or > integer > I guess it has to do with the way it is used in Zend_F

[fw-general] Zend_Validate_NotEmpty and Object

2010-03-04 Thread Stefan Sturm
Hello, when I test a variable containing an Object with Zend_Validate_NotEmpty. I get this error: Invalid type given, value should be float, string, array, boolean or integer But, why an object is invalid for NotEmpty? Thanks for your help, Stefan Sturm