creation api endpoint. Route found, but ajax call still needs to be tested

This commit is contained in:
2021-09-01 14:33:31 +02:00
parent 8182e35c9c
commit f41997e6da
3 changed files with 72 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
use Symfony\Component\HttpFoundation\Request;
/**
* This is the class that loads and manages your bundle configuration.
@@ -47,11 +48,34 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
{
//declare routes for 3party bundle
$container->prependExtensionConfig('chill_main', array(
'routing' => array(
'routing' => [
'resources' => array(
'@ChillThirdPartyBundle/config/routes.yaml'
)
)
],
'apis' => [
[
'class' => \Chill\ThirdPartyBundle\Entity\ThirdParty::class,
'name' => 'thirdparty',
'base_path' => '/api/1.0/thirdparty/thirdparty',
'base_role' => \Chill\ThirdPartyBundle\Security\Authorization\ThirdPartyVoter::class,
'actions' => [
'_entity' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true,
Request::METHOD_POST=> true,
],
'roles' => [
Request::METHOD_GET => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
Request::METHOD_HEAD => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
Request::METHOD_POST => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
],
]
]
]
],
));
}