Selaa lähdekoodia

Merge branch 'develop'

develop
Fabien Normand 2 vuotta sitten
vanhempi
commit
d4e5f14339
5 muutettua tiedostoa jossa 51 lisäystä ja 12 poistoa
  1. +20
    -0
      Component/ArrayComponent.php
  2. +9
    -1
      Container/ComponentContainer.php
  3. +1
    -1
      Definition/Field/AbstractFieldDefinition.php
  4. +9
    -0
      Repository/AbstractRepositoryQuery.php
  5. +12
    -10
      Resources/assets/functions/widgets.js

+ 20
- 0
Component/ArrayComponent.php Näytä tiedosto

@@ -0,0 +1,20 @@
<?php

namespace Lc\SovBundle\Component;

use Cocur\Slugify\Slugify;

class ArrayComponent
{
public function contains(array $array, $entity): bool
{
foreach($array as $entityTest) {
if(get_class($entityTest) == get_class($entity)
&& $entityTest->getId() == $entity->getId()) {
return true;
}
}

return false;
}
}

+ 9
- 1
Container/ComponentContainer.php Näytä tiedosto

@@ -26,6 +26,7 @@ class ComponentContainer
protected NumberComponent $numberComponent;
protected PointLocationComponent $pointLocationComponent;
protected StringComponent $stringComponent;
protected ArrayComponent $arrayComponent;

public function __construct(
CitiesComponent $citiesComponent,
@@ -37,7 +38,8 @@ class ComponentContainer
MetaComponent $metaComponent,
NumberComponent $numberComponent,
PointLocationComponent $pointLocationComponent,
StringComponent $stringComponent
StringComponent $stringComponent,
ArrayComponent $arrayComponent
) {
$this->citiesComponent = $citiesComponent;
$this->cookieComponent = $cookieComponent;
@@ -49,6 +51,7 @@ class ComponentContainer
$this->numberComponent = $numberComponent;
$this->pointLocationComponent = $pointLocationComponent;
$this->stringComponent = $stringComponent;
$this->arrayComponent = $arrayComponent;
}

public function getCitiesComponent(): CitiesComponent
@@ -100,4 +103,9 @@ class ComponentContainer
{
return $this->stringComponent;
}

public function getArrayComponent(): ArrayComponent
{
return $this->arrayComponent;
}
}

+ 1
- 1
Definition/Field/AbstractFieldDefinition.php Näytä tiedosto

@@ -146,7 +146,7 @@ abstract class AbstractFieldDefinition
$fieldArray = [];
foreach($configureFieldArray as $fieldName) {
if(isset($allFieldArray[$fieldName])) {
$fieldArray[] = $allFieldArray[$fieldName];
$fieldArray[$fieldName] = $allFieldArray[$fieldName];
}
else {
throw new \ErrorException('Le field "'.$fieldName.'" n\'est pas défini dans configureFields()');

+ 9
- 0
Repository/AbstractRepositoryQuery.php Näytä tiedosto

@@ -251,5 +251,14 @@ abstract class AbstractRepositoryQuery implements RepositoryQueryInterface
{
return $this->andWhere('.position < :position')->setParameter('position', $position);
}

public function enableCache($lifetime, $idCache)
{
return $this->getQueryBuilder()->getQuery()
->useQueryCache(true)
->setQueryCacheLifetime($lifetime)
->enableResultCache($lifetime, $idCache);
}

}


+ 12
- 10
Resources/assets/functions/widgets.js Näytä tiedosto

@@ -100,16 +100,18 @@ export class SovWidgets {
static setAutoCompleteField() {
var autocompleteFields = $('[data-lc-autocomplete-url]');
autocompleteFields.each(function () {
var $this = $(this),
url = $this.data('lc-autocomplete-url');

$this.autoComplete({
//bootstrapVersion: 4,
//noResultsText: 'Aucun résultat n\'a été trouvé.',
resolverSettings: {
url: url
}
});
if(!$(this).hasClass('autocomplete-disabled')) {
var $this = $(this),
url = $this.data('lc-autocomplete-url');

$this.autoComplete({
//bootstrapVersion: 4,
//noResultsText: 'Aucun résultat n\'a été trouvé.',
resolverSettings: {
url: url
}
});
}
});
}


Loading…
Peruuta
Tallenna