mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add API endpoints for Address and AddressReference (again)
This commit is contained in:
parent
a63c38b6aa
commit
c1b727b1c8
@ -35,6 +35,7 @@ use Chill\MainBundle\Doctrine\DQL\OverlapsI;
|
|||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Chill\MainBundle\Doctrine\DQL\Replace;
|
use Chill\MainBundle\Doctrine\DQL\Replace;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ChillMainExtension
|
* Class ChillMainExtension
|
||||||
@ -212,6 +213,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
$container->prependExtensionConfig('monolog', array(
|
$container->prependExtensionConfig('monolog', array(
|
||||||
'channels' => array('chill')
|
'channels' => array('chill')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
//add crud api
|
||||||
|
$this->prependCruds($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -235,4 +239,57 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
|
|
||||||
// Note: the controller are loaded inside compiler pass
|
// Note: the controller are loaded inside compiler pass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContainerBuilder $container
|
||||||
|
*/
|
||||||
|
protected function prependCruds(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$container->prependExtensionConfig('chill_main', [
|
||||||
|
'apis' => [
|
||||||
|
[
|
||||||
|
'class' => \Chill\MainBundle\Entity\Address::class,
|
||||||
|
'name' => 'address',
|
||||||
|
'base_path' => '/api/1.0/main/address',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_POST => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\MainBundle\Entity\AddressReference::class,
|
||||||
|
'name' => 'address_reference',
|
||||||
|
'base_path' => '/api/1.0/main/address-reference',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Entity;
|
namespace Chill\MainBundle\Entity;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\AddressReferenceRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Chill\MainBundle\Doctrine\Model\Point;
|
use Chill\MainBundle\Doctrine\Model\Point;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity(repositoryClass=AddressReferenceRepository::class)
|
* @ORM\Entity()
|
||||||
* @ORM\Table(name="chill_main_address_reference")
|
* @ORM\Table(name="chill_main_address_reference")
|
||||||
* @ORM\HasLifecycleCallbacks()
|
* @ORM\HasLifecycleCallbacks()
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user