FOF30\Model\DataModel::restore PHP Method

restore() public method

Untrashes a record, either the currently loaded one or the one specified in $id. If an $id is specified that record is loaded before trying to untrash it. Please note that enabled is set to 0 (unpublished) when you untrash an item.
public restore ( mixed $id = null )
$id mixed Primary key (id field) value
    public function restore($id = null)
    {
        if (!$this->hasField('enabled')) {
            return $this;
        }
        if (!empty($id)) {
            $this->findOrFail($id);
        }
        $id = $this->getId();
        if (!$id) {
            throw new RecordNotLoaded("Can't change the state of a not loaded DataModel");
        }
        $this->triggerEvent('onBeforeRestore', array(&$id));
        $enabled = $this->getFieldAlias('enabled');
        $this->{$enabled} = 0;
        $this->save();
        $this->triggerEvent('onAfterRestore', array(&$id));
        return $this;
    }