Backend\Modules\Locale\Engine\Model::exists PHP Method

exists() public static method

Does an id exist.
public static exists ( integer $id ) : boolean
$id integer The id to check for existence.
return boolean
    public static function exists($id)
    {
        return (bool) BackendModel::getContainer()->get('database')->getVar('SELECT 1
             FROM locale
             WHERE id = ?
             LIMIT 1', array((int) $id));
    }

Usage Example

Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendLocaleModel::exists($this->id)) {
         parent::execute();
         $this->setFilter();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Locale\Engine\Model::exists