Browse Source

Merge branch 'develop'

develop
Fabien Normand 2 years ago
parent
commit
d4e5f14339
5 changed files with 51 additions and 12 deletions
  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 View File

<?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 View File

protected NumberComponent $numberComponent; protected NumberComponent $numberComponent;
protected PointLocationComponent $pointLocationComponent; protected PointLocationComponent $pointLocationComponent;
protected StringComponent $stringComponent; protected StringComponent $stringComponent;
protected ArrayComponent $arrayComponent;


public function __construct( public function __construct(
CitiesComponent $citiesComponent, CitiesComponent $citiesComponent,
MetaComponent $metaComponent, MetaComponent $metaComponent,
NumberComponent $numberComponent, NumberComponent $numberComponent,
PointLocationComponent $pointLocationComponent, PointLocationComponent $pointLocationComponent,
StringComponent $stringComponent
StringComponent $stringComponent,
ArrayComponent $arrayComponent
) { ) {
$this->citiesComponent = $citiesComponent; $this->citiesComponent = $citiesComponent;
$this->cookieComponent = $cookieComponent; $this->cookieComponent = $cookieComponent;
$this->numberComponent = $numberComponent; $this->numberComponent = $numberComponent;
$this->pointLocationComponent = $pointLocationComponent; $this->pointLocationComponent = $pointLocationComponent;
$this->stringComponent = $stringComponent; $this->stringComponent = $stringComponent;
$this->arrayComponent = $arrayComponent;
} }


public function getCitiesComponent(): CitiesComponent public function getCitiesComponent(): CitiesComponent
{ {
return $this->stringComponent; return $this->stringComponent;
} }

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

+ 1
- 1
Definition/Field/AbstractFieldDefinition.php View File

$fieldArray = []; $fieldArray = [];
foreach($configureFieldArray as $fieldName) { foreach($configureFieldArray as $fieldName) {
if(isset($allFieldArray[$fieldName])) { if(isset($allFieldArray[$fieldName])) {
$fieldArray[] = $allFieldArray[$fieldName];
$fieldArray[$fieldName] = $allFieldArray[$fieldName];
} }
else { else {
throw new \ErrorException('Le field "'.$fieldName.'" n\'est pas défini dans configureFields()'); throw new \ErrorException('Le field "'.$fieldName.'" n\'est pas défini dans configureFields()');

+ 9
- 0
Repository/AbstractRepositoryQuery.php View File

{ {
return $this->andWhere('.position < :position')->setParameter('position', $position); 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 View File

static setAutoCompleteField() { static setAutoCompleteField() {
var autocompleteFields = $('[data-lc-autocomplete-url]'); var autocompleteFields = $('[data-lc-autocomplete-url]');
autocompleteFields.each(function () { 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…
Cancel
Save