/Model/PhotoRelationship.php
PHP | 36 lines | 25 code | 11 blank | 0 comment | 0 complexity | a94d277bcceb4c26c9d52b0a08282d4c MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1, GPL-3.0
- <?php
- class PhotoRelationship extends AppModel {
- function getCategories($photo_id) {
- $model = 'Category';
- $ids = $this->find('list', array(
- 'conditions' => compact('photo_id', 'model'),
- 'fields' => array('foreign_id')
- ));
- return ClassRegistry::init('Category')->find('list', array(
- 'conditions' => array('id' => $ids),
- 'fields' => array('id', 'name'),
- ));
- }
- function getActors($photo_id) {
- $model = 'Actor';
- $ids = $this->find('list', array(
- 'conditions' => compact('photo_id', 'model'),
- 'fields' => array('foreign_id')
- ));
- return ClassRegistry::init('Actor')->find('list', array(
- 'conditions' => array('id' => $ids),
- 'fields' => array('id', 'name'),
- ));
- }
- }