An open API service indexing awesome lists of open source software.

https://github.com/havvg/uniquekeyinstancepoolingbehavior


https://github.com/havvg/uniquekeyinstancepoolingbehavior

php propel

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# UniqueKeyInstancePoolingBehavior

[![Build Status](https://secure.travis-ci.org/havvg/UniqueKeyInstancePoolingBehavior.png?branch=master)](http://travis-ci.org/havvg/UniqueKeyInstancePoolingBehavior)

See the Propel documentation on how to [install a third party behavior](http://propelorm.org/documentation/07-behaviors.html#using_thirdparty_behaviors)

## Usage

Just add the following XML tag in your `schema.xml` file:

```xml

```

For example:

```xml






```

The behavior will add two methods for each unique key:

1. A static key generator; from the example this would be `createUniquePoolingKeyForEmail`.
This method returns the key used when accessing the instances pool.

2. The `findOneByEmail` method will be actually implemented.
This method wraps the original method around instance pooling.

```php
findOneByEmail($email);

// .. more code ..

/*
* As this user is in the instances pool of the behavior,
* the cached object will be returned without accessing the database.
*/
$user = UserQuery::create()->findOneByEmail($email);
```