Skip to content

Instantly share code, notes, and snippets.

@oojacoboo
Created July 18, 2013 01:22
Show Gist options
  • Select an option

  • Save oojacoboo/6025998 to your computer and use it in GitHub Desktop.

Select an option

Save oojacoboo/6025998 to your computer and use it in GitHub Desktop.
<?php
namespace WidgetFactory\Modules;
class MyModule extends MyORM
{
const SEND_EMAILS = "sendEmails";
const SHARE_BY_DEFAULT = "shareByDefault";
/**
* Shared method to get the option value from the db
* @param string $option
* @return mixed
*/
public function getOption($option) {
return $this->query("SELECT `value` FROM `module_option` WHERE `name` = ?", array($option));
}
/**
* Update the option value
* @param string $option
* @param mixed $value
* @return mixed
*/
public function setOption($option, $value) {
return $this->query("UPDATE `module_option` SET `value` = ? WHERE `name` = ?", array($value, $option));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment