Hi, Sammaye!
I understand how to use ESubdocumentValidator to a certain extent, but it seems that filters in rules do not work, do they?
A document in MongoDB looks like:
{
"_id" : ObjectId("52a9bde6eb37a4c64b8b4569"),
"ru" : {
"title" : "Тема",
"text" : "Текст"
},
"en" : {
"title" : "Title",
"text" : "Text"
},
"es" : {
"title" : "Tema",
"text" : "Texto"
},
"ar" : {
"title" : "العنوان او نص قصير",
"text" : "النص"
}
}
Some of validation rules:
public function rules()
{
return [
['ru,en,es,ar', 'ext.ESubdocumentValidator', 'type' => 'one', 'rules' => [
['title, text', 'filter', 'filter' => 'trim'] // this seems not to work
['title', 'length', 'max' => 500],
['text', 'length', 'max' => 5000],
['title', 'ext.YiiConditionalValidator',
'if' => [['text', 'required']],
'then' => [['title', 'required']],
],
]
];
}