library mysqlmodel
A minimalistic manager for storing and retrieving MySQL rows as PHP models. Does not handle schemas. Does allow treating mysql rows like documents.
utipd/mysqlmodel
A minimalistic manager for storing and retrieving MySQL rows as PHP models. Does not handle schemas. Does allow treating mysql rows like documents.
- Thursday, August 28, 2014
- by dweller
- Repository
- 1 Watchers
- 0 Stars
- 76 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
A MysqlModel component for UTipdMe., (*1)
, (*2)
A simple ORM to map MySQL table rows to PHP models and back., (*3)
Usage Example:, (*4)
<?php
// create a class
// this maps to table user in MySQL (you must create this yourself)
class UserDirectory extends \Utipd\MysqlModel\BaseDocumentMysqlDirectory {
protected $column_names = ['email'];
}
// pass in your PDO object
$user_directory = new UserDirectory(new \PDO('mysql:dbname=testdb;host=127.0.0.1'));
// find by email
$user = $user_directory->findOne(['email' => 'johny@appleseed.com']);
// access rows and properties
print $user['email']."\n";
// update in MySQL, adding arbitrary columns
$user_directory->update($user, ['firstName' => 'John', 'lastName' => 'Appleseed']);
// get the user again from the database
$user = $user_directory->reload($user);
print $user['firstName']." ".$user['lastName']."\n";
dev-master
9999999-dev
A minimalistic manager for storing and retrieving MySQL rows as PHP models. Does not handle schemas. Does allow treating mysql rows like documents.
Sources
Download
MIT
The Requires
The Development Requires
0.0.1
0.0.1.0
A minimalistic manager for storing and retrieving MySQL rows as PHP models. Does not handle schemas. Does allow treating mysql rows like documents.
Sources
Download
MIT
The Requires
The Development Requires