felixge / debuggable-scraps
- Source
- Commits
- Network (10)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
Felix Geisendörfer (committer)
Tue Feb 09 01:18:27 -0800 2010
| name | age | message | |
|---|---|---|---|
| .. | |||
| |
lookupable.php | ||
| |
readme.textile | Sat Aug 30 05:15:00 -0700 2008 |
cakephp/behaviors/lookupable/readme.textile
CakePHP Lookupable Behavior
A CakePHP behavior to easily look up the id’s of records or create them if they do not exist yet. Useful when working with lots of lookup / status tables.
Installing
1. Copy lookupable.php to app/models/behaviors/
2. Open / create app/app_model.php and add the following:
class AppModel extends Model{
var $actsAs = array('Lookupable');
}
Usage / Docs
To lookup the id of lets say your ‘Admin’ group, you can simply do:
$group_id = $this->Group->lookup('Admin');
If the group does not exist yet, the behavior will automatically create it and return the id of the newly created record.
Known Bugs
None

