-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c21f353
commit 502a041
Showing
28 changed files
with
122 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,6 @@ | |
/*************************************************************************************/ | ||
/* This file is part of the module AttributeType */ | ||
/* */ | ||
/* Copyright (c) OpenStudio */ | ||
/* email : [email protected] */ | ||
/* web : http://www.thelia.net */ | ||
/* */ | ||
/* For the full copyright and license information, please view the LICENSE.txt */ | ||
/* file that was distributed with this source code. */ | ||
/*************************************************************************************/ | ||
|
@@ -22,7 +18,7 @@ | |
/** | ||
* Class AttributeTypeAction | ||
* @package AttributeType\Action | ||
* @author Gilles Bourgeat <[email protected]> | ||
* @author Gilles Bourgeat <[email protected]> | ||
*/ | ||
class AttributeTypeAction implements EventSubscriberInterface | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* This file is part of the module AttributeType */ | ||
/* */ | ||
/* Copyright (c) OpenStudio */ | ||
/* email : [email protected] */ | ||
/* email : [email protected] */ | ||
/* web : http://www.thelia.net */ | ||
/* */ | ||
/* For the full copyright and license information, please view the LICENSE.txt */ | ||
|
@@ -20,7 +20,7 @@ | |
/** | ||
* Class AttributeType | ||
* @package AttributeType | ||
* @author Gilles Bourgeat <[email protected]> | ||
* @author Gilles Bourgeat <[email protected]> | ||
*/ | ||
class AttributeType extends BaseModule | ||
{ | ||
|
@@ -33,10 +33,10 @@ class AttributeType extends BaseModule | |
*/ | ||
public function postActivation(ConnectionInterface $con = null) | ||
{ | ||
if (!self::getConfigValue('is_initialized', false)) { | ||
if (!$this->getConfigValue('is_initialized', false)) { | ||
$database = new Database($con); | ||
$database->insertSql(null, [__DIR__ . "/Config/thelia.sql", __DIR__ . "/Config/insert.sql"]); | ||
self::setConfigValue('is_initialized', true); | ||
$this->setConfigValue('is_initialized', true); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ | |
<language>en_US</language> | ||
<language>fr_FR</language> | ||
</languages> | ||
<version>1.2.1</version> | ||
<version>1.2.2</version> | ||
<author> | ||
<name>Gilles Bourgeat</name> | ||
<email>[email protected]</email> | ||
<email>[email protected]</email> | ||
<website>https://github.com/gillesbourgeat</website> | ||
</author> | ||
<type>classic</type> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,6 @@ | |
/*************************************************************************************/ | ||
/* This file is part of the module AttributeType */ | ||
/* */ | ||
/* Copyright (c) OpenStudio */ | ||
/* email : [email protected] */ | ||
/* web : http://www.thelia.net */ | ||
/* */ | ||
/* For the full copyright and license information, please view the LICENSE.txt */ | ||
/* file that was distributed with this source code. */ | ||
/*************************************************************************************/ | ||
|
@@ -26,23 +22,23 @@ | |
/** | ||
* Class AttributeTypeAttributeAvController | ||
* @package AttributeType\Controller | ||
* @author Gilles Bourgeat <[email protected]> | ||
* @author Gilles Bourgeat <[email protected]> | ||
*/ | ||
class AttributeTypeAttributeAvController extends AttributeTypeController | ||
{ | ||
/** @var Lang[] */ | ||
private $langs = array(); | ||
protected $langs = array(); | ||
|
||
/** @var AttributeAttributeType[] */ | ||
private $attributeAttributeTypes = array(); | ||
protected $attributeAttributeTypes = array(); | ||
|
||
/** | ||
* @param int $attribute_id | ||
* @return null|\Symfony\Component\HttpFoundation\Response|\Thelia\Core\HttpFoundation\Response | ||
*/ | ||
public function updateMetaAction($attribute_id) | ||
{ | ||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'AttributeType', AccessManager::UPDATE)) { | ||
if (null !== $response = $this->checkAuth(array(AdminResources::ATTRIBUTE), null, AccessManager::UPDATE)) { | ||
return $response; | ||
} | ||
|
||
|
@@ -56,8 +52,8 @@ public function updateMetaAction($attribute_id) | |
foreach ($attributeAvs as $attributeAvId => $attributeAv) { | ||
foreach ($attributeAv['lang'] as $langId => $lang) { | ||
foreach ($lang['attribute_type'] as $attributeTypeId => $value) { | ||
self::dispatchEvent( | ||
self::getAttributeAttributeType($attributeTypeId, $attribute_id), | ||
$this->dispatchEvent( | ||
$this->getAttributeAttributeType($attributeTypeId, $attribute_id), | ||
$attributeAvId, | ||
$langId, | ||
$value | ||
|
@@ -74,7 +70,7 @@ public function updateMetaAction($attribute_id) | |
$form | ||
); | ||
|
||
return self::viewAttribute($attribute_id); | ||
return $this->viewAttribute($attribute_id); | ||
} | ||
} | ||
|
||
|
@@ -85,14 +81,14 @@ public function updateMetaAction($attribute_id) | |
* @param string $value | ||
* @throws \Exception | ||
*/ | ||
public function dispatchEvent(AttributeAttributeType $attributeAttributeType, $attributeAvId, $langId, $value) | ||
protected function dispatchEvent(AttributeAttributeType $attributeAttributeType, $attributeAvId, $langId, $value) | ||
{ | ||
$eventName = AttributeTypeEvents::ATTRIBUTE_TYPE_AV_META_UPDATE; | ||
|
||
$attributeAvMeta = AttributeTypeAvMetaQuery::create() | ||
->filterByAttributeAvId($attributeAvId) | ||
->filterByAttributeAttributeTypeId($attributeAttributeType->getId()) | ||
->filterByLocale(self::getLocale($langId)) | ||
->filterByLocale($this->getLocale($langId)) | ||
->findOne(); | ||
|
||
// create if not exist | ||
|
@@ -102,7 +98,7 @@ public function dispatchEvent(AttributeAttributeType $attributeAttributeType, $a | |
$attributeAvMeta = (new AttributeTypeAvMeta()) | ||
->setAttributeAvId($attributeAvId) | ||
->setAttributeAttributeTypeId($attributeAttributeType->getId()) | ||
->setLocale(self::getLocale($langId)); | ||
->setLocale($this->getLocale($langId)); | ||
} | ||
|
||
$attributeAvMeta->setValue($value); | ||
|
@@ -119,7 +115,7 @@ public function dispatchEvent(AttributeAttributeType $attributeAttributeType, $a | |
* @return AttributeAttributeType | ||
* @throws \Exception | ||
*/ | ||
private function getAttributeAttributeType($attributeTypeId, $attributeId) | ||
protected function getAttributeAttributeType($attributeTypeId, $attributeId) | ||
{ | ||
if (!isset($this->attributeAttributeTypes[$attributeTypeId])) { | ||
$this->attributeAttributeTypes[$attributeTypeId] = AttributeAttributeTypeQuery::create() | ||
|
@@ -140,7 +136,7 @@ private function getAttributeAttributeType($attributeTypeId, $attributeId) | |
* @return string | ||
* @throws \Exception | ||
*/ | ||
private function getLocale($langId) | ||
protected function getLocale($langId) | ||
{ | ||
if (!isset($this->langs[$langId])) { | ||
$this->langs[$langId] = LangQuery::create()->findPk($langId); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,6 @@ | |
/*************************************************************************************/ | ||
/* This file is part of the module AttributeType */ | ||
/* */ | ||
/* Copyright (c) OpenStudio */ | ||
/* email : [email protected] */ | ||
/* web : http://www.thelia.net */ | ||
/* */ | ||
/* For the full copyright and license information, please view the LICENSE.txt */ | ||
/* file that was distributed with this source code. */ | ||
/*************************************************************************************/ | ||
|
@@ -25,7 +21,7 @@ | |
/** | ||
* Class AttributeTypeAttributeController | ||
* @package AttributeType\Controller | ||
* @author Gilles Bourgeat <[email protected]> | ||
* @author Gilles Bourgeat <[email protected]> | ||
*/ | ||
class AttributeTypeAttributeController extends AttributeTypeController | ||
{ | ||
|
@@ -36,7 +32,7 @@ class AttributeTypeAttributeController extends AttributeTypeController | |
*/ | ||
public function associateAction($attribute_type_id, $attribute_id) | ||
{ | ||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'AttributeType', AccessManager::UPDATE)) { | ||
if (null !== $response = $this->checkAuth(array(AdminResources::ATTRIBUTE), null, AccessManager::UPDATE)) { | ||
return $response; | ||
} | ||
|
||
|
@@ -47,7 +43,7 @@ public function associateAction($attribute_type_id, $attribute_id) | |
|
||
$this->dispatch( | ||
AttributeTypeEvents::ATTRIBUTE_TYPE_ASSOCIATE, | ||
self::getEventAssociation($attribute_type_id, $attribute_id) | ||
$this->getEventAssociation($attribute_type_id, $attribute_id) | ||
); | ||
|
||
return $this->generateSuccessRedirect($form); | ||
|
@@ -58,7 +54,7 @@ public function associateAction($attribute_type_id, $attribute_id) | |
$form | ||
); | ||
|
||
return self::viewAttribute($attribute_id); | ||
return $this->viewAttribute($attribute_id); | ||
} | ||
} | ||
|
||
|
@@ -69,7 +65,7 @@ public function associateAction($attribute_type_id, $attribute_id) | |
*/ | ||
public function dissociateAction($attribute_type_id, $attribute_id) | ||
{ | ||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), 'AttributeType', AccessManager::UPDATE)) { | ||
if (null !== $response = $this->checkAuth(array(AdminResources::ATTRIBUTE), null, AccessManager::UPDATE)) { | ||
return $response; | ||
} | ||
|
||
|
@@ -80,7 +76,7 @@ public function dissociateAction($attribute_type_id, $attribute_id) | |
|
||
$this->dispatch( | ||
AttributeTypeEvents::ATTRIBUTE_TYPE_DISSOCIATE, | ||
self::getEventAssociation($attribute_type_id, $attribute_id) | ||
$this->getEventAssociation($attribute_type_id, $attribute_id) | ||
); | ||
|
||
return $this->generateSuccessRedirect($form); | ||
|
@@ -91,7 +87,7 @@ public function dissociateAction($attribute_type_id, $attribute_id) | |
$form | ||
); | ||
|
||
return self::viewAttribute($attribute_id); | ||
return $this->viewAttribute($attribute_id); | ||
} | ||
} | ||
|
||
|
@@ -101,7 +97,7 @@ public function dissociateAction($attribute_type_id, $attribute_id) | |
* @return AttributeTypeEvent | ||
* @throws \Exception | ||
*/ | ||
private function getEventAssociation($attribute_type_id, $attribute_id) | ||
protected function getEventAssociation($attribute_type_id, $attribute_id) | ||
{ | ||
if (null === $attribute = AttributeQuery::create()->findPk($attribute_id)) { | ||
throw new \Exception(Translator::getInstance()->trans( | ||
|
Oops, something went wrong.