单页上 Concrete5 Express 列表的命名空间问题
Namespace issue with Concrete5 Express List on Single Page
我正在尝试按照此 link:
检索快速条目的教程
https://documentation.concrete5.org/developers/express/creating-read...
但是,我收到以下错误消息:
"Class 'Application\Controller\SinglePage\Concrete\Core\Express\EntryList' not found"
我的代码如下:
<?php
namespace Application\Controller\SinglePage;
use PageController;
use Express;
class Search extends PageController
{
private $cruise;
public function view()
{
$entity = Express::getObjectByHandle('cruise');
$list = new Concrete\Core\Express\EntryList($entity);
$results = $list->getResults();
$this->set('results', $results);
}
}
谁能给我指出正确的方向?
问题出在这一行:
$list = new Concrete\Core\Express\EntryList($entity);
您可以:
$list = new \Concrete\Core\Express\EntryList($entity); // Notice the backslash
或者您可以导入 EntryList class:
<?php
namespace Application\Controller\SinglePage;
use PageController;
use Express;
use Concrete\Core\Express\EntryList;
class Search extends PageController
{
private $cruise;
public function view()
{
$entity = Express::getObjectByHandle('cruise');
$list = new EntryList($entity);
$results = $list->getResults();
$this->set('results', $results);
}
}
我正在尝试按照此 link:
检索快速条目的教程https://documentation.concrete5.org/developers/express/creating-read...
但是,我收到以下错误消息:
"Class 'Application\Controller\SinglePage\Concrete\Core\Express\EntryList' not found"
我的代码如下:
<?php
namespace Application\Controller\SinglePage;
use PageController;
use Express;
class Search extends PageController
{
private $cruise;
public function view()
{
$entity = Express::getObjectByHandle('cruise');
$list = new Concrete\Core\Express\EntryList($entity);
$results = $list->getResults();
$this->set('results', $results);
}
}
谁能给我指出正确的方向?
问题出在这一行:
$list = new Concrete\Core\Express\EntryList($entity);
您可以:
$list = new \Concrete\Core\Express\EntryList($entity); // Notice the backslash
或者您可以导入 EntryList class:
<?php
namespace Application\Controller\SinglePage;
use PageController;
use Express;
use Concrete\Core\Express\EntryList;
class Search extends PageController
{
private $cruise;
public function view()
{
$entity = Express::getObjectByHandle('cruise');
$list = new EntryList($entity);
$results = $list->getResults();
$this->set('results', $results);
}
}