Beispiel #1
0
 protected function loadAsDocument()
 {
     $validator = new IsModelClassNameValidator($this->sitemapInfo['document_name']);
     if (!$validator->isValid()) {
         throw new \ForbiddenException("Not a model: {$this->sitemapInfo['document_name']}");
     }
     $fieldsInfo = call_user_func([$this->sitemapInfo['document_name'], 'getFieldsInfo']);
     if (!empty($fieldsInfo['sitemap']) && !empty($fieldsInfo['sitemap']['controller'])) {
         $className = $fieldsInfo['sitemap']['controller'];
     } else {
         $className = sprintf('%s_controller', $this->sitemapInfo['document_name']);
     }
     //
     $_REQUEST['id'] = $_GET['id'] = $_POST['id'] = $this->sitemapInfo['document_id'];
     //
     $this->request->set('id', $this->sitemapInfo['document_id']);
     //
     $this->controller = new $className($this->sitemapInfo);
     $this->controller->process();
 }
 public function testValid()
 {
     $validator = new IsModelClassNameValidator(TestModel::ModelName);
     $this->assertTrue($validator->isValid());
 }