本文整理汇总了PHP中Cx\Core\Core\Controller\Cx::getDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Cx::getDb方法的具体用法?PHP Cx::getDb怎么用?PHP Cx::getDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Core\Controller\Cx
的用法示例。
在下文中一共展示了Cx::getDb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadThumbnails
public function loadThumbnails()
{
/**
* @var $cx \Cx\Core\Core\Controller\Cx
*/
$pdo = $this->cx->getDb()->getPdoConnection();
$sth = $pdo->query('SELECT id,name, size, 100 as quality, CONCAT(".thumb_",name) as value FROM `' . DBPREFIX . 'settings_thumbnail`');
self::$thumbnails = $sth->fetchAll();
}
示例2: getComponent
/**
* Get a component controller object
*
* @param string $name component name
* @return \Cx\Core\Core\Model\Entity\SystemComponentController
* The requested component controller or null if no such component exists
*/
public function getComponent($name)
{
if (empty($name)) {
return null;
}
$componentRepo = $this->cx->getDb()->getEntityManager()->getRepository('Cx\\Core\\Core\\Model\\Entity\\SystemComponent');
$component = $componentRepo->findOneBy(array('name' => $name));
if (!$component) {
return null;
}
return $component->getSystemComponentController();
}
示例3: decorate
/**
* Decorates an entity or an array of entities
* @param mixed $components SystemComponent or array of SystemComponents
* @return mixed SystemComponentController or array of SystemComponentControllers
*/
protected function decorate($components)
{
if (!$components) {
return $components;
}
if (!is_array($components)) {
$yamlDir = $this->cx->getClassLoader()->getFilePath($components->getDirectory(false) . '/Model/Yaml');
if (file_exists($yamlDir)) {
$this->cx->getDb()->addSchemaFileDirectories(array($yamlDir));
}
$entity = $this->decorateEntity($components);
return $entity;
}
$yamlDirs = array();
foreach ($components as $component) {
if (isset($this->loadedComponents[$component->getId()])) {
continue;
}
$yamlDir = $this->cx->getClassLoader()->getFilePath($component->getDirectory(false) . '/Model/Yaml');
if ($yamlDir) {
$yamlDirs[] = $yamlDir;
}
}
$this->cx->getDb()->addSchemaFileDirectories($yamlDirs);
foreach ($components as &$component) {
if (isset($this->loadedComponents[$component->getId()])) {
$component = $this->loadedComponents[$component->getId()];
continue;
}
$component = $this->decorateEntity($component);
\Cx\Core\Json\JsonData::addAdapter($component->getControllersAccessableByJson(), $component->getNamespace() . '\\Controller');
}
return $components;
}
示例4: setPreLoadedComponents
/**
* Loads the systemComponent using the doctrine entity manager for the existing SystemComponentController and adds it to the repository
* @param array $preLoadedComponents An array containing the preloaded components
*/
public function setPreLoadedComponents($preLoadedComponents)
{
foreach ($preLoadedComponents as $componentName => $preLoadedComponent) {
// get systemComponent by name
$systemComponent = parent::findOneBy(array('name' => $componentName));
// set systemComponent on existing systemComponentController
$preLoadedComponent->setSystemComponent($systemComponent);
// add yaml directory
$yamlDir = $this->cx->getClassLoader()->getFilePath($preLoadedComponent->getDirectory(false) . '/Model/Yaml');
if (file_exists($yamlDir)) {
$this->cx->getDb()->addSchemaFileDirectories(array($yamlDir));
}
// store the systemComponent with its now loaded id as key to the array of loaded components
$this->loadedComponents[$preLoadedComponent->getId()] = $preLoadedComponent;
// Add JSON adapter
\Cx\Core\Json\JsonData::addAdapter($preLoadedComponent->getControllersAccessableByJson(), $preLoadedComponent->getNamespace() . '\\Controller');
}
}
示例5: getSites
/**
* Get all content pages.
*
* @return array
*/
public function getSites()
{
$pageTree = new MediaBrowserPageTree($this->cx->getDb()->getEntityManager(), $this->cx->getLicense(), 0, null, FRONTEND_LANG_ID, null, false, false, false);
$pageTree->render();
return $pageTree->getFlatTree();
}