2017 © Pedro Peláez
 

library mysql-db-framework

A MySQL ODM (assistant) extremely flexible for any project.

image

wcatron/mysql-db-framework

A MySQL ODM (assistant) extremely flexible for any project.

  • Friday, June 10, 2016
  • by wcatron
  • Repository
  • 1 Watchers
  • 1 Stars
  • 98 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

MySQL Framework PHP

A MySQL ODM (assistant) extremely flexible for any project., (*1)

Build Status, (*2)

Overview, (*3)

This framework allows you to quickly map objects to rows in a MySQL database., (*4)

Setup, (*5)

Create models for your objects and have them extend Row. Implement the toRow and fromRow methods and set the TABLE and ID_COLUMN constants. Call MyDB::configure() in your autoload.php file or wherever needed before database calls. You can now perform queries and get php objects back., (*6)

Installation

Composer

composer require wcatron/mysql-db-framework

Models & MDB

Models

Your classes. Add two functions and two constants and allow any model to create objects., (*7)

class Your Class extends Row {
    /** @var LinkedObject */
    var $linkedObject;

    const TABLE = "table";
    const ID_COLUMN = "table_id";

    function __construct() {
        $this->setObjectForKey(LinkedObjectClass::class, 'linked_id', 'linkedObject');
    }

    function toRow() {
        $row = parent::toRow();
        // ... Add your fields to the row.
        return $row;
    }

    function fromRow($row) {
        parent::fromRow($row);
        // ... Set your fields.
    }
}

Saving is extremely simple when you have an object whose class extends row., (*8)

$object->save();, (*9)

MyDB

Your connection to mysql. To get your rows as objects use this singleton MyDB::getInstance(), (*10)

getObjectByID(Class::class,$id), (*11)

Alternatively you can just call getByID($id) on your custom Row object., (*12)

This will return your exact object., (*13)

getObjectsWithQuery(Class::class,$query), (*14)

An array of objects based on a custom query. Not all queries need to be written out though., (*15)

getObjectByColumn(Class::class, 'ColumnName', $value), (*16)

If you're only searching by one column use this simple function., (*17)

The Versions

10/06 2016

dev-master

9999999-dev

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

10/06 2016

0.2.2

0.2.2.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

03/03 2016

0.2.1

0.2.1.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

26/02 2016

0.1.2

0.1.2.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

25/02 2016

0.1.1

0.1.1.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

25/02 2016

0.0.2

0.0.2.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based

25/02 2016

0.0.1

0.0.1.0

A MySQL ODM (assistant) extremely flexible for any project.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Weston Catron

mysql odm object based