https://github.com/havvg/uniquekeyinstancepoolingbehavior
https://github.com/havvg/uniquekeyinstancepoolingbehavior
php propel
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/havvg/uniquekeyinstancepoolingbehavior
- Owner: havvg
- License: mit
- Created: 2013-01-31T13:36:01.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-05T10:06:01.000Z (about 12 years ago)
- Last Synced: 2025-01-25T12:07:59.768Z (4 months ago)
- Topics: php, propel
- Language: PHP
- Size: 121 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UniqueKeyInstancePoolingBehavior
[](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);
```