Skip to content

Commit

Permalink
Removing reference to global $db in pudlOrm::collection
Browse files Browse the repository at this point in the history
  • Loading branch information
darkain committed Oct 15, 2018
1 parent c46b746 commit cfbc43c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pudlOrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ public static function collect(/* ...$selex */) {
////////////////////////////////////////////////////////////////////////////
//GET A COLLECTION OF OBJECTS FROM ID NUMBERS
////////////////////////////////////////////////////////////////////////////
public static function collection($items /*, ...$selex */) {
global $db; //TODO: REMOVE GLOBAL REFERENCE

public static function collection($db, $items /*, ...$selex */) {
$args = func_get_args();

if ($items instanceof pudlStringResult) {
Expand Down
4 changes: 2 additions & 2 deletions test/collection.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class test_orm extends pudlOrm {


$db->string();
test_orm::collection([1,2,3,4,5]);
test_orm::collection($db, [1,2,3,4,5]);
pudlTest($db, 'SELECT * FROM `pudl` WHERE (`id` IN (1, 2, 3, 4, 5))');



$db->string();
test_orm::collection([1,2,3,4,5], ['limit'=>[1,2]]);
test_orm::collection($db, [1,2,3,4,5], ['limit'=>[1,2]]);
pudlTest($db, 'SELECT * FROM `pudl` WHERE (`id` IN (1, 2, 3, 4, 5)) LIMIT 1 OFFSET 2');

0 comments on commit cfbc43c

Please sign in to comment.