public function getAll($startIndex = 0, $search = null, $routeId = null) { $condition = new Condition(); if (!empty($search)) { $condition->like('name', '%' . $search . '%'); } if (!empty($routeId)) { $sql = 'SELECT actionId FROM fusio_routes_action WHERE routeId = ?'; $condition->raw('id IN (' . $sql . ')', [$routeId]); } return new ResultSet($this->actionTable->getCount($condition), $startIndex, 16, $this->actionTable->getAll($startIndex, 16, 'id', Sql::SORT_DESC, $condition, Fields::blacklist(['class', 'config']))); }
/** * Returns the GET response * * @param \PSX\Api\Version $version * @return array|\PSX\Data\RecordInterface */ protected function doGet(Version $version) { $startIndex = $this->getParameter('startIndex', Validate::TYPE_INTEGER) ?: 0; $search = $this->getParameter('search', Validate::TYPE_STRING) ?: null; $routeId = $this->getParameter('routeId', Validate::TYPE_INTEGER) ?: null; $condition = new Condition(); if (!empty($search)) { $condition->like('name', '%' . $search . '%'); } if (!empty($routeId)) { $sql = 'SELECT actionId FROM fusio_routes_action WHERE routeId = ?'; $condition->raw('id IN (' . $sql . ')', [$routeId]); } $table = $this->tableManager->getTable('Fusio\\Impl\\Backend\\Table\\Action'); $table->setRestrictedFields(['class', 'config']); return array('totalItems' => $table->getCount($condition), 'startIndex' => $startIndex, 'entry' => $table->getAll($startIndex, null, 'id', Sql::SORT_DESC, $condition)); }