src/Controller/API/OptionDataController.php line 51

Open in your IDE?
  1. <?php
  2. namespace App\Controller\API;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\RequestStack;
  8. use Pimcore\Translation\Translator;
  9. use App\Validator\Validator;
  10. use Pimcore\Model\DataObject\Provider;
  11. use Pimcore\Model\DataObject\Reviewer;
  12. use App\Services\ReviewerServices;
  13. use App\Helper\ObjectJson;
  14. use Pimcore\Model\DataObject\Review;
  15. use Pimcore\Model\DataObject\Request as ObjectRequest;
  16. use Knp\Component\Pager\PaginatorInterface;
  17. use Pimcore\Model\Asset\Service as AssetService;
  18. use Pimcore\Model\DataObject\Service as DataObjectService;
  19. use Pimcore\Tool\Admin;
  20. use Pimcore\Model\Asset;
  21. use Pimcore\Model\DataObject;
  22. use Pimcore\Model\DataObject\Solution;
  23. use Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\ListHelper;
  24. use Pimcore\Bundle\EcommerceFrameworkBundle\Factory;
  25. use Pimcore\Model\DataObject\Category;
  26. use Pimcore\Model\DataObject\FormRequest;
  27. use Pimcore\Model\DataObject\Pricing;
  28. /**
  29.  * @Route("/api")
  30.  */
  31. class OptionDataController extends BaseController
  32. {
  33.     const REVIEW_PAGE_DEFAULT 1;
  34.     const REVIEW_PERPAGE_DEFAULT 10;
  35.     private $request;
  36.     private $validator;
  37.     private $translator;
  38.     public function __construct(RequestStack $requestStackValidator $validatorTranslator $translator)
  39.     {
  40.         $this->request $requestStack->getCurrentRequest();
  41.         $this->validator $validator;
  42.         $this->translator $translator;
  43.     }
  44.     
  45.      /**
  46.      * @Route("/option-data", name="api-option-data", methods={"GET"})
  47.      */
  48.     public function Option(Request $request){
  49.         // 
  50.         $formRequest = new FormRequest;
  51.         $status DataObject\Service::getOptionsForSelectField($formRequest"status");
  52.         $i=0;
  53.         foreach($status as $key => $value){
  54.             $data['formRequest']['status'][$i]['name']=$value;
  55.             $data['formRequest']['status'][$i]['value']=$key;
  56.             $i++;
  57.         }
  58.         // Lấy các loại giá tiền
  59.         $pricing = new Pricing;
  60.         $currency DataObject\Service::getOptionsForSelectField($pricing"currency");
  61.         $data['currency']=$currency;
  62.         // Lấy các kiểu gói
  63.         $typepackage DataObject\Service::getOptionsForSelectField($pricing"typepackage");
  64.         $data['typePackage']=$typepackage;
  65.         // lấy option solution
  66.         $provider = new Provider;
  67.         $companySize DataObject\Service::getOptionsForSelectField($provider"companySize");
  68.         $data['provider']['companySize']=$companySize;
  69.         $yearOfOperation DataObject\Service::getOptionsForSelectField($provider"yearOfOperation");
  70.         $data['provider']['yearOfOperation']=$yearOfOperation;
  71.         $numberOfSolutions DataObject\Service::getOptionsForSelectField($provider"numberOfSolutions");
  72.         $data['provider']['numberOfSolutions']=$numberOfSolutions;
  73.         $sizeOfRevenue DataObject\Service::getOptionsForSelectField($provider"sizeOfRevenue");
  74.         $data['provider']['sizeOfRevenue']=$sizeOfRevenue;
  75.         $personnelSize DataObject\Service::getOptionsForSelectField($provider"personnelSize");
  76.         $data['provider']['personnelSize']=$personnelSize;
  77.         return $this->sendResponse($data);
  78.     }
  79. }