function getAllObjects() { $store = new BookStore(); $store->orderBy('storeName'); $store->find(); $list = array(); while ($store->fetch()) { $list[$store->id] = clone $store; } return $list; }
static function getBookStores($libraryId) { $store = new BookStore(); if ($libraryId == -1) { $store->orderBy('weight'); } else { $store->query("SELECT {$store->__table}.* FROM {$store->__table} " . "INNER JOIN nearby_book_store ON ({$store->__table}.id=nearby_book_store.storeId) " . "WHERE libraryId={$libraryId} " . "ORDER BY weight"); } $list = array(); while ($store->fetch()) { $list[] = clone $store; } if (count($list) == 0) { $list = NearbyBookStore::getDefaultBookStores(); } return $list; }