+ * $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue'
+ * $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%'
+ *
+ *
+ * @param string $fullNamespace The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildModuleQuery The current query, for fluid interface
+ */
+ public function filterByFullNamespace($fullNamespace = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($fullNamespace)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $fullNamespace)) {
+ $fullNamespace = str_replace('*', '%', $fullNamespace);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php
index cccaa890a..dae9fda4a 100755
--- a/core/lib/Thelia/Model/Map/ModuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php
@@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 7;
+ const NUM_COLUMNS = 8;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 7;
+ const NUM_HYDRATE_COLUMNS = 8;
/**
* the column name for the ID field
@@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap
*/
const POSITION = 'module.POSITION';
+ /**
+ * the column name for the FULL_NAMESPACE field
+ */
+ const FULL_NAMESPACE = 'module.FULL_NAMESPACE';
+
/**
* the column name for the CREATED_AT field
*/
@@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
- self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
+ self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
+ $this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap
$criteria->addSelectColumn(ModuleTableMap::TYPE);
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
$criteria->addSelectColumn(ModuleTableMap::POSITION);
+ $criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE);
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
} else {
@@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.ACTIVATE');
$criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.FULL_NAMESPACE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
index 9e0b1f35c..eb71564eb 100644
--- a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
+++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php
@@ -55,7 +55,7 @@ trait PositionManagementTrait {
->orderByPosition(Criteria::DESC)
->limit(1);
- if ($parent !== null) $last->filterByParent($parent);
+ if ($parent !== null) $query->filterByParent($parent);
$last = $query->findOne()
;
diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php
index 07cc1d116..145da3c02 100755
--- a/core/lib/Thelia/Module/BaseModule.php
+++ b/core/lib/Thelia/Module/BaseModule.php
@@ -24,7 +24,9 @@
namespace Thelia\Module;
-abstract class BaseModule
+use Symfony\Component\DependencyInjection\ContainerAware;
+
+abstract class BaseModule extends ContainerAware
{
public function __construct()
@@ -37,6 +39,19 @@ abstract class BaseModule
}
+ public function hasContainer()
+ {
+ return null === $this->container;
+ }
+
+ public function getContainer()
+ {
+ if($this->hasContainer() === false) {
+ throw new \RuntimeException("Sorry, container his not available in this context");
+ }
+ return $this->container;
+ }
+
abstract public function install();
abstract public function destroy();
diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php
new file mode 100644
index 000000000..2db450830
--- /dev/null
+++ b/core/lib/Thelia/Module/BaseModuleInterface.php
@@ -0,0 +1,37 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Module;
+
+
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\HttpFoundation\Request;
+
+interface BaseModuleInterface {
+
+ public function setRequest(Request $request);
+ public function getRequest();
+
+ public function setDispatcher(EventDispatcherInterface $dispatcher);
+ public function getDispatcher();
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php
new file mode 100644
index 000000000..b8ffcfc01
--- /dev/null
+++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php
@@ -0,0 +1,36 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Module;
+
+
+interface DeliveryModuleInterface extends BaseModuleInterface {
+
+ /**
+ *
+ * calculate and return delivery price
+ *
+ * @return mixed
+ */
+ public function calculate($country = null);
+}
\ No newline at end of file
diff --git a/install/insert.sql b/install/insert.sql
index a2e5868e4..344381a37 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -17,7 +17,9 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
-INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
+
+INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
+(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW());
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NOW(), NOW()),
diff --git a/install/thelia.sql b/install/thelia.sql
index 879f323b9..2fb3723ca 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -803,6 +803,7 @@ CREATE TABLE `module`
`type` TINYINT NOT NULL,
`activate` TINYINT,
`position` INTEGER,
+ `full_namespace` VARCHAR(255),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index a9d7badc4..e6e68c4b2 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -605,6 +605,7 @@