Commit 86aa0aeb authored by Georgios Tsakalos's avatar Georgios Tsakalos

fix bugs in software service

parent 771a9617
......@@ -31,7 +31,7 @@ class SoftwareService implements SoftwareServiceInterface
public function getSoftwareCategories()
{
$software_categories = R::findAll('softwarecategory');
return $software_categories;
return $this->exportAll($software_categories);
}
public function updateSoftwareCategory($id, $data)
......@@ -80,7 +80,7 @@ class SoftwareService implements SoftwareServiceInterface
public function getSoftwareBySchoolId($id)
{
$software = R::findAll('software', 'school_id = ?', [$id]);
return $software->exportAll();
return $this->exportAll($software);
}
public function getSoftwareByLabId($id)
......@@ -88,4 +88,14 @@ class SoftwareService implements SoftwareServiceInterface
$software = R::findAll('software', 'lab_id = ?', [$id]);
return $software->exportAll();
}
private function exportAll($beans)
{
$exported = [];
foreach($beans as $bean)
{
$exported[] = $bean->export();
}
return $exported;
}
}
......@@ -13,7 +13,7 @@ interface SoftwareServiceInterface
{
public function createSoftwareCategory($name);
public function getSoftwareCategoryById($id);
public function getSoftwareCagegories();
public function getSoftwareCategories();
public function updateSoftwareCategory($id, $data);
public function createSoftware(array $data);
public function updateSoftware(array $data, $id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment