コード例 #1
0
 /**
  * CONTROLLO VALORI DELLA STRUTTURA
  * Controlla se i valori del model previsti dalla struttura come not null o
  * come not empty
  * sono effettivamente inseriti
  *
  * @param Model $model
  * @param null $content
  * @param $struct
  * @param bool $lazyCheck
  * @return bool
  */
 private function checkStructValues(Model $model, $content = null, $struct, $lazyCheck = false)
 {
     if ($content == null) {
         $content = $model->getContent();
     }
     foreach ($struct as $sk => $sv) {
         if (!isset($content[$sk])) {
             $content[$sk] = null;
         }
         // TODO Controllo se array e ha nodo prototipo inferiore
         if (is_array($sv)) {
             if (!$this->checkStructValues($model, $content[$sk], $sv, $lazyCheck)) {
                 return false;
             }
         } else {
             if (!$this->isValidValue($content[$sk], $sv, $sk, $lazyCheck)) {
                 return false;
             }
         }
     }
     return true;
 }
コード例 #2
0
 public function getData(Model $model)
 {
     return [$model->getModelName() => $model->getContent()];
 }
コード例 #3
0
 private function serializeForDb(Model $model, $page = null, $pageSize = null)
 {
     $ret = array('domain' => $model->getDomain(), 'type' => 'model', 'page' => $page, 'pageSize' => $pageSize, 'struct' => $model->getStruct(), 'content' => $model->getContent());
     $serialized = json_encode($ret);
     return $serialized;
 }