6
6
namespace Magento \SalesRule \Model \ResourceModel ;
7
7
8
8
use Magento \Framework \App \ObjectManager ;
9
- use \Magento \SalesRule \Model \Rule as SalesRule ;
10
9
use Magento \Framework \Model \AbstractModel ;
11
10
use Magento \Rule \Model \ResourceModel \AbstractResource ;
12
11
use Magento \Framework \EntityManager \EntityManager ;
19
18
*/
20
19
class Rule extends AbstractResource
21
20
{
22
- /**
23
- * Store associated with rule entities information map
24
- *
25
- * @var array
26
- */
27
- protected $ _associatedEntitiesMap = [];
28
-
29
21
/**
30
22
* @var array
31
23
*/
@@ -78,10 +70,7 @@ public function __construct(
78
70
) {
79
71
$ this ->string = $ string ;
80
72
$ this ->_resourceCoupon = $ resourceCoupon ;
81
- $ associatedEntitiesMapInstance = $ associatedEntityMapInstance ?: ObjectManager::getInstance ()->get (
82
- \Magento \SalesRule \Model \ResourceModel \Rule \AssociatedEntityMap::class
83
- );
84
- $ this ->_associatedEntitiesMap = $ associatedEntitiesMapInstance ->getData ();
73
+ $ this ->_associatedEntitiesMap = $ associatedEntityMapInstance ? $ associatedEntityMapInstance ->getData () : [] ;
85
74
$ this ->serializer = $ serializer ?: ObjectManager::getInstance ()->get (Json::class);
86
75
$ this ->metadataPool = $ metadataPool ?: ObjectManager::getInstance ()->get (MetadataPool::class);
87
76
parent ::__construct ($ context , $ connectionName );
@@ -143,7 +132,7 @@ public function _beforeSave(AbstractModel $object)
143
132
/**
144
133
* Load an object
145
134
*
146
- * @param SalesRule| AbstractModel $object
135
+ * @param AbstractModel $object
147
136
* @param mixed $value
148
137
* @param string $field field to load by (defaults to model id)
149
138
* @return $this
@@ -376,7 +365,6 @@ public function getProductAttributes($serializedString)
376
365
/**
377
366
* @param \Magento\Framework\Model\AbstractModel $object
378
367
* @return $this
379
- * @throws \Exception
380
368
*/
381
369
public function save (\Magento \Framework \Model \AbstractModel $ object )
382
370
{
@@ -389,7 +377,6 @@ public function save(\Magento\Framework\Model\AbstractModel $object)
389
377
*
390
378
* @param \Magento\Framework\Model\AbstractModel $object
391
379
* @return $this
392
- * @throws \Exception
393
380
*/
394
381
public function delete (AbstractModel $ object )
395
382
{
0 commit comments