Ver código fonte

Ajout ArrayComponent

feature/symfony6.1
Guillaume Bourgeois 1 ano atrás
pai
commit
8c27fabfae
2 arquivos alterados com 29 adições e 1 exclusões
  1. +20
    -0
      Component/ArrayComponent.php
  2. +9
    -1
      Container/ComponentContainer.php

+ 20
- 0
Component/ArrayComponent.php Ver arquivo

<?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 Ver arquivo

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;
}
} }

Carregando…
Cancelar
Salvar