richardjh/rjhredbean

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v2.0) of this package.

RedbeanPHP ORM module for ZF2

v2.0 2013-05-22 21:28 UTC

README

RedbeanPHP ORM module for Zend Framework 2

Installation

Install using composer, for example

composer require richardjh/rjhredbean:dev-master 

and configure as a ZF2 module in config/application.config.php

'modules' => array(
    'Application',
    'richardjh\rjhredbean',
),

Configuration

Copy vendor/richardjh/rjhredbean/config/autoload/local.php.dist to config/autoload/rjhredbean.local.php and enter the database settings. You can find more information about this at http://www.redbeanphp.com/manual/compatible

Usage

To get a configured instance of Redbean to use in your controller, do it like this:

public function indexAction()
{
	$rb = $this->getServiceLocator()->get('RjhRedbean');
	$t = $rb->dispense("foo1");
	$t->when = time();
	$rb->store($t);
}

Alternatively to get a configured instance of Redbean into a Service or Model simple implement the RedbeanAwareInterface provided and and the RedbeanAwareInitializer will inject the Redbean instance for you.

Using newer versions of Redbean (>v3.5.1)

Versions of RedbeanPHP newer that v3.5.1 aren't published on packagist and therefore RjhRedbean cannot load them directly. There is a simple solution by editing the composer.json file in your own ZF2 project. Please read http://richardjh.org/blog/use-latest-redbean-rjhredbean.php for details on how to do this.