Skip to content

Commit

Permalink
Merge pull request #2166 from cmfcmf/category-fix-1.3
Browse files Browse the repository at this point in the history
[1.3] Corrected behaviour of CategorySelector if no category is selected
  • Loading branch information
Guite committed Jan 5, 2015
2 parents bf1eed3 + 89215ec commit 07141db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/Zikula/Form/Plugin/CategorySelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,10 @@ public function saveValue(Zikula_Form_View $view, &$data)
//$em->flush();

foreach ($selectedValues as $selectedValue) {

if ($selectedValue === null) {
// If no category has been selected.
continue;
}
$category = $em->find('Zikula_Doctrine2_Entity_Category', $selectedValue);
$class = $em->getClassMetadata(get_class($entity))->getAssociationTargetClass($this->dataField);
$collection->add(new $class($this->registryId, $category, $entity));
Expand Down

0 comments on commit 07141db

Please sign in to comment.