getSynonym() public static method

Get a synonym
public static getSynonym ( integer $id ) : array
$id integer The id of the item we're looking for.
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 && BackendSearchModel::existsSynonymById($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get data
         $this->record = (array) BackendSearchModel::getSynonym($this->id);
         // delete item
         BackendSearchModel::deleteSynonym($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete_synonym', array('id' => $this->id));
         // item was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Synonyms') . '&report=deleted-synonym&var=' . rawurlencode($this->record['term']));
     } else {
         $this->redirect(BackendModel::createURLForAction('Synonyms') . '&error=non-existing');
     }
 }
Example #2
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->record = BackendSearchModel::getSynonym($this->id);
 }