Database interface
To add support for new database, the new class has to implement this interface. Check MYSQLDatabase.php for example
Database class
This class process the Query/Update/Delete/Insert class to string and execute it
Delete class
This class holds all the information regarding DELETE operation, that will be used by Database class.
Example
$deleteOperation = new Delete('User');
$deleteOperation->where('id', '=', '1');
$deleteOperation->exec();
File class
This class hold information about a file.
Example
$file = new File('docs', 'cv.pdf', 'base64 content');
FileStorage class
This class holds utils to save and delete file.
Example
$file = new File('docs', 'cv.pdf', 'base64 content');
FileStorage::saveFile($file);
FileStorage::deleteFile($file);
FileStorage::deleteFolder('./folder_to_be_deleted');
Insert class
This class holds all the information regarding INSERT operation, that will be used by Database class.
Example
$data = [
"name": "John Doe"
];
$insertOperation = new Insert('User', $data);
$insertOperation->exec();
Model class
This class is the main Model class
Example
class User extends Model {
protected $table = 'user';
protected $primaryKey = 'id';
protected $fillable = ["fullName", "email"];
}
$user = new User();
$user->fullName = "John Doe";
$user->email = "johndoe@example.com";
$user->save();
$foundUser = User::find($user->getPrimaryValue());
$user2 = User::where("fullName", "John Doe")->limit(1)->orderBy('id')->exec();
MYSQLDatabase class
This class holds the logics to convert Query/Update/Insert/Delete class to actual MYSQL query string This class will be extended my Database class
Query class
This class holds all the information regarding SELECT operation, that will be used by Database class.