Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
24 changes: 13 additions & 11 deletions src/Symfony/Component/Form/CollectionField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down