Created
July 18, 2013 00:44
-
-
Save oojacoboo/6025852 to your computer and use it in GitHub Desktop.
simple example of a class that has options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace WidgetFactory\Modules; | |
| class MyModule extends MyORM | |
| { | |
| /** | |
| * 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