Example #1
0
 protected function dumpActiveModel(Model $model)
 {
     if (!$this->dumpStructure) {
         $this->setReflections();
     }
     $attributes = [];
     foreach ($model->attributes() as $attrName => $attrValue) {
         if (is_object($attrValue)) {
             $attrValue = (string) $attrValue;
         }
         $attributes[$attrName] = $attrValue;
     }
     return $this->dumpStructure->invokeArgs($this, [sprintf('model(%s)', get_class($model)), ['attributes' => $attributes, 'properties' => $this->objectVars($model)]]);
 }
Example #2
0
 protected function setupValidator()
 {
     $validator = parent::setupValidator();
     $validator->setValidator('uniqueness', 'Rails\\ActiveRecord\\Validator\\Validations\\UniquenessValidator');
     $validator->setValidator('presence', 'Rails\\ActiveRecord\\Validator\\Validations\\PresenceValidator');
     return $validator;
 }