예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function save(EntityInterface $product)
 {
     // Product kits, particularly, shouldn't actually be added to an order,
     // but instead they cause other products to be added.
     if (isset($product->skip_save) && $product->skip_save == TRUE) {
         return;
     }
     return parent::save($product);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function save(EntityInterface $entity)
 {
     // The anonymous user account is saved with the fixed user ID of 0.
     // Therefore we need to check for NULL explicitly.
     if ($entity->id() === NULL) {
         $entity->uid->value = $this->database->nextId($this->database->query('SELECT MAX(uid) FROM {users}')->fetchField());
         $entity->enforceIsNew();
     }
     return parent::save($entity);
 }
예제 #3
0
 /**
  * Overrides Drupal\Core\Entity\Sql\SqlContentEntityStorage::save().
  *
  * Cart items are deleted if saved with a quantity of zero.
  */
 public function save(EntityInterface $entity)
 {
     if ($entity->qty->value < 1) {
         if (isset($entity->cart_item_id->value)) {
             parent::delete(array($entity->cart_item_id->value => $entity));
         }
     } else {
         $entity->setChangedTime(REQUEST_TIME);
         parent::save($entity);
     }
 }