<?php
class Items
{
public function rules()
{
return [
[['items'], 'checkItem']
];
}
protected function checkItem()
{
$status = (is_array($this->items) || is_object($this->items)) && $this->items;
if ($status) {
foreach ($this->items as $item) {
$itemModel = new Item;
$status = ($itemModel->load($item, '') && $itemModel->validate());
if (!$status) {
break;
}
}
}
return $status;
}
}
public function rules()
{
return [
['items'], 'checkItem'
];
}
public function rules()
{
return [
[['items'], 'checkItem']
];
}
foreach ($this->items as $item) {
$item = new Item;