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 @@
* @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)
* @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
*/
public function apply(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interface $fixture)
{
$aAttributeLoaders = array();
$attributeLoaders = array();
$this->getResource()->beginTransaction();
foreach ($data as $entityType => $values) {
$aAttributeLoaders[] = $this->_getAttributeLoader($entityType)
$attributeLoaders[] = $this->_getAttributeLoader($entityType)
->setFixture($fixture)
->setOptions($fixture->getOptions())
->loadAttribute($entityType, $values);
......@@ -97,8 +99,8 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Attributes
$this->getResource()->commit();
foreach ($aAttributeLoaders as $oAttributeLoader){
$oAttributeLoader->runRequiredIndexers();
foreach ($attributeLoaders as $attributeLoader){
$attributeLoader->runRequiredIndexers();
}
$fixture->setStorageData(self::STORAGE_KEY, array_keys($data));
......
......@@ -15,6 +15,7 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
* @author Steve Rice <srice@endertech.com>
* @author Jonathan Day <jonathan@aligent.com.au>
*/
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');
}
else {
$aAttributeCodes = array();
foreach($attributes[$entityType] as $aAttribute){
$aAttributeCodes[] = $aAttribute['attribute_code'];
$attributeCodes = array();
foreach($attributes[$entityType] as $attribute){
$attributeCodes[] = $attribute['attribute_code'];
}
}
//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
$this->getTable('eav/attribute'),
array(
'entity_type_id = ?' => $eavSetup->getEntityTypeId($entityType),
'attribute_code IN (?)' => $aAttributeCodes,
'attribute_code IN (?)' => $attributeCodes,
)
);
$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