mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
complete missing annotations
This commit is contained in:
parent
0b8a22ae46
commit
01e93f7ba3
@ -25,8 +25,9 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Class CRUDDeleteEntityForm
|
||||
*
|
||||
* @package Chill\MainBundle\CRUD\Form
|
||||
*/
|
||||
class CRUDDeleteEntityForm extends AbstractType
|
||||
{
|
||||
|
@ -24,25 +24,23 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class Resolver
|
||||
*
|
||||
* @package Chill\MainBundle\CRUD\Resolver
|
||||
*/
|
||||
class Resolver
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Symfony\Component\PropertyAccess\PropertyAccessor
|
||||
*/
|
||||
protected $propertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $crudConfig;
|
||||
@ -62,6 +60,12 @@ class Resolver
|
||||
*/
|
||||
const ROLE = 'role';
|
||||
|
||||
/**
|
||||
* Resolver constructor.
|
||||
*
|
||||
* @param EntityManagerInterface $em
|
||||
* @param array $crudConfig
|
||||
*/
|
||||
function __construct(EntityManagerInterface $em, array $crudConfig)
|
||||
{
|
||||
$this->em = $em;
|
||||
@ -71,6 +75,12 @@ class Resolver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $crudName
|
||||
* @param null $action
|
||||
* @return string
|
||||
*/
|
||||
public function getConfigValue($key, $crudName, $action = null)
|
||||
{
|
||||
$config = $this->crudConfig[$crudName];
|
||||
@ -81,6 +91,11 @@ class Resolver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $crudName
|
||||
* @param $action
|
||||
* @return string
|
||||
*/
|
||||
public function buildDefaultRole($crudName, $action)
|
||||
{
|
||||
if (empty($this->crudConfig[$crudName]['base_role'])) {
|
||||
@ -94,9 +109,14 @@ class Resolver
|
||||
$action);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $crudName
|
||||
* @param $action
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAction($crudName, $action)
|
||||
{
|
||||
return \array_key_exists($action,
|
||||
return \array_key_exists($action,
|
||||
$this->crudConfig[$crudName]['actions']);
|
||||
}
|
||||
}
|
||||
|
@ -27,22 +27,31 @@ use Twig\Extension\AbstractExtension;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Class TwigCRUDResolver
|
||||
* Twig filters to display data in crud template
|
||||
*
|
||||
* @package Chill\MainBundle\CRUD\Templating
|
||||
*/
|
||||
class TwigCRUDResolver extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var Resolver
|
||||
*/
|
||||
protected $resolver;
|
||||
|
||||
/**
|
||||
* TwigCRUDResolver constructor.
|
||||
*
|
||||
* @param Resolver $resolver
|
||||
*/
|
||||
function __construct(Resolver $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|TwigFunction[]
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
@ -53,11 +62,22 @@ class TwigCRUDResolver extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $configKey
|
||||
* @param $crudName
|
||||
* @param null $action
|
||||
* @return string
|
||||
*/
|
||||
public function getConfig($configKey, $crudName, $action = null)
|
||||
{
|
||||
return $this->resolver->getConfigValue($configKey, $crudName, $action);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $crudName
|
||||
* @param $action
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAction($crudName, $action)
|
||||
{
|
||||
return $this->resolver->hasAction($crudName, $action);
|
||||
|
@ -37,7 +37,10 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
use Chill\MainBundle\Doctrine\DQL\Replace;
|
||||
|
||||
/**
|
||||
* Class ChillMainExtension
|
||||
* This class load config for chillMainExtension.
|
||||
*
|
||||
* @package Chill\MainBundle\DependencyInjection
|
||||
*/
|
||||
class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
Widget\HasWidgetFactoriesExtensionInterface
|
||||
@ -49,13 +52,15 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
*/
|
||||
protected $widgetFactories = array();
|
||||
|
||||
/**
|
||||
* @param WidgetFactoryInterface $factory
|
||||
*/
|
||||
public function addWidgetFactory(WidgetFactoryInterface $factory)
|
||||
{
|
||||
$this->widgetFactories[] = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return WidgetFactoryInterface[]
|
||||
*/
|
||||
public function getWidgetFactories()
|
||||
@ -65,6 +70,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @param array $configs
|
||||
* @param ContainerBuilder $container
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
@ -122,16 +130,23 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
$loader->load('services/templating.yaml');
|
||||
$loader->load('services/timeline.yaml');
|
||||
$loader->load('services/search.yaml');
|
||||
|
||||
|
||||
$this->configureCruds($container, $config['cruds'], $loader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
* @param ContainerBuilder $container
|
||||
* @return \Chill\MainBundle\DependencyInjection\Configuration|null|object|\Symfony\Component\Config\Definition\ConfigurationInterface
|
||||
*/
|
||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||
{
|
||||
return new Configuration($this->widgetFactories, $container);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
//add installation_name and date_format to globals
|
||||
@ -193,7 +208,6 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
* @param array $config the config under 'cruds' key
|
||||
* @return null
|
||||
|
Loading…
x
Reference in New Issue
Block a user