/**
  * Saving test data to database
  * @return mixed
  */
 protected function saveTestData()
 {
     foreach ($this->getTestData() as $key => $value) {
         $this->model->setData($key, $value);
     }
     $this->model->save();
     return $this->model->getId();
 }
 /**
  * @return $this
  */
 public function save()
 {
     if (!is_null($this->getId()) && $this->isCacheEnabled()) {
         $this->getHelper('Data\\Cache\\Permanent')->removeTagValues($this->getCacheInstancesTag());
     }
     return parent::save();
 }
Exemple #3
0
/**
 * 2016-08-22
 * @param AbstractModel $model
 * @return void
 */
function df_eav_partial_save(AbstractModel $model)
{
    /** @var AbstractEntity $resource */
    $resource = $model->getResource();
    $resource->isPartialSave(true);
    try {
        $model->save();
    } finally {
        $resource->isPartialSave(false);
    }
}
Exemple #4
0
 protected function _testUpdate()
 {
     foreach ($this->_updateData as $key => $value) {
         $this->_model->setDataUsingMethod($key, $value);
     }
     $this->_model->save();
     $model = $this->_getEmptyModel();
     $model->load($this->_model->getId());
     foreach ($this->_updateData as $key => $value) {
         \PHPUnit_Framework_Assert::assertEquals($value, $model->getDataUsingMethod($key), 'CRUD Update "' . $key . '" error');
     }
 }
Exemple #5
0
 /**
  * Save model plus its options
  * Ensures saving options in case when resource model was not changed
  *
  * @return void
  */
 public function save()
 {
     $hasDataChanges = $this->hasDataChanges();
     $this->_flagOptionsSaved = false;
     parent::save();
     if ($hasDataChanges && !$this->_flagOptionsSaved) {
         $this->_saveItemOptions();
     }
 }
Exemple #6
0
 /**
  * Save quote with prevention checking
  *
  * @return $this
  */
 public function save()
 {
     if ($this->_preventSaving) {
         return $this;
     }
     return parent::save();
 }
Exemple #7
0
 /**
  * Save wishlist.
  *
  * @return $this
  */
 public function save()
 {
     $this->_hasDataChanges = true;
     return parent::save();
 }
Exemple #8
0
 /**
  * Set `updated_at` to be always changed
  *
  * @return $this
  */
 public function save()
 {
     $this->setUpdatedAt(gmdate('Y-m-d H:i:s'));
     return parent::save();
 }
 /**
  * Save mail to db, message and attachments to storage
  *
  * @throws \Magento\Framework\Exception\MailException
  * @throws \Exception
  */
 public function save()
 {
     parent::save();
     $this->_storage->saveMessage($this);
     $this->_storage->saveAttachments($this);
     $this->_storage->saveMail($this);
 }