@@ -16,9 +16,9 @@ |
||
| 16 | 16 | $configuration = new Configuration(); |
| 17 | 17 | $config = $this->processConfiguration($configuration, $configs); |
| 18 | 18 | |
| 19 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 19 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 20 | 20 | $loader->load('services.xml'); |
| 21 | - $ymlLoader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 21 | + $ymlLoader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 22 | 22 | $ymlLoader->load('data_grid.yml'); |
| 23 | 23 | |
| 24 | 24 | $container->getDefinition('data_grid.configuration') |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $this->container = $container; |
| 28 | 28 | foreach ($config as $key => $value) { |
| 29 | - $setter = 'set' . ucfirst($key); |
|
| 29 | + $setter = 'set'.ucfirst($key); |
|
| 30 | 30 | if (method_exists($this, $setter)) { |
| 31 | 31 | $this->$setter($value); |
| 32 | 32 | } |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | { |
| 52 | 52 | $manager = $this->container['doctrine']->getRepository($this->entityClass); |
| 53 | 53 | $queryResult = $manager->createQueryBuilder('dgq') |
| 54 | - ->select(['dgq.id', 'dgq.' . $this->label])->orderBy('dgq.id')->getQuery()->getArrayResult(); |
|
| 54 | + ->select(['dgq.id', 'dgq.'.$this->label])->orderBy('dgq.id')->getQuery()->getArrayResult(); |
|
| 55 | 55 | $choices = []; |
| 56 | - array_walk($queryResult, function ($val) use (&$choices) { |
|
| 56 | + array_walk($queryResult, function($val) use (&$choices) { |
|
| 57 | 57 | $choices[$val['id']] = $val[$this->label]; |
| 58 | 58 | }); |
| 59 | 59 | return [ |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | protected function setConfiguration($config) |
| 44 | 44 | { |
| 45 | 45 | foreach ($config as $key => $value) { |
| 46 | - $setter = 'set' . ucfirst($key); |
|
| 46 | + $setter = 'set'.ucfirst($key); |
|
| 47 | 47 | if (method_exists($this, $setter)) { |
| 48 | 48 | $this->$setter($value); |
| 49 | 49 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __construct(array $config) |
| 18 | 18 | { |
| 19 | 19 | foreach ($config as $key => $value) { |
| 20 | - $setter = 'set' . ucfirst($key); |
|
| 20 | + $setter = 'set'.ucfirst($key); |
|
| 21 | 21 | if (method_exists($this, $setter)) { |
| 22 | 22 | $this->$setter($value); |
| 23 | 23 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $this->container = $container; |
| 47 | 47 | foreach ($this->container as $key => $value) { |
| 48 | - $setter = 'set' . ucfirst($key); |
|
| 48 | + $setter = 'set'.ucfirst($key); |
|
| 49 | 49 | if (method_exists($this, $setter)) { |
| 50 | 50 | $this->$setter($value); |
| 51 | 51 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->filterBuilder = new DataGridFiltersBuilder(); |
| 58 | 58 | |
| 59 | 59 | foreach ($configs->getConfigs() as $key => $value) { |
| 60 | - $setter = 'setDefault' . ucfirst($key); |
|
| 60 | + $setter = 'setDefault'.ucfirst($key); |
|
| 61 | 61 | if (method_exists($this, $setter)) { |
| 62 | 62 | $this->$setter($value); |
| 63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function createGrid(string $gridType, $dataProvider): DataGrid |
| 69 | 69 | { |
| 70 | 70 | if (!is_subclass_of($gridType, AbstractGridType::class)) { |
| 71 | - throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class); |
|
| 71 | + throw new InvalidArgumentException('Expected subclass of '.AbstractGridType::class); |
|
| 72 | 72 | } |
| 73 | 73 | $provider = DataProvider::create($dataProvider, $this->container['doctrine']->getManager()); |
| 74 | 74 | $this->gridBuilder->setProvider($provider); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | if (!isset($cacheKeyInfo['isScalar'])) { |
| 54 | 54 | $dqlAlias = $cacheKeyInfo['dqlAlias']; |
| 55 | 55 | $type = $cacheKeyInfo['type']; |
| 56 | - $fieldName = $dqlAlias . $this->getFieldSeparator() . $fieldName; |
|
| 56 | + $fieldName = $dqlAlias.$this->getFieldSeparator().$fieldName; |
|
| 57 | 57 | $value = $type |
| 58 | 58 | ? $type->convertToPHPValue($value, $this->_platform) |
| 59 | 59 | : $value; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function has($name) |
| 50 | 50 | { |
| 51 | 51 | if ($this->entity !== null) { |
| 52 | - return method_exists($this->entity, 'get' . ucfirst($name)); |
|
| 52 | + return method_exists($this->entity, 'get'.ucfirst($name)); |
|
| 53 | 53 | } |
| 54 | 54 | if ($this->row !== null) { |
| 55 | 55 | return array_key_exists($name, $this->row); |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | if (array_key_exists($name, $this->row)) { |
| 72 | 72 | return $this->row[$name]; |
| 73 | 73 | } |
| 74 | - throw new DataGridException('Unknown property ' . $name); |
|
| 74 | + throw new DataGridException('Unknown property '.$name); |
|
| 75 | 75 | } |
| 76 | 76 | return null; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | protected function getEntityAttribute($name) |
| 80 | 80 | { |
| 81 | - $attribute = preg_replace_callback('/_([A-z]?)/', function ($matches) { |
|
| 81 | + $attribute = preg_replace_callback('/_([A-z]?)/', function($matches) { |
|
| 82 | 82 | return isset($matches[1]) ? strtoupper($matches[1]) : ''; |
| 83 | 83 | }, $name); |
| 84 | - $getter = 'get' . ucfirst($attribute); |
|
| 84 | + $getter = 'get'.ucfirst($attribute); |
|
| 85 | 85 | if (method_exists($this->entity, $getter)) { |
| 86 | 86 | return $this->entity->$getter(); |
| 87 | 87 | } |
| 88 | - throw new DataGridException('Unknown property ' . $attribute . ' in ' . get_class($this->entity)); |
|
| 88 | + throw new DataGridException('Unknown property '.$attribute.' in '.get_class($this->entity)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function getId() |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $metaData = $this->entityManager->getClassMetadata(get_class($this->entity)); |
| 102 | 102 | $idAttr = $metaData->getIdentifier()[0]; |
| 103 | - $getter = 'get' . ucfirst($idAttr); |
|
| 103 | + $getter = 'get'.ucfirst($idAttr); |
|
| 104 | 104 | if (method_exists($this->entity, $getter)) { |
| 105 | 105 | return $this->entity->$getter(); |
| 106 | 106 | } |
| 107 | - throw new DataGridException('Cannot find identifier in ' . get_class($this->entity)); |
|
| 107 | + throw new DataGridException('Cannot find identifier in '.get_class($this->entity)); |
|
| 108 | 108 | //TODO surrogate pk |
| 109 | 109 | } |
| 110 | 110 | |