protected function _setProperty($name, $value, $type, $internal)
{
if ($name === '' || false !== strpos($name, '/')) {
throw new InvalidArgumentException("The name '{$name}' is no valid property name");
}
if (!isset($this->properties[$name])) {
$path = $this->getChildPath($name);
$property = $this->factory->get('Property', array(array('type' => $type, 'value' => $value), $path, $this->session, $this->objectManager, !$internal));
$this->properties[$name] = $property;
if (!$internal) {
$this->setModified();
}
} else {
if ($internal) {
$this->properties[$name]->_setValue($value, $type);
if ($this->properties[$name]->isDirty()) {
$this->properties[$name]->setClean();
}
} else {
$this->properties[$name]->setValue($value, $type);
}
}
return $this->properties[$name];
}