Commit a28a05ef authored by François Agneray's avatar François Agneray
Browse files

#48 => done

parent 88fc0673
Pipeline #5103 passed with stages
in 2 minutes and 31 seconds
......@@ -14,11 +14,13 @@ namespace App\Action;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Doctrine\ORM\EntityManagerInterface;
use Slim\Exception\HttpNotFoundException;
use Slim\Exception\HttpBadRequestException;
use Nyholm\Psr7\Factory\Psr17Factory;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class AdminFileExplorerAction
{
/**
......
......@@ -17,6 +17,10 @@ use Psr\Http\Message\ResponseInterface as Response;
use Slim\Exception\HttpNotFoundException;
use App\Entity\Attribute;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class AttributeAction extends AbstractAction
{
/**
......@@ -61,6 +65,12 @@ final class AttributeAction extends AbstractAction
return $response;
}
/**
* Update attribute object with setters
*
* @param Attribute $attribute The attribute to update
* @param array $parsedBody Contains the new values ​​of the attribute sent by the user
*/
private function editAttribute(Attribute $attribute, array $parsedBody): void
{
$attribute->setLabel($parsedBody['label']);
......
......@@ -19,8 +19,15 @@ use Doctrine\ORM\EntityManagerInterface;
use App\Search\DBALConnectionFactory;
use PDO;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class AttributeDistinctAction extends AbstractAction
{
/**
* @var DBALConnectionFactory
*/
private $connectionFactory;
/**
......
......@@ -15,8 +15,11 @@ namespace App\Action;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Slim\Exception\HttpNotFoundException;
use App\Entity\Database;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class AttributeListAction extends AbstractAction
{
/**
......
......@@ -18,8 +18,23 @@ use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use App\Entity\CriteriaFamily;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class CriteriaFamilyAction extends AbstractAction
{
/**
* `GET` Returns the criteria family found
* `PUT` Full update the criteria family and returns the new version
* `DELETE` Delete the criteria family found and return a confirmation message
*
* @param ServerRequestInterface $request PSR-7 This object represents the HTTP request
* @param ResponseInterface $response PSR-7 This object represents the HTTP response
* @param string[] $args This table contains information transmitted in the URL (see routes.php)
*
* @return ResponseInterface
*/
public function __invoke(Request $request, Response $response, array $args): Response
{
if ($request->getMethod() === OPTIONS) {
......@@ -71,6 +86,12 @@ final class CriteriaFamilyAction extends AbstractAction
return $response;
}
/**
* Update criteria family object with setters
*
* @param CriteriaFamily $family The criteria family to update
* @param string[] $parsedBody Contains the new values ​​of the criteria family sent by the user
*/
private function editCriteriaFamily(CriteriaFamily $family, array $parsedBody): void
{
$family->setLabel($parsedBody['label']);
......
......@@ -19,6 +19,10 @@ use Slim\Exception\HttpNotFoundException;
use App\Entity\Dataset;
use App\Entity\CriteriaFamily;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class CriteriaFamilyListAction extends AbstractAction
{
/**
......@@ -74,6 +78,14 @@ final class CriteriaFamilyListAction extends AbstractAction
return $response;
}
/**
* Add a new criteria family into the metamodel
*
* @param array $parsedBody Contains the values ​​of the new criteria family sent by the user
* @param Dataset $dataset The dataset for adding the family
*
* @return CriteriaFamily
*/
private function postCriteriaFamily(array $parsedBody, Dataset $dataset): CriteriaFamily
{
$family = new CriteriaFamily($dataset);
......
......@@ -18,6 +18,10 @@ use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use App\Entity\Database;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatabaseAction extends AbstractAction
{
/**
......
......@@ -17,6 +17,10 @@ use Psr\Http\Message\ResponseInterface as Response;
use Slim\Exception\HttpBadRequestException;
use App\Entity\Database;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatabaseListAction extends AbstractAction
{
/**
......
......@@ -19,6 +19,10 @@ use Slim\Exception\HttpNotFoundException;
use App\Entity\Dataset;
use App\Entity\DatasetFamily;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetAction extends AbstractAction
{
/**
......
......@@ -18,8 +18,23 @@ use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use App\Entity\DatasetFamily;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetFamilyAction extends AbstractAction
{
/**
* `GET` Returns the dataset family found
* `PUT` Full update the dataset family and returns the new version
* `DELETE` Delete the dataset family found and return a confirmation message
*
* @param ServerRequestInterface $request PSR-7 This object represents the HTTP request
* @param ResponseInterface $response PSR-7 This object represents the HTTP response
* @param string[] $args This table contains information transmitted in the URL (see routes.php)
*
* @return ResponseInterface
*/
public function __invoke(Request $request, Response $response, array $args): Response
{
if ($request->getMethod() === OPTIONS) {
......@@ -71,6 +86,12 @@ final class DatasetFamilyAction extends AbstractAction
return $response;
}
/**
* Update dataset family object with setters
*
* @param DatasetFamily $family The dataset family to update
* @param array $parsedBody Contains the new values ​​of the dataset family sent by the user
*/
private function editDatasetFamily(DatasetFamily $family, array $parsedBody): void
{
$family->setLabel($parsedBody['label']);
......
......@@ -19,6 +19,10 @@ use Slim\Exception\HttpNotFoundException;
use App\Entity\Instance;
use App\Entity\DatasetFamily;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetFamilyListAction extends AbstractAction
{
/**
......@@ -74,6 +78,14 @@ final class DatasetFamilyListAction extends AbstractAction
return $response;
}
/**
* Add a new instance into the metamodel
*
* @param array $parsedBody Contains the values ​​of the new dataset family sent by the user
* @param Instance $instance The instance for adding the dataset family
*
* @return DatasetFamily
*/
private function postDatasetFamily(array $parsedBody, Instance $instance): DatasetFamily
{
$family = new DatasetFamily($instance);
......
......@@ -17,8 +17,11 @@ use Psr\Http\Message\ResponseInterface as Response;
use Doctrine\ORM\EntityManagerInterface;
use Slim\Exception\HttpNotFoundException;
use Slim\Exception\HttpBadRequestException;
use Nyholm\Psr7\Factory\Psr17Factory;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetFileExplorerAction extends AbstractAction
{
/**
......
......@@ -23,8 +23,15 @@ use App\Entity\DatasetFamily;
use App\Entity\Dataset;
use App\Entity\Attribute;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetListAction extends AbstractAction
{
/**
* @var DBALConnectionFactory
*/
private $connectionFactory;
/**
......
......@@ -17,6 +17,10 @@ use Psr\Http\Message\ResponseInterface as Response;
use Doctrine\ORM\EntityManagerInterface;
use Slim\Exception\HttpNotFoundException;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DatasetListByInstanceAction extends AbstractAction
{
/**
......
......@@ -18,6 +18,10 @@ use Doctrine\ORM\EntityManagerInterface;
use Slim\Exception\HttpNotFoundException;
use Nyholm\Psr7\Factory\Psr17Factory;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class DownloadFileAction extends AbstractAction
{
/**
......
......@@ -18,6 +18,10 @@ use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use App\Entity\Group;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class GroupAction extends AbstractAction
{
/**
......@@ -93,7 +97,14 @@ final class GroupAction extends AbstractAction
$this->em->flush();
}
private function getDatasets(array $listOfDatasetsNames)
/**
* Retrieves list of datasets by list of datasets names
*
* @param string[] $listOfDatasetsNames List of datasets names
*
* @return Dataset[] List of datasets found
*/
private function getDatasets(array $listOfDatasetsNames): array
{
if (count($listOfDatasetsNames) < 1) {
return array();
......
......@@ -19,6 +19,10 @@ use Slim\Exception\HttpBadRequestException;
use App\Entity\Instance;
use App\Entity\Group;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class GroupListAction extends AbstractAction
{
/**
......@@ -95,7 +99,14 @@ final class GroupListAction extends AbstractAction
return $group;
}
private function getDatasets(array $listOfDatasetsNames)
/**
* Retrieves list of datasets by list of datasets names
*
* @param string[] $listOfDatasetsNames List of datasets names
*
* @return Dataset[] List of datasets found
*/
private function getDatasets(array $listOfDatasetsNames): array
{
if (count($listOfDatasetsNames) < 1) {
return array();
......
......@@ -18,6 +18,10 @@ use Slim\Exception\HttpBadRequestException;
use Slim\Exception\HttpNotFoundException;
use App\Entity\Instance;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class InstanceAction extends AbstractAction
{
/**
......
......@@ -17,6 +17,10 @@ use Psr\Http\Message\ResponseInterface as Response;
use Slim\Exception\HttpBadRequestException;
use App\Entity\Instance;
/**
* @author François Agneray <francois.agneray@lam.fr>
* @package App\Action
*/
final class InstanceListAction extends AbstractAction
{
/**
......@@ -67,6 +71,8 @@ final class InstanceListAction extends AbstractAction
* Add a new instance into the metamodel
*
* @param array $parsedBody Contains the values ​​of the new instance sent by the user
*
* @return Instance
*/
private function postInstance(array $parsedBody): Instance
{
......
......@@ -79,6 +79,12 @@ final class OptionListAction extends AbstractAction
return $response;
}
/**
* @param Select $select Select on which the option is added
* @param array $parsedBody Contains the values ​​of the new option sent by the user
*
* @return Option
*/
private function postOption(Select $select, array $parsedBody): Option
{
$option = new Option($select);
......
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