mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 09:17:35 +00:00
41 lines
981 B
PHP
41 lines
981 B
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Customer\Model\ResourceModel\Db\VersionControl;
|
|
|
|
use Magento\Framework\DataObject;
|
|
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot;
|
|
|
|
class AddressSnapshot extends Snapshot
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function isModified(DataObject $entity)
|
|
{
|
|
$result = parent::isModified($entity);
|
|
|
|
if (!$result
|
|
&& !$entity->getIsCustomerSaveTransaction()
|
|
&& $this->isAddressDefault($entity)
|
|
) {
|
|
return true;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Checks if address has chosen as default and has had an id
|
|
*
|
|
* @param DataObject $entity
|
|
* @return bool
|
|
*/
|
|
private function isAddressDefault(DataObject $entity)
|
|
{
|
|
return $entity->getId() && ($entity->getIsDefaultBilling() || $entity->getIsDefaultShipping());
|
|
}
|
|
}
|