2017 © Pedro Peláez
 

library alpha

Alpha is a micro-orm for Silex/Flex built on Doctrine DBAL

image

troisyaourts/alpha

Alpha is a micro-orm for Silex/Flex built on Doctrine DBAL

  • Wednesday, January 31, 2018
  • by troisyaourts
  • Repository
  • 0 Watchers
  • 0 Stars
  • 503 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 22 Versions
  • 18 % Grown

The README.md

Alpha ORM

Alpha ORM is a micro-ORM built on Doctrine DBAL specifically tailored for usage in the Silex micro-framework and Symfony Flex application., (*1)

Install

In your composer.json, add, (*2)

"troisyaourts/alpha": "dev-master"

to the list of requirements and then, (*3)

composer update

In your typical "app.php" add the following lines :, (*4)

$app->register(new Provider\DoctrineServiceProvider(), array('db.options' => $config['db.options']));
$app->register(new Alpha\ServiceProvider());

This will make the Alpha Manager available under "models" in your Controllers. The Alpha Manager use the main $app['db'] object., (*5)

Some examples of usage are provided in the "examples" directory., (*6)

To run some tests, clone the current release and do, (*7)

curl -s http://getcomposer.org/installer | php
php composer.phar install
php examples/test.php

Usage

Class file

In "Model" create a file "MyObject.php", (*8)

<?php
  namespace Model;
  use Alpha\Entity;
  use Alpha\Manager;

  class MyObject extends Entity
  {
    const TABLE_NAME = 'myobject';
    const PRIMARY = 'prim_id'; //optionnal, default is juste "id"

    public function getHelloFoo(){
      return "Hello ".$this->foo;
    }

    public static function getAllBarred(Manager $manager){
      $q = $manager->query()
                         ->where('bar = :bar')
                         ->setParameter("bar", 1);
      return $manager->fetchAll($q);
    }

  }
?>

Fetching a new object

get();
    ?>

Fetching a object by primary_id

get(12345);
    ?>

Fetching a list of object using a defined static function

getAllBarred();
      foreach($myobj_iterator as $prim_id => $obj)
        echo $obj->getHelloFoo();
    ?>

And append a new object to the list, (*9)

<?php 
  $lastItem = $app['models']('MyObject')->get(21);
  $myobj_iterator->append($lastItem);
  echo $myobj_iterator->end()->getHelloFoo();
?>

Saving an object

get();
      $myobj->bar = 1;
      $myobj->save();  //obj didn't exist : INSERT
      echo $myobj->id; //you can access to last_insert_id

      $myobj->foo = "Toto";
      $myobj->save(); //obj existed : UPDATE
    ?>

History

This project started in 2001, when Matthieu Duclos decided to build a web application for an email-based role-playing game called Ys. He wrote some files, including what would later become the alpha class, and called the result aobjet., (*10)

He was later rejoined by some other people, and with Nicolas B. and Julien Z. he continued to developp his work. A new version was made and called alpha, as it was the first brick of any other web application we built., (*11)

The project has evolved over age and this version is specifically tailored for performance when used in the Silex micro-framework., (*12)

The Versions

31/01 2018

dev-master

9999999-dev https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex/Flex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

31/01 2018

v0.5.0

0.5.0.0 https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

31/01 2018

v0.4.7

0.4.7.0 https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

26/10 2017

v0.4.6

0.4.6.0 https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

20/04 2017

v0.4.x-dev

0.4.9999999.9999999-dev https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

20/04 2017

v0.4.5

0.4.5.0 https://bitbucket.org/troisyaourts/alpha

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

20/09 2016

v0.4.4

0.4.4.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

27/07 2016

v0.4.3

0.4.3.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

27/07 2016

dev-v0.3-beta

dev-v0.3-beta

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

24/07 2015

v0.3.2

0.3.2.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

02/07 2015

v0.3.1

0.3.1.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

19/11 2014

v0.3.0-beta3

0.3.0.0-beta3

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

11/11 2014

v0.3.0-beta2

0.3.0.0-beta2

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

25/10 2014

v0.3.0-beta

0.3.0.0-beta

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

24/10 2014

v0.2.7

0.2.7.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

27/03 2014

v0.2.6

0.2.6.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

20/03 2014

v0.2.5

0.2.5.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

24/02 2014

v0.2.4

0.2.4.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

17/02 2014

v0.2.3

0.2.3.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

22/01 2014

v0.2.2

0.2.2.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

17/01 2014

v0.2

0.2.0.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr

13/12 2013

v0.1

0.1.0.0

Alpha is a micro-orm for Silex built on Doctrine DBAL

  Sources   Download

MIT

The Requires

 

by Ju Smwhr