Created
June 29, 2015 02:41
-
-
Save TheOpenDevProject/a23869603dc0c0a3836c to your computer and use it in GitHub Desktop.
DAL
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 | |
require_once ($_SERVER['DOCUMENT_ROOT'] + 'path/to/idiorm.php'); | |
class Config { | |
protected function __construct(){ | |
ORM::configure('mysql:host=localhost;dbname=database'); | |
ORM::configure('username','username'); | |
ORM::configure('password',''); | |
ORM::configure('return_result_sets', true); | |
} | |
}; | |
class Manager extends Config{ | |
public function CreateMachine($arg1,$arg2,$arg3){ | |
$Writer = ORM::for_table('table_name')->create(); | |
$Writer->MachineName = $arg1; | |
//... | |
//... | |
$Writer->save(); | |
} | |
}; | |
class EventLogger extends Config{ | |
//NOTE $args... has a special meaning in PHP do not leave it like this. (It means its a variadic) | |
public function CreateSchedule($args...){ | |
$Writer = ORM::for_table('table_name')->create(); | |
$Writer->MachineName = $args; | |
//... | |
//... | |
$Writer->save(); | |
} | |
public function GetAllSchedules(){ | |
$scheduels = ORM::for_table('table_name')->find_many(); | |
return $scheduels; | |
} | |
}; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment