コード例 #1
0
ファイル: Sortable.php プロジェクト: janmarek/Ormion
 /**
  * Set order before insert
  * @param IRecord record
  */
 public function setOrderBeforeInsert(IRecord $record)
 {
     $collection = $record->findAll();
     if (isset($this->groupColumn)) {
         $type = $record->getConfig()->getType($this->groupColumn);
         $collection->where("%n = %{$type}", $this->groupColumn, $record->{$this->groupColumn});
     }
     $record->{$this->orderColumn} = count($collection) + 1;
 }