Applied php-cs-fixer with level psr2
This commit is contained in:
@@ -261,7 +261,8 @@ class Coupon extends BaseCoupon
|
|||||||
* Return the countries for which free shipping is valid
|
* Return the countries for which free shipping is valid
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getFreeShippingForCountries() {
|
public function getFreeShippingForCountries()
|
||||||
|
{
|
||||||
return CouponCountryQuery::create()->filterByCouponId($this->getId())->find();
|
return CouponCountryQuery::create()->filterByCouponId($this->getId())->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +271,8 @@ class Coupon extends BaseCoupon
|
|||||||
*
|
*
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getFreeShippingForModules() {
|
public function getFreeShippingForModules()
|
||||||
|
{
|
||||||
return CouponModuleQuery::create()->filterByCouponId($this->getId())->find();
|
return CouponModuleQuery::create()->filterByCouponId($this->getId())->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,4 +303,4 @@ class Coupon extends BaseCoupon
|
|||||||
|
|
||||||
return $usageLeft;
|
return $usageLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ class Module extends BaseModule
|
|||||||
* @return BaseModuleInterface a module instance
|
* @return BaseModuleInterface a module instance
|
||||||
* @throws \InvalidArgumentException if the module could not be found in the container/
|
* @throws \InvalidArgumentException if the module could not be found in the container/
|
||||||
*/
|
*/
|
||||||
public function getModuleInstance(ContainerInterface $container) {
|
public function getModuleInstance(ContainerInterface $container)
|
||||||
|
{
|
||||||
$instance = $container->get(sprintf('module.%s', $this->getCode()));
|
$instance = $container->get(sprintf('module.%s', $this->getCode()));
|
||||||
|
|
||||||
if ($instance == null) {
|
if ($instance == null) {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class OrderCoupon extends BaseOrderCoupon
|
|||||||
* Return the countries for which free shipping is valid
|
* Return the countries for which free shipping is valid
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getFreeShippingForCountries() {
|
public function getFreeShippingForCountries()
|
||||||
|
{
|
||||||
return OrderCouponCountryQuery::create()->filterByOrderCoupon($this)->find();
|
return OrderCouponCountryQuery::create()->filterByOrderCoupon($this)->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +22,8 @@ class OrderCoupon extends BaseOrderCoupon
|
|||||||
*
|
*
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getFreeShippingForModules() {
|
public function getFreeShippingForModules()
|
||||||
|
{
|
||||||
return OrderCouponModuleQuery::create()->filterByOrderCoupon($this)->find();
|
return OrderCouponModuleQuery::create()->filterByOrderCoupon($this)->find();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,112 +1,112 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\ActiveQuery\Join;
|
use Propel\Runtime\ActiveQuery\Join;
|
||||||
use Thelia\Model\Base\RewritingUrlQuery as BaseRewritingUrlQuery;
|
use Thelia\Model\Base\RewritingUrlQuery as BaseRewritingUrlQuery;
|
||||||
use Thelia\Model\Map\RewritingUrlTableMap;
|
use Thelia\Model\Map\RewritingUrlTableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for performing query and update operations on the 'rewriting_url' table.
|
* Skeleton subclass for performing query and update operations on the 'rewriting_url' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* You should add additional methods to this class to meet the
|
* You should add additional methods to this class to meet the
|
||||||
* application requirements. This class will only be generated as
|
* application requirements. This class will only be generated as
|
||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RewritingUrlQuery extends BaseRewritingUrlQuery
|
class RewritingUrlQuery extends BaseRewritingUrlQuery
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param $rewrittenUrl
|
* @param $rewrittenUrl
|
||||||
*
|
*
|
||||||
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
* @return array|mixed|\Propel\Runtime\Collection\ObjectCollection
|
||||||
*/
|
*/
|
||||||
public function getResolverSearch($rewrittenUrl)
|
public function getResolverSearch($rewrittenUrl)
|
||||||
{
|
{
|
||||||
$redirectedJoin = new Join();
|
$redirectedJoin = new Join();
|
||||||
$redirectedJoin->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'REDIRECTED', 'ru', RewritingUrlTableMap::TABLE_NAME, 'ID', 'is_redirected');
|
$redirectedJoin->addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'REDIRECTED', 'ru', RewritingUrlTableMap::TABLE_NAME, 'ID', 'is_redirected');
|
||||||
$redirectedJoin->setJoinType(Criteria::LEFT_JOIN);
|
$redirectedJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
$search = RewritingArgumentQuery::create()
|
$search = RewritingArgumentQuery::create()
|
||||||
->joinRewritingUrl('ru', Criteria::RIGHT_JOIN)
|
->joinRewritingUrl('ru', Criteria::RIGHT_JOIN)
|
||||||
->addJoinObject($redirectedJoin)
|
->addJoinObject($redirectedJoin)
|
||||||
->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR)
|
->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR)
|
||||||
->withColumn('`ru`.URL', 'ru_url')
|
->withColumn('`ru`.URL', 'ru_url')
|
||||||
->withColumn('`ru`.VIEW', 'ru_view')
|
->withColumn('`ru`.VIEW', 'ru_view')
|
||||||
->withColumn('`ru`.VIEW_LOCALE', 'ru_locale')
|
->withColumn('`ru`.VIEW_LOCALE', 'ru_locale')
|
||||||
->withColumn('`ru`.VIEW_ID', 'ru_viewId')
|
->withColumn('`ru`.VIEW_ID', 'ru_viewId')
|
||||||
->withColumn('`is_redirected`.URL', 'ru_redirected_to_url')
|
->withColumn('`is_redirected`.URL', 'ru_redirected_to_url')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
return $search;
|
return $search;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $view
|
* @param $view
|
||||||
* @param $viewId
|
* @param $viewId
|
||||||
* @param $viewLocale
|
* @param $viewLocale
|
||||||
*
|
*
|
||||||
* @return null|RewritingUrl
|
* @return null|RewritingUrl
|
||||||
*/
|
*/
|
||||||
public function getViewUrlQuery($view, $viewLocale, $viewId)
|
public function getViewUrlQuery($view, $viewLocale, $viewId)
|
||||||
{
|
{
|
||||||
return RewritingUrlQuery::create()
|
return RewritingUrlQuery::create()
|
||||||
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
||||||
->where('ISNULL(`ra`.REWRITING_URL_ID)')
|
->where('ISNULL(`ra`.REWRITING_URL_ID)')
|
||||||
->filterByView($view)
|
->filterByView($view)
|
||||||
->filterByViewLocale($viewLocale)
|
->filterByViewLocale($viewLocale)
|
||||||
->filterByViewId($viewId)
|
->filterByViewId($viewId)
|
||||||
->filterByRedirected(null)
|
->filterByRedirected(null)
|
||||||
->orderById(Criteria::DESC)
|
->orderById(Criteria::DESC)
|
||||||
->findOne();
|
->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $view
|
* @param $view
|
||||||
* @param $viewLocale
|
* @param $viewLocale
|
||||||
* @param $viewId
|
* @param $viewId
|
||||||
* @param $viewOtherParameters
|
* @param $viewOtherParameters
|
||||||
*
|
*
|
||||||
* @return null|RewritingUrl
|
* @return null|RewritingUrl
|
||||||
*/
|
*/
|
||||||
public function getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters)
|
public function getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters)
|
||||||
{
|
{
|
||||||
$urlQuery = RewritingUrlQuery::create()
|
$urlQuery = RewritingUrlQuery::create()
|
||||||
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
->joinRewritingArgument('ra', Criteria::LEFT_JOIN)
|
||||||
->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID')
|
->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID')
|
||||||
->filterByView($view)
|
->filterByView($view)
|
||||||
->filterByViewLocale($viewLocale)
|
->filterByViewLocale($viewLocale)
|
||||||
->filterByViewId($viewId)
|
->filterByViewId($viewId)
|
||||||
->filterByRedirected(null)
|
->filterByRedirected(null)
|
||||||
->orderById(Criteria::DESC);
|
->orderById(Criteria::DESC);
|
||||||
|
|
||||||
$otherParametersCount = count($viewOtherParameters);
|
$otherParametersCount = count($viewOtherParameters);
|
||||||
if ($otherParametersCount > 0) {
|
if ($otherParametersCount > 0) {
|
||||||
$parameterConditions = array();
|
$parameterConditions = array();
|
||||||
|
|
||||||
foreach ($viewOtherParameters as $parameter => $value) {
|
foreach ($viewOtherParameters as $parameter => $value) {
|
||||||
$conditionName = 'other_parameter_condition_' . count($parameterConditions);
|
$conditionName = 'other_parameter_condition_' . count($parameterConditions);
|
||||||
$urlQuery->condition('parameter_condition', '`ra`.PARAMETER= ?', $parameter, \PDO::PARAM_STR)
|
$urlQuery->condition('parameter_condition', '`ra`.PARAMETER= ?', $parameter, \PDO::PARAM_STR)
|
||||||
->condition('value_condition', '`ra`.VALUE = ?', $value, \PDO::PARAM_STR)
|
->condition('value_condition', '`ra`.VALUE = ?', $value, \PDO::PARAM_STR)
|
||||||
->combine(array('parameter_condition', 'value_condition'), Criteria::LOGICAL_AND, $conditionName);
|
->combine(array('parameter_condition', 'value_condition'), Criteria::LOGICAL_AND, $conditionName);
|
||||||
$parameterConditions[] = $conditionName;
|
$parameterConditions[] = $conditionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlQuery->where($parameterConditions, Criteria::LOGICAL_OR);
|
$urlQuery->where($parameterConditions, Criteria::LOGICAL_OR);
|
||||||
|
|
||||||
$urlQuery->groupBy(RewritingUrlTableMap::ID);
|
$urlQuery->groupBy(RewritingUrlTableMap::ID);
|
||||||
|
|
||||||
$urlQuery->condition('count_condition_1', 'COUNT(' . RewritingUrlTableMap::ID . ') = ?', $otherParametersCount, \PDO::PARAM_INT) // ensure we got all the asked parameters (provided by the query)
|
$urlQuery->condition('count_condition_1', 'COUNT(' . RewritingUrlTableMap::ID . ') = ?', $otherParametersCount, \PDO::PARAM_INT) // ensure we got all the asked parameters (provided by the query)
|
||||||
->condition('count_condition_2', 'COUNT(' . RewritingUrlTableMap::ID . ') = (SELECT COUNT(*) FROM rewriting_argument WHERE rewriting_argument.REWRITING_URL_ID = ra_REWRITING_URL_ID)'); // ensure we don't miss any parameters (needed to match the rewritten url)
|
->condition('count_condition_2', 'COUNT(' . RewritingUrlTableMap::ID . ') = (SELECT COUNT(*) FROM rewriting_argument WHERE rewriting_argument.REWRITING_URL_ID = ra_REWRITING_URL_ID)'); // ensure we don't miss any parameters (needed to match the rewritten url)
|
||||||
|
|
||||||
$urlQuery->having(array('count_condition_1', 'count_condition_2'), Criteria::LOGICAL_AND);
|
$urlQuery->having(array('count_condition_1', 'count_condition_2'), Criteria::LOGICAL_AND);
|
||||||
} else {
|
} else {
|
||||||
$urlQuery->where('ISNULL(`ra`.REWRITING_URL_ID)');
|
$urlQuery->where('ISNULL(`ra`.REWRITING_URL_ID)');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $urlQuery->findOne();
|
return $urlQuery->findOne();
|
||||||
}
|
}
|
||||||
} // RewritingUrlQuery
|
} // RewritingUrlQuery
|
||||||
|
|||||||
Reference in New Issue
Block a user