public function setNextPosition() { $className = get_class($this); if (!is_integer(self::$nextPosition)) { $filter = new ARSelectFilter(); $filter->setCondition(new EqualsCond(new ARFieldHandle($className, 'productID'), $this->product->get()->getID())); $filter->setOrder(new ARFieldHandle($className, 'position'), ARSelectFilter::ORDER_DESC); $filter->setLimit(1); self::$nextPosition = 0; foreach (ActiveRecord::getRecordSet($className, $filter) as $relatedProductGroup) { self::$nextPosition = $relatedProductGroup->position->get(); } } $this->position->set(++self::$nextPosition); }
public function delete() { foreach ($this->getFiles() as $productFile) { $productFile->deleteFile(); } return parent::delete(); }
public static function mergeGroupsWithFields($groups, $fields) { return parent::mergeGroupsWithFields(__CLASS__, $groups, $fields); }