Skip to content

Commit

Permalink
Merge remote-tracking branch 'magento2ce/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Natalia Momotenko committed Mar 4, 2015
2 parents 18d59e7 + 068d068 commit c3d76ed
Show file tree
Hide file tree
Showing 1,194 changed files with 11,676 additions and 15,078 deletions.
10 changes: 6 additions & 4 deletions app/code/Magento/Authorization/Model/Resource/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ class Role extends \Magento\Framework\Model\Resource\Db\AbstractDb
protected $dateTime;

/**
* @param \Magento\Framework\App\Resource $resource
* @param \Magento\Framework\Model\Resource\Db\Context $context
* @param \Magento\Framework\App\CacheInterface $cache
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param string|null $resourcePrefix
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Framework\Model\Resource\Db\Context $context,
\Magento\Framework\App\CacheInterface $cache,
\Magento\Framework\Stdlib\DateTime $dateTime
\Magento\Framework\Stdlib\DateTime $dateTime,
$resourcePrefix = null
) {
$this->dateTime = $dateTime;
parent::__construct($resource);
parent::__construct($context, $resourcePrefix);
$this->_cache = $cache->getFrontend();
}

Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Authorization/Model/Resource/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ class Rules extends \Magento\Framework\Model\Resource\Db\AbstractDb
protected $_logger;

/**
* @param \Magento\Framework\App\Resource $resource
* @param \Magento\Framework\Model\Resource\Db\Context $context
* @param \Magento\Framework\Acl\Builder $aclBuilder
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Acl\RootResource $rootResource
* @param \Magento\Framework\Acl\CacheInterface $aclCache
* @param string|null $resourcePrefix
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Framework\Model\Resource\Db\Context $context,
\Magento\Framework\Acl\Builder $aclBuilder,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Acl\RootResource $rootResource,
\Magento\Framework\Acl\CacheInterface $aclCache
\Magento\Framework\Acl\CacheInterface $aclCache,
$resourcePrefix = null
) {
$this->_aclBuilder = $aclBuilder;
parent::__construct($resource);
parent::__construct($context, $resourcePrefix);
$this->_rootResource = $rootResource;
$this->_aclCache = $aclCache;
$this->_logger = $logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ProductLinkManagementInterface
* @param string $productId
* @return \Magento\Bundle\Api\Data\LinkInterface[]
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function getChildren($productId);

Expand Down Expand Up @@ -53,7 +53,7 @@ public function addChild(
* @param int $optionId
* @param string $childSku
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
* @return bool
*/
public function removeChild($productSku, $optionId, $childSku);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ProductOptionManagementInterface
* @param \Magento\Bundle\Api\Data\OptionInterface $option
* @return int
* @throws \Magento\Framework\Exception\CouldNotSaveException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function save(\Magento\Bundle\Api\Data\OptionInterface $option);
}
10 changes: 5 additions & 5 deletions app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ProductOptionRepositoryInterface
* @param int $optionId
* @return \Magento\Bundle\Api\Data\OptionInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function get($productSku, $optionId);

Expand All @@ -25,7 +25,7 @@ public function get($productSku, $optionId);
* @param string $productSku
* @return \Magento\Bundle\Api\Data\OptionInterface[]
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function getList($productSku);

Expand All @@ -35,7 +35,7 @@ public function getList($productSku);
* @param \Magento\Bundle\Api\Data\OptionInterface $option
* @return bool
* @throws \Magento\Framework\Exception\CouldNotSaveException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);

Expand All @@ -46,7 +46,7 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
* @param int $optionId
* @return bool
* @throws \Magento\Framework\Exception\CouldNotSaveException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function deleteById($productSku, $optionId);

