예제 #1
0
 protected function insert()
 {
     if (is_null($this->position->get())) {
         $this->setLastPosition('type');
     }
     parent::insert();
 }
예제 #2
0
 protected function insert()
 {
     // get max position
     $f = new ARSelectFilter();
     $f->setCondition($this->getParentCondition());
     $f->setOrder(new ARFieldHandle(get_class($this), 'position'), 'DESC');
     $f->setLimit(1);
     $rec = ActiveRecord::getRecordSetArray(get_class($this), $f);
     $position = is_array($rec) && count($rec) > 0 ? $rec[0]['position'] + 1 : 1;
     $this->position->set($position);
     return parent::insert();
 }
예제 #3
0
파일: TaxRate.php 프로젝트: saiber/www
 protected function insert()
 {
     if (!$this->deliveryZone->get() || $this->deliveryZone->get()->isDefault()) {
         $this->deliveryZone->setNull();
     }
     return parent::insert();
 }
예제 #4
0
파일: Product.php 프로젝트: saiber/livecart
 /**
  * Inserts new product record to a database
  *
  */
 protected function insert()
 {
     ActiveRecordModel::beginTransaction();
     try {
         $this->dateCreated->set(new ARSerializableDateTime());
         $this->dateUpdated->set(new ARSerializableDateTime());
         parent::insert();
         if ($this->category->get()) {
             $this->updateCategoryCounters($this->getCountUpdateFilter(), $this->category->get());
         }
         ActiveRecordModel::commit();
     } catch (Exception $e) {
         ActiveRecordModel::rollback();
         throw $e;
     }
 }
예제 #5
0
파일: TaxClass.php 프로젝트: saiber/www
 protected function insert()
 {
     $this->setLastPosition();
     parent::insert();
 }
예제 #6
0
 protected function insert()
 {
     // get current max position
     if (!$this->position->get()) {
         $filter = new ARSelectFilter();
         $cond = new EqualsCond(new ARFieldHandle(get_class($this), $this->getFieldIDColumnName()), $this->getField()->get()->getID());
         $filter->setCondition($cond);
         $filter->setOrder(new ARFieldHandle(get_class($this), 'position'), 'DESC');
         $filter->setLimit(1);
         $res = ActiveRecordModel::getRecordSet(get_class($this), $filter);
         if ($res->size() > 0) {
             $item = $res->get(0);
             $pos = $item->position->get() + 1;
         } else {
             $pos = 0;
         }
         $this->position->set($pos);
     }
     return parent::insert();
 }
예제 #7
0
파일: ObjectImage.php 프로젝트: saiber/www
 protected function insert($foreignKeyName)
 {
     $className = get_class($this);
     // get current max image position
     $filter = new ARSelectFilter();
     $filter->setCondition(new EqualsCond(new ARFieldHandle($className, $foreignKeyName), $this->getOwner()->getID()));
     $filter->setOrder(new ARFieldHandle($className, 'position'), 'DESC');
     $filter->setLimit(1);
     $maxPosSet = ActiveRecord::getRecordSet($className, $filter);
     if ($maxPosSet->size() > 0) {
         $maxPos = $maxPosSet->get(0)->position->get() + 1;
     } else {
         $maxPos = 0;
     }
     $this->position->set($maxPos);
     return parent::insert();
 }
예제 #8
0
파일: ProductList.php 프로젝트: saiber/www
 protected function insert()
 {
     $this->setLastPosition('category');
     return parent::insert();
 }
예제 #9
0
 protected function insert()
 {
     if ($this->shipment->get() && !$this->shipment->get()->isExistingRecord()) {
         $this->shipment->setNull();
     }
     if (!$this->price->get()) {
         $this->price->set($this->getProduct()->getItemPrice($this));
     }
     return parent::insert();
 }