|
@@ -1238,6 +1238,20 @@ class PHP_CRUD_API {
|
1238
|
1238
|
return $object;
|
1239
|
1239
|
}
|
1240
|
1240
|
|
|
1241
|
+ protected function retrieveObjects($key,$fields,$filters,$tables) {
|
|
1242
|
+ $keyField = $key[1];
|
|
1243
|
+ $keys = explode(',',$key[0]);
|
|
1244
|
+ $rows = array();
|
|
1245
|
+ foreach ($keys as $key) {
|
|
1246
|
+ $result = $this->retrieveObject(array($key,$keyField),$fields,$filters,$tables);
|
|
1247
|
+ if ($result===null) {
|
|
1248
|
+ return null;
|
|
1249
|
+ }
|
|
1250
|
+ $rows[] = $result;
|
|
1251
|
+ }
|
|
1252
|
+ return $rows;
|
|
1253
|
+ }
|
|
1254
|
+
|
1241
|
1255
|
protected function createObject($input,$tables) {
|
1242
|
1256
|
if (!$input) return false;
|
1243
|
1257
|
$input = (array)$input;
|
|
@@ -1673,7 +1687,8 @@ class PHP_CRUD_API {
|
1673
|
1687
|
|
1674
|
1688
|
protected function readCommand($parameters) {
|
1675
|
1689
|
extract($parameters);
|
1676
|
|
- $object = $this->retrieveObject($key,$fields,$filters,$tables);
|
|
1690
|
+ if ($multi) $object = $this->retrieveObjects($key,$fields,$filters,$tables);
|
|
1691
|
+ else $object = $this->retrieveObject($key,$fields,$filters,$tables);
|
1677
|
1692
|
if (!$object) $this->exitWith404('object');
|
1678
|
1693
|
$this->startOutput();
|
1679
|
1694
|
echo json_encode($object);
|