Expand All @@ -57,7 +57,7 @@ public function deleteById($productSku, $optionId);
* @param \Magento\Bundle\Api\Data\OptionInterface $option
* @return int
* @throws \Magento\Framework\Exception\CouldNotSaveException
* @throws \Magento\Webapi\Exception
* @throws \Magento\Framework\Exception\InputException
*/
public function save(
\Magento\Catalog\Api\Data\ProductInterface $product,
Expand Down
10 changes: 4 additions & 6 deletions app/code/Magento/Bundle/Model/LinkManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public function getChildren($productId)
{
$product = $this->productRepository->get($productId);
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
throw new \Magento\Webapi\Exception(
'Only implemented for bundle product',
\Magento\Webapi\Exception::HTTP_FORBIDDEN
throw new InputException(
'Only implemented for bundle product'
);
}

Expand Down Expand Up @@ -178,9 +177,8 @@ public function removeChild($productSku, $optionId, $childSku)
$product = $this->productRepository->get($productSku);

if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
throw new \Magento\Webapi\Exception(
sprintf('Product with specified sku: %s is not a bundle product', $productSku),
\Magento\Webapi\Exception::HTTP_FORBIDDEN
throw new InputException(
sprintf('Product with specified sku: %s is not a bundle product', $productSku)
);
}

Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Bundle/Model/OptionManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
namespace Magento\Bundle\Model;

use Magento\Webapi\Exception;
use Magento\Framework\Exception\InputException;

class OptionManagement implements \Magento\Bundle\Api\ProductOptionManagementInterface
{
Expand Down Expand Up @@ -39,7 +39,7 @@ public function save(\Magento\Bundle\Api\Data\OptionInterface $option)
{
$product = $this->productRepository->get($option->getSku());
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
throw new InputException('Only implemented for bundle product');
}
return $this->optionRepository->save($product, $option);
}
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Bundle/Model/OptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace Magento\Bundle\Model;

use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Webapi\Exception;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand Down Expand Up @@ -205,13 +205,13 @@ public function save(
/**
* @param string $productSku
* @return \Magento\Catalog\Api\Data\ProductInterface
* @throws Exception
* @throws \Magento\Framework\Exception\InputException
*/
private function getProduct($productSku)
{
$product = $this->productRepository->get($productSku);
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
throw new InputException('Only implemented for bundle product');
}
return $product;
}
Expand Down
26 changes: 19 additions & 7 deletions app/code/Magento/Bundle/Model/Resource/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@ class Bundle extends \Magento\Framework\Model\Resource\Db\AbstractDb
protected $_productRelation;

/**
* @param \Magento\Framework\App\Resource $resource
* @var \Magento\Quote\Model\Resource\Quote
*/
protected $quoteResource;

/**
* @param \Magento\Framework\Model\Resource\Db\Context $context
* @param \Magento\Catalog\Model\Resource\Product\Relation $productRelation
* @param \Magento\Quote\Model\Resource\Quote $quoteResource
* @param null $resourcePrefix
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Catalog\Model\Resource\Product\Relation $productRelation
\Magento\Framework\Model\Resource\Db\Context $context,
\Magento\Catalog\Model\Resource\Product\Relation $productRelation,
\Magento\Quote\Model\Resource\Quote $quoteResource,
$resourcePrefix = null
) {
parent::__construct($resource);
parent::__construct($context, $resourcePrefix);
$this->_productRelation = $productRelation;
$this->quoteResource = $quoteResource;
}

/**
Expand Down Expand Up @@ -83,8 +93,10 @@ public function getSelectionsData($productId)
*/
public function dropAllQuoteChildItems($productId)
{
$quoteItemIds = $this->_getReadAdapter()->fetchCol(
$this->_getReadAdapter()->select()->from(
$select = $this->quoteResource->getReadConnection()->select();
$adapter = $select->getAdapter();
$quoteItemIds = $adapter->fetchCol(
$select->from(
$this->getTable('quote_item'),
['item_id']
)->where(
Expand All @@ -94,7 +106,7 @@ public function dropAllQuoteChildItems($productId)
);

if ($quoteItemIds) {
$this->_getWriteAdapter()->delete(
$adapter->delete(
$this->getTable('quote_item'),
['parent_item_id IN(?)' => $quoteItemIds]
);
Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Bundle/Model/Resource/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb
private $validator;

/**
* @param \Magento\Framework\App\Resource $resource
* @param \Magento\Framework\Model\Resource\Db\Context $context
* @param \Magento\Bundle\Model\Option\Validator $validator
* @param string|null $resourcePrefix
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Bundle\Model\Option\Validator $validator
\Magento\Framework\Model\Resource\Db\Context $context,
\Magento\Bundle\Model\Option\Validator $validator,
$resourcePrefix = null
) {
parent::__construct($resource);
parent::__construct($context, $resourcePrefix);
$this->validator = $validator;
}

Expand Down
4 changes: 3 additions & 1 deletion app/code/Magento/Bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"magento/module-eav": "0.42.0-beta10",
"magento/module-gift-message": "0.42.0-beta10",
"magento/framework": "0.42.0-beta10",
"magento/module-webapi": "0.42.0-beta10",
"magento/module-quote": "0.42.0-beta10",
"magento/magento-composer-installer": "*"
},
"suggest": {
"magento/module-webapi": "0.42.0-beta10"
},
"type": "magento2-module",
"version": "0.42.0-beta10",
"license": [
Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Captcha/Model/Resource/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ class Log extends \Magento\Framework\Model\Resource\Db\AbstractDb
protected $_remoteAddress;

/**
* @param \Magento\Framework\App\Resource $resource
* @param \Magento\Framework\Model\Resource\Db\Context $context
* @param \Magento\Framework\Stdlib\DateTime\DateTime $coreDate
* @param \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
* @param string|null $resourcePrefix
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Framework\Model\Resource\Db\Context $context,
\Magento\Framework\Stdlib\DateTime\DateTime $coreDate,
\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress,
$resourcePrefix = null
) {
$this->_coreDate = $coreDate;
$this->_remoteAddress = $remoteAddress;
parent::__construct($resource);
parent::__construct($context, $resourcePrefix);
}

/**
Expand Down
15 changes: 10 additions & 5 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,12 @@ public function eavReindexCallback()
public function reindex()
{
if ($this->_catalogProduct->isDataForProductCategoryIndexerWasChanged($this) || $this->isDeleted()) {
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
$categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
if (!$categoryIndexer->isScheduled()) {
$categoryIndexer->reindexRow($this->getId());
$productCategoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
if (!$productCategoryIndexer->isScheduled()) {
$productCategoryIndexer->reindexRow($this->getId());
}
}
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
}

/**
Expand Down Expand Up @@ -2013,7 +2013,12 @@ public function getIdentities()
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
}
}
return $identities;
if ($this->getOrigData('status') > $this->getData('status')) {
foreach ($this->getData('category_ids') as $categoryId) {
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
}
}
return array_unique($identities);
}

/**
Expand Down
26 changes: 3 additions & 23 deletions app/code/Magento/Catalog/Model/Resource/AbstractResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,20 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity
protected $_modelFactory;

/**
* Construct
*
* @param \Magento\Framework\App\Resource $resource
* @param \Magento\Eav\Model\Config $eavConfig
* @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
* @param \Magento\Eav\Model\Resource\Helper $resourceHelper
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
* @param \Magento\Eav\Model\Entity\Context $context
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Model\Factory $modelFactory
* @param array $data
*/
public function __construct(
\Magento\Framework\App\Resource $resource,
\Magento\Eav\Model\Config $eavConfig,
\Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity,
\Magento\Framework\Locale\FormatInterface $localeFormat,
\Magento\Eav\Model\Resource\Helper $resourceHelper,
\Magento\Framework\Validator\UniversalFactory $universalFactory,
\Magento\Eav\Model\Entity\Context $context,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Factory $modelFactory,
$data = []
) {
$this->_storeManager = $storeManager;
$this->_modelFactory = $modelFactory;
parent::__construct(
$resource,
$eavConfig,
$attrSetEntity,
$localeFormat,
$resourceHelper,
$universalFactory,
$data
);
parent::__construct($context, $data);
}

/**
Expand Down
Loading

0 comments on commit c3d76ed

Please sign in to comment.