get() public static method

Get all data for a given id.
Deprecation: use doctrine instead
public static get ( integer $id ) : array
$id integer The id for the record to get.
return array
Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendContentBlocksModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendContentBlocksModel::get($this->id);
         // delete item
         BackendContentBlocksModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title']));
     } else {
         // no item found, redirect to the overview with an error
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Example #2
0
 /**
  * Get the data
  * If a revision-id was specified in the URL we load the revision and not the most recent data.
  */
 private function getData()
 {
     $this->record = BackendContentBlocksModel::get($this->id);
     // specific revision?
     $revisionToLoad = $this->getParameter('revision', 'int');
     // if this is a valid revision
     if ($revisionToLoad !== null) {
         // overwrite the current record
         $this->record = BackendContentBlocksModel::getRevision($this->id, $revisionToLoad);
         // show warning
         $this->tpl->assign('usingRevision', true);
     }
     // get the templates
     // @todo why is $this->templates loaded twice?
     $this->templates = BackendContentBlocksModel::getTemplates();
     // check if selected template is still available
     if ($this->record['template'] && !in_array($this->record['template'], $this->templates)) {
         $this->record['template'] = '';
     }
 }