<?php
namespace App\Controller\API;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RequestStack;
use Pimcore\Translation\Translator;
use App\Validator\Validator;
use Pimcore\Model\DataObject\Provider;
use Pimcore\Model\DataObject\Reviewer;
use App\Services\ReviewerServices;
use App\Helper\ObjectJson;
use Pimcore\Model\DataObject\Review;
use Pimcore\Model\DataObject\Request as ObjectRequest;
use Knp\Component\Pager\PaginatorInterface;
use Pimcore\Model\Asset\Service as AssetService;
use Pimcore\Model\DataObject\Service as DataObjectService;
use Pimcore\Tool\Admin;
use Pimcore\Model\Asset;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Solution;
use Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\ListHelper;
use Pimcore\Bundle\EcommerceFrameworkBundle\Factory;
use Pimcore\Model\DataObject\Category;
use Pimcore\Model\DataObject\FormRequest;
use Pimcore\Model\DataObject\Pricing;
/**
* @Route("/api")
*/
class OptionDataController extends BaseController
{
const REVIEW_PAGE_DEFAULT = 1;
const REVIEW_PERPAGE_DEFAULT = 10;
private $request;
private $validator;
private $translator;
public function __construct(RequestStack $requestStack, Validator $validator, Translator $translator)
{
$this->request = $requestStack->getCurrentRequest();
$this->validator = $validator;
$this->translator = $translator;
}
/**
* @Route("/option-data", name="api-option-data", methods={"GET"})
*/
public function Option(Request $request){
//
$formRequest = new FormRequest;
$status = DataObject\Service::getOptionsForSelectField($formRequest, "status");
$i=0;
foreach($status as $key => $value){
$data['formRequest']['status'][$i]['name']=$value;
$data['formRequest']['status'][$i]['value']=$key;
$i++;
}
// Lấy các loại giá tiền
$pricing = new Pricing;
$currency = DataObject\Service::getOptionsForSelectField($pricing, "currency");
$data['currency']=$currency;
// Lấy các kiểu gói
$typepackage = DataObject\Service::getOptionsForSelectField($pricing, "typepackage");
$data['typePackage']=$typepackage;
// lấy option solution
$provider = new Provider;
$companySize = DataObject\Service::getOptionsForSelectField($provider, "companySize");
$data['provider']['companySize']=$companySize;
$yearOfOperation = DataObject\Service::getOptionsForSelectField($provider, "yearOfOperation");
$data['provider']['yearOfOperation']=$yearOfOperation;
$numberOfSolutions = DataObject\Service::getOptionsForSelectField($provider, "numberOfSolutions");
$data['provider']['numberOfSolutions']=$numberOfSolutions;
$sizeOfRevenue = DataObject\Service::getOptionsForSelectField($provider, "sizeOfRevenue");
$data['provider']['sizeOfRevenue']=$sizeOfRevenue;
$personnelSize = DataObject\Service::getOptionsForSelectField($provider, "personnelSize");
$data['provider']['personnelSize']=$personnelSize;
return $this->sendResponse($data);
}
}