32 lines
704 B
PHP
32 lines
704 B
PHP
<?php
|
|
namespace DynCom\mysyde\common\traits;
|
|
use DynCom\mysyde\common\classes\Form;
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Michael Bauer
|
|
* Date: 7/13/2015
|
|
* Time: 7:22 PM
|
|
*/
|
|
trait genericViewModelTrait
|
|
{
|
|
|
|
use arrayGettableTrait;
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function allFormsValid() {
|
|
$arr = $this->getAllFieldsAsArray();
|
|
foreach($arr as $fieldName => $fieldValue) {
|
|
if($fieldValue instanceof Form) {
|
|
$fieldValue->validateRequestAgainstRules();
|
|
if (!$fieldValue->isRequestValid()) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} |