Re: Stuck with a validation rule in secondary model

2010-07-12 Thread Ernesto
i solved using Classregistry::getObject("Item");

if there's any clever/lighter method let me know :P

On 12 Lug, 17:04, Ernesto  wrote:
> Hello.
>
> i have 2 models
>
> - Item hasMany Part
>
> my Item::add() view is something like this
>
> echo $form->input("code");
> echo $form->input("description");
> echo $form->input("require_length"); //this is a boolean input
> echo $form->input("require_width"); //this is a boolean input
> echo $form->input("Part.0.id");
> echo $form->input("Part.0.length");
> echo $form->input("Part.0.width");
> echo $form->input("Part.1.id");
> echo $form->input("Part.1.length");
> echo $form->input("Part.1.width");
> [...]
>
> and so on
>
> Part length should only be set if required by the item.
> so i need a Part validation rule that check if in the current data
> array Item::require_width is set or not.
> how can i get the Item's data from Part model?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Stuck with a validation rule in secondary model

2010-07-12 Thread Ernesto
Hello.

i have 2 models

- Item hasMany Part

my Item::add() view is something like this

echo $form->input("code");
echo $form->input("description");
echo $form->input("require_length"); //this is a boolean input
echo $form->input("require_width"); //this is a boolean input
echo $form->input("Part.0.id");
echo $form->input("Part.0.length");
echo $form->input("Part.0.width");
echo $form->input("Part.1.id");
echo $form->input("Part.1.length");
echo $form->input("Part.1.width");
[...]

and so on

Part length should only be set if required by the item.
so i need a Part validation rule that check if in the current data
array Item::require_width is set or not.
how can i get the Item's data from Part model?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en