ListCollection.php 755 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. *
  10. */
  11. namespace Sonata\BaseApplicationBundle\Datagrid;
  12. use Sonata\BaseApplicationBundle\Admin\FieldDescription;
  13. class ListCollection
  14. {
  15. protected $elements = array();
  16. public function add(FieldDescription $fieldDescription)
  17. {
  18. $this->elements[$fieldDescription->getName()] = $fieldDescription;
  19. }
  20. public function getElements()
  21. {
  22. return $this->elements;
  23. }
  24. public function has($name)
  25. {
  26. return array_key_exists($name, $this->elements);
  27. }
  28. }