本文整理汇总了PHP中XLite\Core\Database类的典型用法代码示例。如果您正苦于以下问题:PHP Database类的具体用法?PHP Database怎么用?PHP Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPaymentMethod
public function getPaymentMethod()
{
if (!$this->paymentMethod) {
$this->paymentMethod = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->findOneBy(array('class' => self::MODEL_PATH));
}
return $this->paymentMethod;
}
示例2: doActionVolumeDiscountsUpdate
/**
* Update list
*
* @return void
*/
protected function doActionVolumeDiscountsUpdate()
{
$list = new \XLite\Module\CDev\VolumeDiscounts\View\ItemsList\VolumeDiscounts();
$list->processQuick();
// Additional correction to re-define end of subtotal range for each discount
\XLite\Core\Database::getRepo('XLite\\Module\\CDev\\VolumeDiscounts\\Model\\VolumeDiscount')->correctSubtotalRangeEnd();
}
示例3: getItem
/**
* Get item
*
* @return \XLite\Model\OrderItem
*/
public function getItem()
{
if (!isset($this->item)) {
// Initialize order item from request param item_id
if (is_numeric(\XLite\Core\Request::getInstance()->item_id)) {
$item = \XLite\Core\Database::getRepo('XLite\\Model\\OrderItem')->find(\XLite\Core\Request::getInstance()->item_id);
if ($item && $item->getProduct() && $item->hasAttributeValues()) {
$this->item = $item;
}
}
}
if (!isset($this->item) && \XLite\Core\Request::getInstance()->productId) {
// Initialize order item from productId param
$product = \XLite\Core\Database::getRepo('XLite\\Model\\Product')->find(\XLite\Core\Request::getInstance()->productId);
if ($product) {
$this->item = new \XLite\Model\OrderItem();
$this->item->setProduct($product);
$this->item->setAttributeValues($product->prepareAttributeValues());
}
}
if (!isset($this->item)) {
// Order item was not initialized: set to false to prevent re-initialization
$this->item = false;
}
return $this->item;
}
示例4: getPaymentMethod
protected function getPaymentMethod()
{
if ($this->paymentMethod == null) {
$this->paymentMethod = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->findOneBy(array('class' => \XLite\Module\Heartland\Securesubmit\Core\Securesubmit::MODEL_PATH));
}
return $this->paymentMethod;
}
示例5: getDefaultModelObject
/**
* This object will be used if another one is not passed
*
* @return \XLite\Module\XC\AuctionInc\Model\ProductAuctionInc
*/
protected function getDefaultModelObject()
{
$model = $this->getModelId() ? \XLite\Core\Database::getRepo('XLite\\Module\\XC\\AuctionInc\\Model\\ProductAuctionInc')->findOneBy(array('product' => $this->getModelId())) : null;
$model = $model ?: new \XLite\Module\XC\AuctionInc\Model\ProductAuctionInc();
$model->setProduct($this->getProduct());
return $model;
}
示例6: doNoAction
/**
* Preprocessor for no-action run
*
* @return void
*/
protected function doNoAction()
{
if (\XLite\Core\Request::getInstance()->completed) {
\XLite\Core\Database::getRepo('XLite\\Model\\Category')->removeProductFilterCache();
}
parent::doNoAction();
}
示例7: getCategory
/**
* Return the category name for the title
*
* @return string
*/
public function getCategory()
{
if (is_null($this->category)) {
$this->category = \XLite\Core\Database::getRepo('XLite\\Model\\Category')->find($this->getCategoryId());
}
return $this->category;
}
示例8: readConfig
/**
* Read config options
*
* @param mixed $force ____param_comment____ OPTIONAL
*
* @return void
*/
public function readConfig($force = false)
{
if (!isset($this->config) || $force) {
$this->config = \XLite\Core\Database::getRepo('XLite\\Model\\Config')->getAllOptions($force);
}
return $this->config;
}
示例9: doActionSwitch
/**
* Switch state
*
* @return void
*/
protected function doActionSwitch()
{
$value = !\XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
\XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'XC\\ThemeTweaker', 'name' => 'edit_mode', 'value' => $value));
\XLite\Core\TopMessage::addInfo($value ? 'Webmaster mode is enabled' : 'Webmaster mode is disabled');
$this->setReturnURL($this->buildURL('theme_tweaker_templates'));
}
示例10: executeHookHandler
/**
* Execute certain hook handle
*
* @return void
*/
public function executeHookHandler()
{
if (\XLite\Upgrade\Cell::getInstance()->isUpgraded()) {
$entries = \XLite\Upgrade\Cell::getInstance()->getEntries();
if ($entries) {
\Includes\Utils\Operator::showMessage('', true, false);
/** @var \XLite\Upgrade\Entry\AEntry $entry */
foreach ($entries as $entry) {
if (!$entry->isPostUpgradeActionsCalled()) {
$message = '...Invoke actions for ' . $entry->getActualName();
\Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
\Includes\Decorator\Utils\CacheManager::logMessage($message);
$isInvoked = \XLite\Upgrade\Cell::getInstance()->runHelper($entry, 'post_rebuild');
if ($isInvoked && \XLite\Upgrade\Cell::getInstance()->getHookRedirect()) {
break;
}
if (!\XLite\Upgrade\Cell::getInstance()->hasUnfinishedUpgradeHooks('post_rebuild', $entry)) {
// All post-rebuild hooks completed, run the rest actions...
\XLite\Upgrade\Cell::getInstance()->runCommonHelper($entry, 'add_labels');
\XLite\Upgrade\Cell::getInstance()->callInstallEvent($entry);
$entry->setPostUpgradeActionsCalled();
}
if (\Includes\Decorator\Utils\CacheManager::isTimeExceeds(static::STEP_TTL)) {
break;
}
}
}
}
}
\Includes\Decorator\Utils\CacheManager::logMessage(PHP_EOL);
\XLite\Core\Database::getEM()->flush();
\XLite\Core\Database::getEM()->clear();
}
示例11: getSearchCondition
/**
* Return params list to use for search
*
* @return \XLite\Core\CommonCell
*/
protected function getSearchCondition()
{
$result = parent::getSearchCondition();
$productId = $this->getProductId();
$result->{\XLite\Module\XC\Reviews\Model\Repo\Review::SEARCH_PRODUCT} = \XLite\Core\Database::getRepo('XLite\\Model\\Product')->find($productId);
return $result;
}
示例12: doActionRegisterKey
/**
* Action of license key registration
*
* @return void
*/
protected function doActionRegisterKey()
{
$key = \XLite\Core\Request::getInstance()->key;
$addonsInfo = \XLite\Core\Marketplace::getInstance()->checkAddonKey($key);
if ($addonsInfo && $addonsInfo[$key]) {
$addonsInfo = $addonsInfo[$key];
$repo = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
foreach ($addonsInfo as $info) {
$module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
if ($module) {
$entity = $repo->findKey($info['author'], $info['name']);
if ($entity) {
$entity->setKeyValue($key);
$repo->update($entity);
} else {
$entity = $repo->insert($info + array('keyValue' => $key));
}
\XLite\Core\Database::getEM()->flush();
// Clear cache for proper installation
\XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
$this->showInfo(__FUNCTION__, 'License key has been successfully verified for "{{name}}" module by "{{author}}" author', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName()));
} else {
$this->showError(__FUNCTION__, 'Key is validated, but the module [' . implode(',', $info) . '] was not found');
}
}
} else {
$error = \XLite\Core\Marketplace::getInstance()->getError();
if ($error) {
$this->showError(__FUNCTION__, 'Response from marketplace: ' . $error);
} else {
$this->showError(__FUNCTION__, 'Response from marketplace is not received');
}
}
$this->setReturnURL($this->buildURL('addons_list_marketplace'));
}
示例13: executeHookHandler
/**
* Execute certain hook handle
*
* @return void
*/
public function executeHookHandler()
{
foreach (\Includes\Decorator\Plugin\Doctrine\Utils\FixturesManager::getFixtures() as $fixture) {
\XLite\Core\Database::getInstance()->loadFixturesFromYaml($fixture);
}
\Includes\Decorator\Plugin\Doctrine\Utils\FixturesManager::removeFixtures();
}
示例14: getProductClass
/**
* Get product class
*
* @return \XLite\Model\ProductClass
*/
public function getProductClass()
{
if (is_null($this->productClass) && \XLite\Core\Request::getInstance()->product_class_id) {
$this->productClass = \XLite\Core\Database::getRepo('XLite\\Model\\ProductClass')->find(intval(\XLite\Core\Request::getInstance()->product_class_id));
}
return $this->productClass;
}
示例15: getOrder
/**
* Define widget params
*
* @return void
*/
protected function getOrder()
{
if ($this->getParam(self::PARAM_ORDER_ID) && is_null($this->order)) {
$this->order = \XLite\Core\Database::getRepo('\\XLite\\Model\\Order')->find($this->getParam(self::PARAM_ORDER_ID));
}
return $this->order;
}