Use doctrine dbal consistently
This commit is contained in:
@@ -28,6 +28,7 @@ namespace EP\EpProducts\Hook;
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Service\GeolocationService;
|
||||
use EP\EpProducts\Utility\DbUtility;
|
||||
use TYPO3\CMS\Core\DataHandling\DataHandler;
|
||||
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
||||
use TYPO3\CMS\Core\Messaging\FlashMessageService;
|
||||
@@ -67,38 +68,41 @@ class Tcemain
|
||||
// Render flash message in case of duplicate entry
|
||||
if ($table === 'tx_epproducts_domain_model_matchcode' && $fields['code'] !== '') {
|
||||
$code = $fields['code'];
|
||||
$qb = DbUtility::getDbConnection()->createQueryBuilder();
|
||||
$query = $qb
|
||||
->select('uid')
|
||||
->from('tx_epproducts_domain_model_matchcode')
|
||||
->where('code = :code')
|
||||
->andWhere('deleted = 0')
|
||||
->setParameter('code', $code)
|
||||
;
|
||||
if (is_numeric($id)) {
|
||||
$existing = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||||
'uid',
|
||||
'tx_epproducts_domain_model_matchcode',
|
||||
'code="' . $code . '" AND uid != ' . $id . ' AND deleted=0'
|
||||
);
|
||||
} else {
|
||||
$existing = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||||
'uid',
|
||||
'tx_epproducts_domain_model_matchcode',
|
||||
'code="' . $code . '" AND deleted=0'
|
||||
);
|
||||
$query
|
||||
->andWhere('uid != :uid')
|
||||
->setParameter('uid', $id)
|
||||
;
|
||||
}
|
||||
$existing = $query->execute()->fetch();
|
||||
if ($existing) {
|
||||
$this->addFlashMessage('Der Hotelcode ' . $code . ' ist schon vergeben worden.', 'Hinweis', FlashMessage::WARNING);
|
||||
}
|
||||
}
|
||||
if ($table === 'tx_epproducts_domain_model_product' && $fields['code'] !== '') {
|
||||
$code = $fields['code'];
|
||||
$qb = DbUtility::getDbConnection()->createQueryBuilder();
|
||||
$query = $qb
|
||||
->select('uid')
|
||||
->from('tx_epproducts_domain_model_product')
|
||||
->where('code = :code')
|
||||
->andWhere('deleted = 0')
|
||||
->setParameter('code', $code);
|
||||
if (is_numeric($id)) {
|
||||
$existing = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||||
'uid',
|
||||
'tx_epproducts_domain_model_product',
|
||||
'code="' . $code . '" AND uid != ' . $id . ' AND deleted=0'
|
||||
);
|
||||
} else {
|
||||
$existing = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||||
'uid',
|
||||
'tx_epproducts_domain_model_product',
|
||||
'code="' . $code . ' AND deleted=0'
|
||||
);
|
||||
$query
|
||||
->andWhere('uid != :uid')
|
||||
->setParameter('uid', $id)
|
||||
;
|
||||
}
|
||||
$existing = $query->execute()->fetch();
|
||||
if ($existing) {
|
||||
$this->addFlashMessage('Der Productcode ' . $code . ' ist schon vergeben worden.', 'Hinweis', FlashMessage::WARNING);
|
||||
}
|
||||
|
||||
+15
-15
@@ -28,7 +28,7 @@ namespace EP\EpProducts\Service;
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Domain\Model\FilterSettings;
|
||||
use TYPO3\CMS\Core\Database\DatabaseConnection;
|
||||
use EP\EpProducts\Utility\DbUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\HttpUtility;
|
||||
|
||||
@@ -44,22 +44,22 @@ class StaticSearchParamsRequestService
|
||||
|
||||
$uri = strtolower(parse_url($currentUri, \PHP_URL_PATH));
|
||||
|
||||
/** @var DatabaseConnection $db */
|
||||
$db = $GLOBALS['TYPO3_DB'];
|
||||
$qb = DbUtility::getDbConnection()->createQueryBuilder();
|
||||
$query = $qb
|
||||
->select('*')
|
||||
->from('tx_epproducts_domain_model_staticsearchparams')
|
||||
->where('CONCAT("/", :prefix, "/", path_segment, "/")=LOWER(:uri)')
|
||||
->andWhere('deleted = 0')
|
||||
->andWhere('hidden = 0')
|
||||
->setParameters([
|
||||
'prefix' => self::PREFIX_PATH_SEGMENT,
|
||||
'uri' => $uri,
|
||||
])
|
||||
;
|
||||
|
||||
$row = $db->exec_SELECTgetSingleRow(
|
||||
'*',
|
||||
'tx_epproducts_domain_model_staticsearchparams',
|
||||
'CONCAT(
|
||||
"/",
|
||||
"' . self::PREFIX_PATH_SEGMENT . '",
|
||||
"/", tx_epproducts_domain_model_staticsearchparams.path_segment,
|
||||
"/"
|
||||
)=LOWER(' . $db->fullQuoteStr($uri, 'tx_epproducts_domain_model_staticsearchparams') . ')'
|
||||
. ' AND tx_epproducts_domain_model_staticsearchparams.deleted=0 AND tx_epproducts_domain_model_staticsearchparams.hidden=0'
|
||||
);
|
||||
$row = $query->execute()->fetch();
|
||||
|
||||
if ($row === false) {
|
||||
if (!$row) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace EP\EpTheme\DataProcessing;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpProducts\Utility\DbUtility;
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
|
||||
|
||||
@@ -67,11 +68,16 @@ class ContextProcessor implements DataProcessorInterface
|
||||
*/
|
||||
private function getContextRecord($uid, $table)
|
||||
{
|
||||
$where = $GLOBALS['TSFE']->sys_page->enableFields($table);
|
||||
return $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
|
||||
'*',
|
||||
$table,
|
||||
$table . '.uid=' . $uid . $where
|
||||
);
|
||||
$qb = DbUtility::getDbConnection()->createQueryBuilder();
|
||||
$query = $qb
|
||||
->select('*')
|
||||
->from($table)
|
||||
->where('uid = :uid')
|
||||
->andWhere('deleted = 0')
|
||||
->andWhere('hidden = 0')
|
||||
->setParameter('uid', $uid)
|
||||
;
|
||||
|
||||
return $query->execute()->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user