public function boot(Configs $configs)
{
if ($this->objectAttributes) {
foreach ($this->objectAttributes as $attribute) {
$key = $attribute->getId();
try {
$targetObject = $configs->getObject($attribute->getTarget());
} catch (BundleNotFoundException $e) {
continue;
}
if (!$attribute->getTarget() || !$targetObject) {
continue;
}
$field = $targetObject->getField($key);
if (!$field) {
//does not exists, so attach it
$attribute->setAttribute(true);
$targetObject->addField($attribute);
$configs->addReboot(sprintf('Added field attribute %s to %s', $key, $targetObject->getId()));
}
}
}
if ($this->getObjects()) {
foreach ($this->getObjects() as $object) {
$object->bootRunTime($configs);
}
}
}