public function find($id)
 {
     $model = ReflectionUtils::createNewInstance(static::$forModel);
     $query = Query::getInstance()->select()->from($model->table())->where(Restrictions::eq("id", ":id"));
     $resultSet = $this->getDatabase()->query($query)->addParameter($id)->uniqueResult();
     return ObjectUtils::toObject($resultSet);
 }
 public function dispatch(RequestFactoryInterface $requestFactory)
 {
     $uri = $requestFactory->get()->toArray();
     $helper = DispatcherHelper::getHelper($uri, true);
     $builtRequest = ObjectUtils::toObject($this->getBuilder()->locale($helper->getLocale())->controller($helper->getController())->action($helper->getAction())->parameters($helper->getParameters())->build());
     $controllerInstance = ClassUtils::load($builtRequest->controller, array($requestFactory->get()));
     return $this->invoke($controllerInstance, $builtRequest->action, $builtRequest->parameters);
 }
 public function build()
 {
     return ObjectUtils::toObject($this->buffer);
 }