/** * Return value object related to this config found by given criteria, or creates new one otherwise * * @param string $section * @param string $name * * @return ConfigValue */ public function getOrCreateValue($section, $name) { $values = $this->getValues()->filter(function (ConfigValue $item) use($name, $section) { return $item->getName() == $name && $item->getSection() == $section; }); /** @var ArrayCollection $values */ if ($values->first() === false) { $value = new ConfigValue(); $value->setConfig($this); $value->setName($name); $value->setSection($section); } else { $value = $values->first(); } return $value; }
/** * {@inheritDoc} */ public function setName($name) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setName', array($name)); return parent::setName($name); }