2017 © Pedro Peláez
 

library tays-orm

Quick and easy ORM

image

taylor-hawkes/tays-orm

Quick and easy ORM

  • Monday, November 2, 2015
  • by TaylorHawkes
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

TaysORM

This is a super simple class for saving/editing record in a mysql database. It really helps for quickly/easily updating single records., (*1)

installation & usage

Install with composer:, (*2)

composer require taylor-hawkes\easy-connect
composer require taylor-hawkes\tays-orm

Generate a new model with the generator script:, (*3)

cd vendor/taylor-hawkes/tays-orm

```sh php generate_model.php --table="users" --host="database_ip" --user="db_user" --pass="db_pass" --database="db_name" --table="tablename", (*4)


``You can hard code the database params in the generate_table script so you don't have to put them in as params everytime.`` ``This script by default installs all new Models and Base Models three directories up (in a TModel folder) from the TaysORM installation directory. You can edit where the script installs your Models.`` # Usage Examples: Create a new user: ```php $user=new \TModel\Users(); $user->first_name="taylor"; $user->last_name="hawkes"; $user->save();

Edit a user:, (*5)

$user=new \TModel\Users();
$user->fetchRow("1");// 1 is the value of the tables primary key
$user->last_name="Malone"; // I got married and was forced to take my wifes name
$user->save();

You can also fetch a row like this:, (*6)

$user=new \TModel\Users();
$user->fetchRowWhere("first_name = 'taylor' and lastname ='hawkes'");
$user->last_name="Malone"; 
$user->save();

Selecting Multiple Records:, (*7)

$user=new \TModel\Users();
$all_users= $user->fetchAssoc("select * from users");

All Other Queries:, (*8)

$user=new \TModel\Users();
$do_something_else=$user->query("update users set ...");

Requirements

EasyConnect - [https://github.com/TaylorHawkes/EasyConnect], (*9)

License

MIT, (*10)

The Versions

02/11 2015

dev-master

9999999-dev http://taylor.woodstitch.com/

Quick and easy ORM

  Sources   Download

MIT

02/11 2015

v1.0.2

1.0.2.0 http://taylor.woodstitch.com/

Quick and easy ORM

  Sources   Download

MIT