gb5256
(Write2christian)
1
Hello
I am struggeling with some of the validators and their syntax to use.
I am lost with array of array of array…
So what is the right syntax for the line with the criteria if I want to do a findByAttributes?
I have searched this forum, but I have not found any working example of this one.
Could anybody point me in the right direction?
array('image1, image2, image3, image4, image5, image6', 'CExistValidator', array(
'attributeName'=>'id',
'className'=>'application.models.BattleImage',
'criteria' => "findByAttributes(array('battle_id'=>4)",
'message'=>'This id is not an BattleImage'
)
),
Thanks for any hints.
gb5256
array('image1, image2, image3, image4, image5, image6', 'CExistValidator', array(
'attributeName'=>'id',
'className'=>'application.models.BattleImage',
'criteria' => array(
'condition'=>'battle_id=4',
),
'message'=>'This id is not an BattleImage'
)
),
gb5256
(Write2christian)
3
Hello,
thanks for your answer.
But that one is now throwing this error:
Property "CExistValidator.0" is not defined.
Any ideas?
gb5256
l.jurgs
(L Jurgs)
4
array('image1, image2, image3, image4, image5, image6', 'CExistValidator',
'attributeName'=>'id',
'className'=>'application.models.BattleImage',
'criteria' => array(
'condition'=>'battle_id=4',
),
'message'=>'This id is not an BattleImage'
),
You had a nested array, I don’t think that is valid validator syntax.
gb5256
(Write2christian)
5
Hello,
the CRITERIA is an array as seen here:
http://www.yiiframework.com/doc/api/1.1/CExistValidator#criteria-detail
So the nested array should not be a problem.
Any ideas?
Does anybody have a working example on this one?
gb5256
l.jurgs
(L Jurgs)
7
As they say - You can lead a horse to water…
gb5256
(Write2christian)
8
The ability to read carefully is really important, as I have proven for myself right now once again.
Shame on me.
So, Luke was right. His code works.
Thanks Luke.

gb5256