Beispiel #1
0
 public function testSetIsSubtotals()
 {
     $this->_model->setIsSubTotals(true);
     $this->assertTrue($this->_model->isSubTotals());
     $this->_model->setIsSubTotals(false);
     $this->assertFalse($this->_model->isSubTotals());
 }
Beispiel #2
0
 public function offsetSet($offset, $value)
 {
     if ($this->contains($value)) {
         return;
     }
     parent::offsetSet($offset, $value);
 }
Beispiel #3
0
 /**
  * Offset to set
  * @link http://php.net/manual/en/arrayaccess.offsetset.php
  * @param mixed $offset The offset to assign the value to.
  * @param mixed $value The value to set.
  * @return void
  */
 public function offsetSet($offset, $value)
 {
     if (is_string($offset)) {
         switch (strtolower($offset)) {
             case 'datacenter':
             case 'dc':
                 $offset = 'Datacenter';
                 break;
             case 'allowstale':
             case 'stale':
                 $offset = 'AllowStale';
                 break;
             case 'requireconsistent':
             case 'consistent':
                 $offset = 'RequireConsistent';
                 break;
             case 'waitindex':
             case 'index':
                 $offset = 'WaitIndex';
                 break;
             case 'waittime':
             case 'wait':
                 $offset = 'WaitTime';
                 break;
         }
     }
     parent::offsetSet($offset, $value);
 }
Beispiel #4
0
 public function add($o)
 {
     if ($this->contains($o)) {
         return false;
     }
     return parent::add($o);
 }
 public function offsetSet($offset, $value)
 {
     if (!$value instanceof User) {
         throw new \Bixev\InterventionSdk\Exception('trying to set non valid element');
     }
     parent::offsetSet($offset, $value);
 }
 /**
  * Adds an model to this collection.
  * Is used during initial collection construction.
  *
  * @param   Model   $model
  * @return  self
  */
 protected function add(Model $model)
 {
     parent::add($model);
     if (false === $this->hasOriginal($model)) {
         $this->original[] = $model;
     }
     return $this;
 }
Beispiel #7
0
 /**
  * @param array $values
  */
 public function __construct($values)
 {
     parent::__construct(array_fill_keys($values, true));
 }
 /**
  * Set all values and reset keys
  *
  * @param array $aValues
  *
  * @return $this
  */
 public function set(array $aValues)
 {
     parent::set($aValues);
     return $this->resetKeys();
 }
Beispiel #9
0
 /**
  * @inheritdoc
  */
 public function __construct(array $data = [])
 {
     parent::__construct(array_values(array_unique($data)));
 }
Beispiel #10
0
 /**
  * @param array $values
  */
 public function __construct($values)
 {
     parent::__construct(array_values($values));
 }
Beispiel #11
0
 /**
  * Set the value of an array native type
  *
  * @param array $value
  */
 public function __construct($value)
 {
     $this->_type = self::XMLRPC_TYPE_ARRAY;
     parent::__construct($value);
 }
Beispiel #12
0
 /**
  * Delete collection items
  *
  * @param AbstractCollection $collection
  * @return int
  */
 protected function delete($collection)
 {
     $count = 0;
     foreach ($collection->getAllIds() as $id) {
         /** @var \Magento\Framework\Model\AbstractModel $model */
         $model = $this->_objectManager->get($this->model);
         $model->load($id);
         $model->delete();
         ++$count;
     }
     return $count;
 }
Beispiel #13
0
 /**
  * Snapshots collection after creation.
  *
  * @param array $elements
  */
 public function __construct(array $elements = [])
 {
     parent::__construct($elements);
     $this->snapshot();
 }
Beispiel #14
0
 /**
  * @inheritdoc
  */
 public function clear()
 {
     parent::clear();
     $this->hashes = [];
 }
Beispiel #15
0
 /**
  * @return mixed
  */
 public function current()
 {
     return $this->data->pick($this->position);
 }
 /**
  * Set the value of a struct native type
  *
  * @param array $value
  */
 public function __construct($value)
 {
     $this->type = self::XMLRPC_TYPE_STRUCT;
     parent::__construct($value);
 }
 /**
  * AbstractConsulConfig constructor.
  * @param array $data
  */
 public function __construct(array $data = array())
 {
     $this->_definition = $this->getDefinition();
     parent::__construct($data + $this->_definition);
 }
Beispiel #18
0
 /**
  * Notify collection items
  *
  * @param AbstractCollection $collection
  * @return int
  */
 protected function notify($collection)
 {
     $count = 0;
     $this->_mailer = $this->_objectManager->get('Alin\\Cadou\\Model\\Mailer');
     foreach ($collection->getAllIds() as $id) {
         /** @var \Magento\Framework\Model\AbstractModel $model */
         $model = $this->_objectManager->get($this->model);
         $model->load($id);
         $data = $model->getOrigData();
         $data['name'] = $data['fullname'];
         $mediaUrl = $this->_objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore($data['store_id'])->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product';
         $productSelect = $this->_objectManager->create('Alin\\Cadou\\Model\\Cadou\\Source\\ProductSelect');
         $product_names = $productSelect->toOptionHash();
         $data['productname'] = $product_names[$data['product_id']];
         $product = $this->_objectManager->create('Magento\\Catalog\\Model\\Product');
         $product = $product->setStoreId($data['store_id'])->load($data['product_id']);
         $data['producturl'] = $product->getUrlInStore();
         $data['productimage'] = $product->getImage();
         $customerData = $this->_objectManager->create('Magento\\Quote\\Model\\Quote');
         $customerData->loadByIdWithoutStore($data['quote_id']);
         if (!empty($data['child_cart_item_id'])) {
             $cart_item = $customerData->getItemById($data['cart_item_id'])->toArray();
             $product = $this->_objectManager->create('Magento\\Catalog\\Model\\Product');
             //recreate product object
             $product = $product->setStoreId($data['store_id'])->load($cart_item['product_id']);
             $data['producturl'] = $product->getUrlInStore();
         }
         if (!empty($data['productimage'])) {
             $data['productimage'] = $mediaUrl . $data['productimage'];
         }
         if ($customerData->getCustomerIsGuest()) {
             $data['customer_name'] = 'Guest';
             $data['customer_email'] = $customerData->getCustomerEmail();
         } else {
             $data['customer_name'] = $customerData->getCustomerFirstname() . ' ' . $customerData->getCustomerLastname();
             $data['customer_email'] = $customerData->getCustomerEmail();
         }
         $resp = $this->_mailer->sendNotification($data);
         if ($resp == true) {
             $model->setNotified(true);
             $model->save();
             ++$count;
         }
     }
     return $count;
 }
Beispiel #19
0
 protected function __construct()
 {
     parent::__construct();
 }
Beispiel #20
0
 /**
  * Constructs a collection object of the specified type,
  * optionally with the specified data
  *
  * @param string $collectionType
  * @param array $data
  */
 public function __construct($collectionType, array $data = [])
 {
     $this->collectionType = $collectionType;
     parent::__construct($data);
 }
Beispiel #21
0
 /**
  * Initializes ListArray numerically reindexing provided elements.
  *
  * @param array $elements
  */
 public function __construct(array $elements = [])
 {
     parent::__construct(array_values($elements));
 }