Commit e43bf5d0 authored by Jonathan Day's avatar Jonathan Day

correct variable naming per @IvanChepurnyi and adding some attribution

parent 2772edc0
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* @copyright Copyright (c) 2013 EcomDev BV (http://www.ecomdev.org) * @copyright Copyright (c) 2013 EcomDev BV (http://www.ecomdev.org)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org> * @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Steve Rice <srice@endertech.com>
* @author Jonathan Day <jonathan@aligent.com.au>
*/ */
...@@ -84,12 +86,12 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Attributes ...@@ -84,12 +86,12 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Attributes
*/ */
public function apply(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interface $fixture) public function apply(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interface $fixture)
{ {
$aAttributeLoaders = array(); $attributeLoaders = array();
$this->getResource()->beginTransaction(); $this->getResource()->beginTransaction();
foreach ($data as $entityType => $values) { foreach ($data as $entityType => $values) {
$aAttributeLoaders[] = $this->_getAttributeLoader($entityType) $attributeLoaders[] = $this->_getAttributeLoader($entityType)
->setFixture($fixture) ->setFixture($fixture)
->setOptions($fixture->getOptions()) ->setOptions($fixture->getOptions())
->loadAttribute($entityType, $values); ->loadAttribute($entityType, $values);
...@@ -97,8 +99,8 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Attributes ...@@ -97,8 +99,8 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Attributes
$this->getResource()->commit(); $this->getResource()->commit();
foreach ($aAttributeLoaders as $oAttributeLoader){ foreach ($attributeLoaders as $attributeLoader){
$oAttributeLoader->runRequiredIndexers(); $attributeLoader->runRequiredIndexers();
} }
$fixture->setStorageData(self::STORAGE_KEY, array_keys($data)); $fixture->setStorageData(self::STORAGE_KEY, array_keys($data));
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org> * @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Steve Rice <srice@endertech.com> * @author Steve Rice <srice@endertech.com>
* @author Jonathan Day <jonathan@aligent.com.au>
*/ */
abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract
...@@ -153,9 +154,9 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract ...@@ -153,9 +154,9 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract
throw new Exception('Attribute array cannot be empty'); throw new Exception('Attribute array cannot be empty');
} }
else { else {
$aAttributeCodes = array(); $attributeCodes = array();
foreach($attributes[$entityType] as $aAttribute){ foreach($attributes[$entityType] as $attribute){
$aAttributeCodes[] = $aAttribute['attribute_code']; $attributeCodes[] = $attribute['attribute_code'];
} }
} }
//delete entry from eav/attribute and allow FK cascade to delete all related values //delete entry from eav/attribute and allow FK cascade to delete all related values
...@@ -165,7 +166,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract ...@@ -165,7 +166,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Attribute_Abstract
$this->getTable('eav/attribute'), $this->getTable('eav/attribute'),
array( array(
'entity_type_id = ?' => $eavSetup->getEntityTypeId($entityType), 'entity_type_id = ?' => $eavSetup->getEntityTypeId($entityType),
'attribute_code IN (?)' => $aAttributeCodes, 'attribute_code IN (?)' => $attributeCodes,
) )
); );
$this->_getWriteAdapter()->commit(); $this->_getWriteAdapter()->commit();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment