Skip to content
/ idiorm Public
forked from j4mie/idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

Notifications You must be signed in to change notification settings

burugo/idiorm

 
 

Repository files navigation

Idiorm

Build Status

http://j4mie.github.com/idiormandparis/

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

Tested on PHP 5.2.0+ - may work on earlier versions with PDO and the correct database drivers.

Released under a BSD license.

See Also: Paris, an Active Record implementation built on top of Idiorm.

Features

  • Makes simple queries and simple CRUD operations completely painless.
  • Gets out of the way when more complex SQL is required.
  • Built on top of PDO.
  • Uses prepared statements throughout to protect against SQL injection attacks.
  • Requires no model classes, no XML configuration and no code generation: works out of the box, given only a connection string.
  • Consists of one main class called ORM. Additional classes are prefixed with Idiorm. Minimal global namespace pollution.
  • Database agnostic. Currently supports SQLite, MySQL, Firebird and PostgreSQL. May support others, please give it a try!
  • Supports collections of models with method chaining to filter or apply actions to multiple results at once.
  • Multiple connections supported

Documentation

The documentation is hosted on Read the Docs: idiorm.rtfd.org

Building the Docs

You will need to install Sphinx and then in the docs folder run:

make html

The documentation will now be in docs/_build/html/index.html

Let's See Some Code

$user = ORM::for_table('user')
    ->where_equal('username', 'j4mie')
    ->find_one();

$user->first_name = 'Jamie';
$user->save();

$tweets = ORM::for_table('tweet')
    ->select('tweet.*')
    ->join('user', array(
        'user.id', '=', 'tweet.user_id'
    ))
    ->where_equal('user.username', 'j4mie')
    ->find_many();

foreach ($tweets as $tweet) {
    echo $tweet->text;
}

Changelog

1.3.0 - release 2013-01-31

  • Documentation moved to idiorm.rtfd.org and now built using Sphinx
  • Add support for multiple database connections - closes issue #15 [tag]
  • Add in raw_execute - closes issue #40 [tag]
  • Add get_last_statement() - closes issue #84 [tag]
  • Add HAVING clause functionality - closes issue #50
  • Add is_new method - closes issue #85
  • Add ArrayAccess support to the model instances allowing property access via $model['field'] as well as $model->field - issue #51
  • Add a result set object for collections of models that can support method chains to filter or apply actions to multiple results at once - issue #51 and #22
  • Add support for Firebird with ROWS and TO result set limiting and identifier quoting [mapner] - issue #98
  • Fix last insert ID for PostgreSQL using RETURNING - closes issues #62 and #89 [laacz]
  • Reset Idiorm after performing a query to allow for calling count() and then find_many() [fayland] - issue #97
  • Change Composer to use a classmap so that autoloading is better supported [javierd] - issue #96
  • Add query logging to delete_many [tag]
  • Fix when using set_expr alone it doesn't trigger query creation - closes issue #90
  • Escape quote symbols in "_quote_identifier_part" - close issue #74
  • Fix issue with aggregate functions always returning int when is float sometimes required - closes issue #92
  • Move testing into PHPUnit to unify method testing and query generation testing

1.2.3 - release 2012-11-28

  • Fix issue #78 - remove use of PHP 5.3 static call

1.2.2 - release 2012-11-15

  • Fix bug where input parameters were sent as part-indexed, part associative

1.2.1 - release 2012-11-15

  • Fix minor bug caused by IdiormStringException not extending Exception

1.2.0 - release 2012-11-14

  • Setup composer for installation via packagist (j4mie/idiorm)
  • Add order_by_expr method [sandermarechal]
  • Add support for raw queries without parameters argument [sandermarechal]
  • Add support to set multiple properties at once by passing an associative array to set method [sandermarechal]
  • Allow an associative array to be passed to configure method [jordanlev]
  • Patch to allow empty Paris models to be saved ([j4mie/paris]) - issue #58
  • Add select_many and select_many_expr - closing issues #49 and #69
  • Add support for MIN, AVG, MAX and SUM - closes issue #16
  • Add group_by_expr - closes issue #24
  • Add set_expr to allow database expressions to be set as ORM properties - closes issues #59 and #43 [brianherbert]
  • Prevent ambiguous column names when joining tables - issue #66 [hellogerard]
  • Add delete_many method [CBeerta]
  • Allow unsetting of ORM parameters [CBeerta]
  • Add find_array to get the records as associative arrays [Surt] - closes issue #17
  • Fix bug in _log_query with ? and % supplied in raw where statements etc. - closes issue #57 [ridgerunner]

1.1.1 - release 2011-01-30

  • Fix bug in quoting column wildcard. j4mie/paris#12
  • Small documentation improvements

1.1.0 - released 2011-01-24

  • Add is_dirty method
  • Add basic query caching
  • Add distinct method
  • Add group_by method

1.0.0 - released 2010-12-01

  • Initial release

About

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 90.0%
  • Python 6.1%
  • Shell 3.9%