2017 © Pedro Peláez
 

library orm

PHP ORM for working with MySQL

image

berie/orm

PHP ORM for working with MySQL

  • Thursday, October 22, 2015
  • by emelnychenko
  • Repository
  • 1 Watchers
  • 1 Stars
  • 190 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 9 % Grown

The README.md

PHP MySQL ORM (composer install, zend2)

Composer Package:

execute: php composer.phar require berie/orm, (*1)

information: https://packagist.org/packages/berie/orm, (*2)

Cookbook:

$config = [
    'unix_socket' => 'path/to/unix',
    'host'        => 'localhost(127.0.0.1)',
    'username'    => 'root',
    'password'    => 'root',
    'dbname'      => 'root',
    'charset'     => 'utf8',
];

runQuery() - self execute mysql request.

$orm = new \Berie\ORM($config);
$orm->runQuery("SELECT * FROM `foo`");
$orm->runQuery("DELETE FROM `foo` WHERE `id`='100'");

getBuilder() - simple way to build query and execute.

$orm = new \Berie\ORM($config);

getBuilder()->insert(), (*3)

$orm->getBuilder()
    ->insert('foo_table')
    ->set([
        'id' => 12,
        'di' => 'bar',
        'dd' => 'open',
    ])
    ->set('city', 'CA')
    ->getQuery();

getBuilder()->update(), (*4)

$orm->getBuilder()
    ->update('foo_table')
    ->set('id', 23)
    ->set('city', 'LA')
    ->where('id', 12)
    ->getQuery();

getBuilder()->delete(), (*5)

$orm->getBuilder()
    ->delete()
    ->from('foo_table')
    ->where('`id` IN (3,4,5) OR `city` LIKE "%CA%"')
    ->getQuery();

getBuilder()->select(), (*6)

$select = $orm->getBuilder()
    ->select([`id`, `name`, `city`])
    ->from('foo_table')
    ->where('`id`=1 AND `name`=2');

getBuilder()->select()->...->getArray(), (*7)

$select->getArray();

getBuilder()->select()->...->getEntity(), (*8)

$select->getEntity();

getBuilder()->select()->...->getCount(), (*9)

$select->getCount();

getManager() - simple way to build query and execute.

getManager()->__construct(), (*10)

$orm = new \Berie\ORM($config);
$manager = $orm->getManager('foo_table');

getManager()->find(), (*11)

$entity = $orm->getManager('foo_table')
    ->find($id = 43);

getManager()->findAll(), (*12)

$entity = $orm->getManager('foo_table')
    ->findAll();

getManager()->findBy() AND getManager()->findOneBy(), (*13)

$entity = $orm->getManager('foo_table')
    ->findOneBy(['name' => 'foo']);
$entity = $orm->getManager('foo_table')
    ->findBy(['city' => 'CA']);


**save() AND remove()**
$entity = $orm->getManager('foo_table') ->find([33]); $entity->setData([ 'name' => 'fooBar', 'city' => 'SF', 'email' => 'mail@email.com', ]); $orm->save($entity);
$entities = $orm->getManager('foo_table')
    ->findAll();

foreach($entities as $entity) {
    $orm->remove($entity);
}

The Versions

22/10 2015

dev-master

9999999-dev

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

22/10 2015

0.5.1

0.5.1.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

20/10 2015

0.5

0.5.0.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

19/10 2015

0.4

0.4.0.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

18/10 2015

0.3

0.3.0.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

13/10 2015

dev-eugen.melnychenko

dev-eugen.melnychenko

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

13/10 2015

0.2

0.2.0.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0

 

13/10 2015

0.1

0.1.0.0

PHP ORM for working with MySQL

  Sources   Download

The Requires

  • php >=5.3.0