added internal rates (#1591)
This commit is contained in:
@@ -12,8 +12,11 @@ declare(strict_types=1);
|
||||
namespace App\API;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\ActivityRate;
|
||||
use App\Event\ActivityMetaDefinitionEvent;
|
||||
use App\Form\API\ActivityApiEditForm;
|
||||
use App\Form\API\ActivityRateApiForm;
|
||||
use App\Repository\ActivityRateRepository;
|
||||
use App\Repository\ActivityRepository;
|
||||
use App\Repository\Query\ActivityQuery;
|
||||
use App\Utils\SearchTerm;
|
||||
@@ -32,6 +35,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* @RouteResource("Activity")
|
||||
* @SWG\Tag(name="Activity")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
@@ -49,12 +53,17 @@ class ActivityController extends BaseApiController
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
/**
|
||||
* @var ActivityRateRepository
|
||||
*/
|
||||
private $activityRateRepository;
|
||||
|
||||
public function __construct(ViewHandlerInterface $viewHandler, ActivityRepository $repository, EventDispatcherInterface $dispatcher)
|
||||
public function __construct(ViewHandlerInterface $viewHandler, ActivityRepository $repository, EventDispatcherInterface $dispatcher, ActivityRateRepository $activityRateRepository)
|
||||
{
|
||||
$this->viewHandler = $viewHandler;
|
||||
$this->repository = $repository;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->activityRateRepository = $activityRateRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,7 +285,7 @@ class ActivityController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of a meta-field for an existing activity.
|
||||
* Sets the value of a meta-field for an existing activity
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
@@ -327,4 +336,166 @@ class ActivityController extends BaseApiController
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection of all rates for one activity
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns a collection of activity rate entities",
|
||||
* @SWG\Schema(
|
||||
* type="array",
|
||||
* @SWG\Items(ref="#/definitions/ActivityRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The activity whose rates will be returned",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function getRatesAction(int $id): Response
|
||||
{
|
||||
/** @var Activity|null $activity */
|
||||
$activity = $this->repository->find($id);
|
||||
|
||||
if (null === $activity) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $activity)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rates = $this->activityRateRepository->getRatesForActivity($activity);
|
||||
|
||||
$view = new View($rates, 200);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ActivityRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one rate for an activity
|
||||
*
|
||||
* @SWG\Delete(
|
||||
* @SWG\Response(
|
||||
* response=204,
|
||||
* description="Returns no content: 204 on successful delete"
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The activity whose rate will be removed",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="rateId",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The rate to remove",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function deleteRateAction(string $id, string $rateId): Response
|
||||
{
|
||||
/** @var Activity|null $activity */
|
||||
$activity = $this->repository->find($id);
|
||||
|
||||
if (null === $activity) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $activity)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
/** @var ActivityRate|null $rate */
|
||||
$rate = $this->activityRateRepository->find($rateId);
|
||||
|
||||
if (null === $rate || $rate->getActivity() !== $activity) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
$this->activityRateRepository->deleteRate($rate);
|
||||
|
||||
$view = new View(null, Response::HTTP_NO_CONTENT);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new rate to an activity
|
||||
*
|
||||
* @SWG\Post(
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns the new created rate",
|
||||
* @SWG\Schema(ref="#/definitions/ActivityRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The activity to add the rate for",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="body",
|
||||
* in="body",
|
||||
* required=true,
|
||||
* @SWG\Schema(ref="#/definitions/ActivityRateForm")
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function postRateAction(int $id, Request $request): Response
|
||||
{
|
||||
/** @var Activity|null $activity */
|
||||
$activity = $this->repository->find($id);
|
||||
|
||||
if (null === $activity) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $activity)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rate = new ActivityRate();
|
||||
$rate->setActivity($activity);
|
||||
|
||||
$form = $this->createForm(ActivityRateApiForm::class, $rate, [
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$form->setData($rate);
|
||||
$form->submit($request->request->all(), false);
|
||||
|
||||
if (false === $form->isValid()) {
|
||||
$view = new View($form, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ActivityRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
$this->activityRateRepository->saveRate($rate);
|
||||
|
||||
$view = new View($rate, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ActivityRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ use Swagger\Annotations as SWG;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @SWG\Tag(name="Default")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
final class ConfigurationController extends BaseApiController
|
||||
|
||||
@@ -12,9 +12,12 @@ declare(strict_types=1);
|
||||
namespace App\API;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerRate;
|
||||
use App\Entity\User;
|
||||
use App\Event\CustomerMetaDefinitionEvent;
|
||||
use App\Form\API\CustomerApiEditForm;
|
||||
use App\Form\API\CustomerRateApiForm;
|
||||
use App\Repository\CustomerRateRepository;
|
||||
use App\Repository\CustomerRepository;
|
||||
use App\Repository\Query\CustomerQuery;
|
||||
use App\Utils\SearchTerm;
|
||||
@@ -33,6 +36,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* @RouteResource("Customer")
|
||||
* @SWG\Tag(name="Customer")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
@@ -50,12 +54,17 @@ class CustomerController extends BaseApiController
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
private $dispatcher;
|
||||
/**
|
||||
* @var CustomerRateRepository
|
||||
*/
|
||||
private $customerRateRepository;
|
||||
|
||||
public function __construct(ViewHandlerInterface $viewHandler, CustomerRepository $repository, EventDispatcherInterface $dispatcher)
|
||||
public function __construct(ViewHandlerInterface $viewHandler, CustomerRepository $repository, EventDispatcherInterface $dispatcher, CustomerRateRepository $customerRateRepository)
|
||||
{
|
||||
$this->viewHandler = $viewHandler;
|
||||
$this->repository = $repository;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->customerRateRepository = $customerRateRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +75,7 @@ class CustomerController extends BaseApiController
|
||||
* description="Returns a collection of customer entities",
|
||||
* @SWG\Schema(
|
||||
* type="array",
|
||||
* @SWG\Items(ref="#/definitions/CustomerCollection")
|
||||
* @SWG\Items(ref="#/definitions/CustomerEntity")
|
||||
* )
|
||||
* )
|
||||
* @Rest\QueryParam(name="visible", requirements="\d+", strict=true, nullable=true, description="Visibility status to filter activities (1=visible, 2=hidden, 3=both)")
|
||||
@@ -249,7 +258,7 @@ class CustomerController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of a meta-field for an existing customer.
|
||||
* Sets the value of a meta-field for an existing customer
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
@@ -300,4 +309,166 @@ class CustomerController extends BaseApiController
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection of all rates for one customer
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns a collection of customer rate entities",
|
||||
* @SWG\Schema(
|
||||
* type="array",
|
||||
* @SWG\Items(ref="#/definitions/CustomerRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The customer whose rates will be returned",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function getRatesAction(int $id): Response
|
||||
{
|
||||
/** @var Customer|null $customer */
|
||||
$customer = $this->repository->find($id);
|
||||
|
||||
if (null === $customer) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $customer)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rates = $this->customerRateRepository->getRatesForCustomer($customer);
|
||||
|
||||
$view = new View($rates, 200);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'CustomerRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one rate for an customer
|
||||
*
|
||||
* @SWG\Delete(
|
||||
* @SWG\Response(
|
||||
* response=204,
|
||||
* description="Returns no content: 204 on successful delete"
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The customer whose rate will be removed",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="rateId",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The rate to remove",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function deleteRateAction(string $id, string $rateId): Response
|
||||
{
|
||||
/** @var Customer|null $customer */
|
||||
$customer = $this->repository->find($id);
|
||||
|
||||
if (null === $customer) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $customer)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
/** @var CustomerRate|null $rate */
|
||||
$rate = $this->customerRateRepository->find($rateId);
|
||||
|
||||
if (null === $rate || $rate->getCustomer() !== $customer) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
$this->customerRateRepository->deleteRate($rate);
|
||||
|
||||
$view = new View(null, Response::HTTP_NO_CONTENT);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new rate to a customer
|
||||
*
|
||||
* @SWG\Post(
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns the new created rate",
|
||||
* @SWG\Schema(ref="#/definitions/CustomerRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The customer to add the rate for",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="body",
|
||||
* in="body",
|
||||
* required=true,
|
||||
* @SWG\Schema(ref="#/definitions/CustomerRateForm")
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function postRateAction(int $id, Request $request): Response
|
||||
{
|
||||
/** @var Customer|null $customer */
|
||||
$customer = $this->repository->find($id);
|
||||
|
||||
if (null === $customer) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $customer)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rate = new CustomerRate();
|
||||
$rate->setCustomer($customer);
|
||||
|
||||
$form = $this->createForm(CustomerRateApiForm::class, $rate, [
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$form->setData($rate);
|
||||
$form->submit($request->request->all(), false);
|
||||
|
||||
if (false === $form->isValid()) {
|
||||
$view = new View($form, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'CustomerRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
$this->customerRateRepository->saveRate($rate);
|
||||
|
||||
$view = new View($rate, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'CustomerRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\API;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
use App\Entity\ProjectRate;
|
||||
use App\Entity\User;
|
||||
use App\Event\ProjectMetaDefinitionEvent;
|
||||
use App\Form\API\ProjectApiEditForm;
|
||||
use App\Form\API\ProjectRateApiForm;
|
||||
use App\Repository\ProjectRateRepository;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Repository\Query\ProjectQuery;
|
||||
use App\Timesheet\UserDateTimeFactory;
|
||||
@@ -35,6 +39,7 @@ use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* @RouteResource("Project")
|
||||
* @SWG\Tag(name="Project")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
@@ -56,13 +61,18 @@ class ProjectController extends BaseApiController
|
||||
* @var UserDateTimeFactory
|
||||
*/
|
||||
private $dateTime;
|
||||
/**
|
||||
* @var ProjectRateRepository
|
||||
*/
|
||||
private $projectRateRepository;
|
||||
|
||||
public function __construct(ViewHandlerInterface $viewHandler, ProjectRepository $repository, EventDispatcherInterface $dispatcher, UserDateTimeFactory $dateTime)
|
||||
public function __construct(ViewHandlerInterface $viewHandler, ProjectRepository $repository, EventDispatcherInterface $dispatcher, UserDateTimeFactory $dateTime, ProjectRateRepository $projectRateRepository)
|
||||
{
|
||||
$this->viewHandler = $viewHandler;
|
||||
$this->repository = $repository;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->dateTime = $dateTime;
|
||||
$this->projectRateRepository = $projectRateRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,7 +309,7 @@ class ProjectController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of a meta-field for an existing project.
|
||||
* Sets the value of a meta-field for an existing project
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
@@ -350,4 +360,166 @@ class ProjectController extends BaseApiController
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a collection of all rates for one project
|
||||
*
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns a collection of project rate entities",
|
||||
* @SWG\Schema(
|
||||
* type="array",
|
||||
* @SWG\Items(ref="#/definitions/ProjectRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The project whose rates will be returned",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function getRatesAction(int $id): Response
|
||||
{
|
||||
/** @var Project|null $project */
|
||||
$project = $this->repository->find($id);
|
||||
|
||||
if (null === $project) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $project)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rates = $this->projectRateRepository->getRatesForProject($project);
|
||||
|
||||
$view = new View($rates, 200);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ProjectRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one rate for an project
|
||||
*
|
||||
* @SWG\Delete(
|
||||
* @SWG\Response(
|
||||
* response=204,
|
||||
* description="Returns no content: 204 on successful delete"
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The project whose rate will be removed",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="rateId",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The rate to remove",
|
||||
* required=true,
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function deleteRateAction(string $id, string $rateId): Response
|
||||
{
|
||||
/** @var Project|null $project */
|
||||
$project = $this->repository->find($id);
|
||||
|
||||
if (null === $project) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $project)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
/** @var ProjectRate|null $rate */
|
||||
$rate = $this->projectRateRepository->find($rateId);
|
||||
|
||||
if (null === $rate || $rate->getProject() !== $project) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
$this->projectRateRepository->deleteRate($rate);
|
||||
|
||||
$view = new View(null, Response::HTTP_NO_CONTENT);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new rate to an project
|
||||
*
|
||||
* @SWG\Post(
|
||||
* @SWG\Response(
|
||||
* response=200,
|
||||
* description="Returns the new created rate",
|
||||
* @SWG\Schema(ref="#/definitions/ProjectRate")
|
||||
* )
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="id",
|
||||
* in="path",
|
||||
* type="integer",
|
||||
* description="The project to add the rate for",
|
||||
* required=true,
|
||||
* )
|
||||
* @SWG\Parameter(
|
||||
* name="body",
|
||||
* in="body",
|
||||
* required=true,
|
||||
* @SWG\Schema(ref="#/definitions/ProjectRateForm")
|
||||
* )
|
||||
*
|
||||
* @ApiSecurity(name="apiUser")
|
||||
* @ApiSecurity(name="apiToken")
|
||||
*/
|
||||
public function postRateAction(int $id, Request $request): Response
|
||||
{
|
||||
/** @var Project|null $project */
|
||||
$project = $this->repository->find($id);
|
||||
|
||||
if (null === $project) {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
if (!$this->isGranted('edit', $project)) {
|
||||
throw new AccessDeniedHttpException('Access denied.');
|
||||
}
|
||||
|
||||
$rate = new ProjectRate();
|
||||
$rate->setProject($project);
|
||||
|
||||
$form = $this->createForm(ProjectRateApiForm::class, $rate, [
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$form->setData($rate);
|
||||
$form->submit($request->request->all(), false);
|
||||
|
||||
if (false === $form->isValid()) {
|
||||
$view = new View($form, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ProjectRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
|
||||
$this->projectRateRepository->saveRate($rate);
|
||||
|
||||
$view = new View($rate, Response::HTTP_OK);
|
||||
$view->getContext()->setGroups(['Default', 'Entity', 'ProjectRate']);
|
||||
|
||||
return $this->viewHandler->handle($view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ use Nelmio\ApiDocBundle\Annotation\Security as ApiSecurity;
|
||||
use Swagger\Annotations as SWG;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @SWG\Tag(name="Default")
|
||||
*/
|
||||
class StatusController extends BaseApiController
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
|
||||
/**
|
||||
* @RouteResource("Tag")
|
||||
* @SWG\Tag(name="Tag")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
|
||||
/**
|
||||
* @RouteResource("Team")
|
||||
* @SWG\Tag(name="Team")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* @RouteResource("Timesheet")
|
||||
* @SWG\Tag(name="Timesheet")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
@@ -169,8 +170,9 @@ class TimesheetController extends BaseApiController
|
||||
if (!empty($customers)) {
|
||||
$query->setCustomers($customers);
|
||||
}
|
||||
} elseif (!empty($customer = $paramFetcher->get('customer'))) {
|
||||
@trigger_error('Timesheet API parameter "customer" is deprecated and will be removed with 2.0, use "customers" instead', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (!empty($customer = $paramFetcher->get('customer'))) {
|
||||
$query->addCustomer($customer);
|
||||
}
|
||||
|
||||
@@ -181,8 +183,9 @@ class TimesheetController extends BaseApiController
|
||||
if (!empty($projects)) {
|
||||
$query->setProjects($projects);
|
||||
}
|
||||
} elseif (!empty($project = $paramFetcher->get('project'))) {
|
||||
@trigger_error('Timesheet API parameter "project" is deprecated and will be removed with 2.0, use "projects" instead', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (!empty($project = $paramFetcher->get('project'))) {
|
||||
$query->addProject($project);
|
||||
}
|
||||
|
||||
@@ -193,8 +196,9 @@ class TimesheetController extends BaseApiController
|
||||
if (!empty($activities)) {
|
||||
$query->setActivities($activities);
|
||||
}
|
||||
} elseif (!empty($activity = $paramFetcher->get('activity'))) {
|
||||
@trigger_error('Timesheet API parameter "activity" is deprecated and will be removed with 2.0, use "activities" instead', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (!empty($activity = $paramFetcher->get('activity'))) {
|
||||
$query->addActivity($activity);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
|
||||
/**
|
||||
* @RouteResource("User")
|
||||
* @SWG\Tag(name="User")
|
||||
*
|
||||
* @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')")
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user