diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php index 093fa7510c6e0..ccc47f784e10d 100644 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php @@ -397,9 +397,9 @@ static protected function detectMetadataDriver($dir, ContainerBuilder $container } $container->addResource(new FileResource($resource)); - if (count(glob($dir.'/Resources/config/doctrine/metadata/mongodb/*.xml'))) { + if (($files = glob($dir.'/Resources/config/doctrine/metadata/mongodb/*.xml')) && count($files)) { return 'xml'; - } elseif (count(glob($dir.'/Resources/config/doctrine/metadata/mongodb/*.yml'))) { + } elseif (($files = glob($dir.'/Resources/config/doctrine/metadata/mongodb/*.yml')) && count($files)) { return 'yml'; } diff --git a/src/Symfony/Component/Form/CollectionField.php b/src/Symfony/Component/Form/CollectionField.php index 982fdc11dcf52..cf83e0bb39620 100644 --- a/src/Symfony/Component/Form/CollectionField.php +++ b/src/Symfony/Component/Form/CollectionField.php @@ -59,18 +59,20 @@ protected function configure() public function setData($collection) { - if (!is_array($collection) && !$collection instanceof \Traversable) { - throw new UnexpectedTypeException('The data passed to the CollectionField must be an array or a Traversable'); - } - - foreach ($this as $name => $field) { - if (!$this->getOption('modifiable') || '$$key$$' != $name) { - $this->remove($name); + if (null !== $collection) { + if (!is_array($collection) && !$collection instanceof \Traversable) { + throw new UnexpectedTypeException('The data passed to the CollectionField must be an array or a Traversable'); + } + + foreach ($this as $name => $field) { + if (!$this->getOption('modifiable') || '$$key$$' != $name) { + $this->remove($name); + } + } + + foreach ($collection as $name => $value) { + $this->add($this->newField($name, $name)); } - } - - foreach ($collection as $name => $value) { - $this->add($this->newField($name, $name)); } parent::setData($collection); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy