added internal rates (#1591)
This commit is contained in:
@@ -18,6 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* The abstract base controller.
|
||||
* @method null|User getUser()
|
||||
*/
|
||||
abstract class AbstractController extends BaseAbstractController implements ServiceSubscriberInterface
|
||||
{
|
||||
@@ -42,14 +43,6 @@ abstract class AbstractController extends BaseAbstractController implements Serv
|
||||
return $this->container->get('logger');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User|null
|
||||
*/
|
||||
protected function getUser()
|
||||
{
|
||||
return parent::getUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a "successful" flash message to the stack.
|
||||
*
|
||||
|
||||
@@ -134,25 +134,6 @@ final class ActivityController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate_delete/{rate}", name="admin_activity_rate_delete", methods={"GET"})
|
||||
* @Security("is_granted('edit', activity)")
|
||||
*/
|
||||
public function deleteRateAction(Activity $activity, ActivityRate $rate, ActivityRateRepository $repository)
|
||||
{
|
||||
if ($rate->getActivity() !== $activity) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => 'Invalid activity']);
|
||||
} else {
|
||||
try {
|
||||
$repository->deleteRate($rate);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('activity_details', ['id' => $activity->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate", name="admin_activity_rate_add", methods={"GET", "POST"})
|
||||
* @Security("is_granted('edit', activity)")
|
||||
|
||||
@@ -315,25 +315,6 @@ final class CustomerController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate_delete/{rate}", name="admin_customer_rate_delete", methods={"GET"})
|
||||
* @Security("is_granted('edit', customer)")
|
||||
*/
|
||||
public function deleteRateAction(Customer $customer, CustomerRate $rate, CustomerRateRepository $repository)
|
||||
{
|
||||
if ($rate->getCustomer() !== $customer) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => 'Invalid customer']);
|
||||
} else {
|
||||
try {
|
||||
$repository->deleteRate($rate);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate", name="admin_customer_rate_add", methods={"GET", "POST"})
|
||||
* @Security("is_granted('edit', customer)")
|
||||
|
||||
@@ -58,7 +58,6 @@ class ProfileController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/", name="fos_user_profile_show", methods={"GET"})
|
||||
* @Route(path="/", name="my_profile", methods={"GET"})
|
||||
*/
|
||||
public function profileAction()
|
||||
|
||||
@@ -314,25 +314,6 @@ final class ProjectController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate_delete/{rate}", name="admin_project_rate_delete", methods={"GET"})
|
||||
* @Security("is_granted('edit', project)")
|
||||
*/
|
||||
public function deleteRateAction(Project $project, ProjectRate $rate, ProjectRateRepository $repository)
|
||||
{
|
||||
if ($rate->getProject() !== $project) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => 'Invalid project']);
|
||||
} else {
|
||||
try {
|
||||
$repository->deleteRate($rate);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/rate", name="admin_project_rate_add", methods={"GET", "POST"})
|
||||
* @Security("is_granted('edit', project)")
|
||||
|
||||
Reference in New Issue
Block a user