diff --git a/Form/ChoiceLoader/PersonChoiceLoader.php b/Form/ChoiceLoader/PersonChoiceLoader.php
index 18c7d4a2e..b1cdfee7a 100644
--- a/Form/ChoiceLoader/PersonChoiceLoader.php
+++ b/Form/ChoiceLoader/PersonChoiceLoader.php
@@ -1,4 +1,5 @@
*
@@ -15,31 +16,43 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+
namespace Chill\PersonBundle\Form\ChoiceLoader;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Doctrine\ORM\EntityRepository;
-use Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Chill\PersonBundle\Entity\Person;
/**
- *
+ * Class PersonChoiceLoader
*
+ * @package Chill\PersonBundle\Form\ChoiceLoader
* @author Julien Fastré
*/
class PersonChoiceLoader implements ChoiceLoaderInterface
{
/**
- *
* @var EntityRepository
*/
protected $personRepository;
+ /**
+ * @var array
+ */
protected $lazyLoadedPersons = [];
+ /**
+ * @var array
+ */
protected $centers = [];
+ /**
+ * PersonChoiceLoader constructor.
+ *
+ * @param EntityRepository $personRepository
+ * @param array|null $centers
+ */
public function __construct(
EntityRepository $personRepository,
array $centers = null
@@ -50,11 +63,18 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
}
}
+ /**
+ * @return bool
+ */
protected function hasCenterFilter()
{
return count($this->centers) > 0;
}
-
+
+ /**
+ * @param null $value
+ * @return ChoiceListInterface
+ */
public function loadChoiceList($value = null): ChoiceListInterface
{
$list = new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
@@ -65,7 +85,12 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
return $list;
}
-
+
+ /**
+ * @param array $values
+ * @param null $value
+ * @return array
+ */
public function loadChoicesForValues(array $values, $value = null)
{
$choices = [];
@@ -88,6 +113,11 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
return $choices;
}
+ /**
+ * @param array $choices
+ * @param null $value
+ * @return array|string[]
+ */
public function loadValuesForChoices(array $choices, $value = null)
{
$values = [];