public function testGettersCache()
 {
     $modelClosures = new ModelClosure();
     $modelClosures->getFromModel();
     $modelClosures->setToModel();
     self::assertInstanceOf('\\Closure', $modelClosures->getFromModel());
     self::assertInstanceOf('\\Closure', $modelClosures->setToModel());
 }
 /**
  * @param mixed $model
  * @param string $mapType
  * @return array
  *
  * @throws ParseException
  */
 public function getData($model, $mapType = 'dto')
 {
     $class = get_class($model);
     $map = $this->mapsManager->getMap($class, $mapType);
     $fromModelFn = $this->fn->getFromModel();
     $props = [];
     foreach ($map as $dataKey => $propRule) {
         $propRule = new PropRule($propRule);
         $val = $fromModelFn->call($model, $propRule->getGetter(), $propRule->getProp($dataKey));
         if ($val !== null) {
             $props[$dataKey] = $this->getConverter()->toData($val, $propRule, $this);
         }
     }
     return $props;
 }