예제 #1
0
 public function formatReadonly($value, $entry = null)
 {
     $value = $this->prepare($value);
     if (isset($value)) {
         // TODO this checking should available on JsonKit
         // if (substr(phpversion(), 0, 3) === '5.3') {
         //     $value = json_encode($value->toArray(), JSON_PRETTY_PRINT);
         // } else {
         $value = json_encode($value->toObject());
         // }
     }
     return parent::formatReadonly($value, $entry);
 }
예제 #2
0
 public function format($name, $valueOrCallable, $entry = null)
 {
     if (is_null($this['foreign'])) {
         throw new \Exception('Reference schema should invoke Reference::to()');
     }
     if (func_num_args() === 3) {
         return parent::format($name, $valueOrCallable, $entry);
     } else {
         return parent::format($name, $valueOrCallable);
     }
 }