Created
May 14, 2015 16:56
-
-
Save Phunky/b36c9c786c43de3ab2a5 to your computer and use it in GitHub Desktop.
Simple MySQLi wrapper idea... named after MariaDB as it would only be for MySQLi!
This file contains 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 | |
// Records | |
$Maria->user()->insert(['name'=>'Bobby']); | |
$Maria->user(1)->delete(); | |
$Maria->user(1)->read(); | |
$Maria->user(1)->update('name', 'bobby'); | |
// Collections | |
$Maria->find('user')->read(); | |
$Maria->find('user')->equals('is_verified', 1)->read(); | |
$Maria->find('user')->in('id', [1,2,3])->read(); | |
$Maria->find('user')->isNull('emailAddress')->read(); | |
$Maria->find('user')->isNotNull('emailAddress')->read(); | |
$Maria->find('user')->where('is_verified = ? AND id IN ?', [1, [1,2,3]])->read(); | |
$Maria->find('user')->limit(0, 15); | |
// Relationships | |
$Maria->find('user')->has('post')->read(); | |
$Maria->find('post')->belongsTo('user')->equals('user.id', 1)->read(); | |
// Limit columns | |
$Maria->find('user', ['id', 'name', 'email'])->equals('is_verified', 1)->read(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment