init
This commit is contained in:
32
mysyde/common/traits/genericViewModelTrait.php
Normal file
32
mysyde/common/traits/genericViewModelTrait.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user