2017 © Pedro Peláez
 

library ormbase

ORM Basic Libraries

image

ecsco/ormbase

ORM Basic Libraries

  • Tuesday, January 6, 2015
  • by Adar99
  • Repository
  • 0 Watchers
  • 0 Stars
  • 92 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

ORMBASE - Simple ORM Basic Libraries

About

ORMBASE is an easy-to-use PSR-4 compliant class set for PHP. It is designed as basic for ORM based projects and comes with some examples, caching and a Database-Abstraction-Layer which provides access to (for now) Mysql and MongoDB., (*1)

Installation

Composer

From the Command Line:, (*2)

composer require ecsco/ormbase:dev-master

In your composer.json:, (*3)

``` json { "require": { "ecsco/ormbase": "dev-master" } }, (*4)


## Basic Usage ``` php <?php require 'vendor/autoload.php'; /** Init config **/ $config = \ecsco\ormbase\config\Config::getInstance(); $config->addItem('database', 'server', 'localhost'); $config->addItem('database', 'port', '3306'); $config->addItem('database', 'username', 'my_user'); $config->addItem('database', 'password', 'my_pass'); $config->addItem('database', 'dbname', 'server_v4'); $config->addItem('database', 'databaseclass', '\ecsco\ormbase\database\mysql\Database'); $config->addItem('database', 'debugsql', '1'); /** If memcached available **/ $config->addItem('cache', 'cacheclass', '\ecsco\ormbase\cache\memcached\Cache'); $config->addItem('cache', 'server', '127.0.0.1'); $config->addItem('cache', 'port', '11211'); class TableNameContainer extends \ecsco\ormbase\AbstractContainer { const OBJECT_NAME = 'TableClassName'; const TABLE_NAME = TableClassName::TABLE_NAME; protected $basicFields = [ 'id' ]; use \ecsco\ormbase\traits\SingletonTrait; public function createNew( ): ecsco\ormbase\AbstractObject { $obj = parent::createNew(); /** more code **/ return $obj; } public function getTableNameByID( $id, \ecsco\ormbase\database\FieldSelection $selector = null ) { $sql = $this->getDatabase()->select( $selector )->from( self::TABLE_NAME )->where( 'id', '=', (int)$id )->limit( 1 ); $params = $sql->getQueryParams(); /** make ONE object **/ $result = $this->makePreparedObject( $sql, self::OBJECT_NAME, ...$params ); return $result; } } class TableClassName extends \ecsco\ormbase\AbstractObject implements \ecsco\ormbase\CachableInterface { const TABLE_NAME = 'TableName'; protected $primaryKeys = [ 'id' ]; protected $hiddenFields = [ ]; public static function getCacheIdentifier(): string { return 'cacheNameForThisEntity'; } } /** Clear first. Just for demonstrating how to get a database-connection **/ $db = \ecsco\ormbase\database\DatabaseAccess::getDatabaseInstance( $config ); $db->query ( $db->delete()->from( \Customer::TABLE_NAME ) ); /** Get the container **/ $cc = TableNameContainer::getInstance(); /** Create a new object based on the table **/ $newEntity = $cc->createNew(); $newEntity->setValue('keyname1', 'value1'); $newEntity->setValue('keyname2', 'value2'); /** .... */ $newEntity->store(); /** Get one object (aka row) with id 1 **/ $entityWithIDOne = $cc->getTableNameByID( 1 ); $entityWithIDOne->setValue('key_name_in_table1', 'foobar'); $entityWithIDOne->store(); print_r( $entityWithIDOne->toArray() ); /** ... **/

Why use ORMBASE?

It's simple, easy-to-use and extremely small with a huge amount of components., (*5)

Who uses ORMBASE?

Me ;-), (*6)

License

Proprietary, (*7)

Copyright (c) 2015 Christian Senkowski cs@e-cs.co, (*8)

You may use the classes for testing and personal use only., (*9)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*10)

The Versions

06/01 2015

dev-master

9999999-dev http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

dev-develop

dev-develop http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

dev-mongodb-dev

dev-mongodb-dev http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.1

0.1.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.2

0.2.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.3

0.3.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.4

0.4.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.5

0.5.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.6

0.6.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.7

0.7.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.8

0.8.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9

0.9.0.0 http://e-cs.co

WebPlatz Major Libs

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.1

0.9.1.0 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.2

0.9.2.0 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.3

0.9.3.0 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.4

0.9.4.0 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.4.1

0.9.4.1 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.5

0.9.5.0 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski

06/01 2015

v0.9.5.1

0.9.5.1 http://e-cs.co

ORM Basic Libraries

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Christian Senkowski