mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-17 14:45:06 -05:00
Use fetchAll directly on the connection and bind parameters using ?
This commit is contained in:
parent
56071a0c81
commit
8c2d368cbf
@ -12,11 +12,9 @@ class EntryRepository
|
|||||||
|
|
||||||
//TODO don't hardcode the user ;)
|
//TODO don't hardcode the user ;)
|
||||||
public function getEntries($userId = 1) {
|
public function getEntries($userId = 1) {
|
||||||
$sql = "SELECT * FROM entries where user_id = :userId";
|
$sql = "SELECT * FROM entries where user_id = ?";
|
||||||
$stmt = $this->db->prepare($sql);
|
$entries = $this->db->fetchAll($sql, array($userId));
|
||||||
$stmt->bindValue('userId', $userId);
|
return $entries ? $entries : array();
|
||||||
$entries = $stmt->fetchAll();
|
|
||||||
return $entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO don't hardcode the user ;)
|
//TODO don't hardcode the user ;)
|
||||||
|
@ -19,7 +19,7 @@ class ApiTest extends PocheWebTestCase
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($client->getResponse()->getContent(), '[]');
|
$this->assertEquals('[]', $client->getResponse()->getContent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class ApiTest extends PocheWebTestCase
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($client->getResponse()->getContent(),'{"id":"1","url":"http:\/\/deboutlesgens.com\/blog\/le-courage-de-vivre-consciemment\/","title":"Le courage de vivre consciemment","content":"Test content","updated":null,"status":null,"bookmark":"0","fetched":"1","user_id":"1"}');
|
$this->assertEquals('[{"id":"1","url":"http:\/\/deboutlesgens.com\/blog\/le-courage-de-vivre-consciemment\/","title":"Le courage de vivre consciemment","content":"Test content","updated":null,"status":null,"bookmark":"0","fetched":"1","user_id":"1"}]', $client->getResponse()->getContent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user