getMaximumId() public static method

Get the maximum id.
Deprecation:
public static getMaximumId ( ) : integer
return integer
Example #1
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         $fields = $this->frm->getFields();
         // validate fields
         $fields['title']->isFilled(BL::err('TitleIsRequired'));
         if ($this->frm->isCorrect()) {
             // build item
             $item['id'] = BackendContentBlocksModel::getMaximumId() + 1;
             $item['user_id'] = BackendAuthentication::getUser()->getUserId();
             $item['template'] = count($this->templates) > 1 ? $fields['template']->getValue() : $this->templates[0];
             $item['language'] = BL::getWorkingLanguage();
             $item['title'] = $fields['title']->getValue();
             $item['text'] = $fields['text']->getValue();
             $item['hidden'] = $fields['hidden']->getValue() ? 'N' : 'Y';
             $item['status'] = 'active';
             $item['created_on'] = BackendModel::getUTCDate();
             $item['edited_on'] = BackendModel::getUTCDate();
             // insert the item
             $item['revision_id'] = BackendContentBlocksModel::insert($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('Index') . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
         }
     }
 }