https://github.com/loadsys/dynamicfind
CakePHP Dynamic Find Behavior
https://github.com/loadsys/dynamicfind
Last synced: about 1 year ago
JSON representation
CakePHP Dynamic Find Behavior
- Host: GitHub
- URL: https://github.com/loadsys/dynamicfind
- Owner: loadsys
- Created: 2011-05-12T02:39:35.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-09-06T00:59:11.000Z (over 14 years ago)
- Last Synced: 2025-01-09T03:14:49.126Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 105 KB
- Stars: 3
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic Find Behavior
## Installation
cd app/plugins
git clone git://github.com/joeytrapp/Dynamic-Find-Behavior.git dynamic_find
## Usage
This behavior allows you to use more convenience methods on your models. Methods like $this->ModelName->findNameById($id), where Name can be any field or virtual field in the database table, and Id can be any field or virtual field in the same table.
Multiple methods are available, but all can take a second parameter, which is an array of additions query information. You could pass in any of the keys you would pass into the Model::find() second parameter and they will merge with what the behavior creates.
The possible methods available are:
* findFieldNameByOtherField($condition);
* findListFieldNameByOtherField($condition);
* findAllFieldNameByOtherField($condition);
All of these methods can also be used by replacing the By with For if that makes the method name more readable.