stephpy/TimelineBundle — pull request #129 by Miliooo (2014-04-18 14:06:29+00:00)
Title: action manager updates

In the current code ````findOrCreateComponent```` resolves the identifiers by calling ````resolveModelAndIdentifiers````.
if no component was found we pass it to the method ````createComponent```` which also calls ````resolveModelAndIdentifiers```. This is unneeded since we already got the resolved model and identifier.

This pull request creates a new method ````createComponentFromResolvedModelAndIdentifier````so we only have to do this call once when you call ````findOrCreateComponent`` and no component is found`.

Another fix is that there is there is copy pasted code (3 times) after calling the method ````resolveModelAndIdentifiers````
````
if (empty($model) || null === $identifier || '' === $identifier)
{
if (is_array($identifier)) {
$identifier = implode(', ', $identifier);
}

throw new \Exception(sprintf('To find a component, you have to give a model (%s) and an identifier (%s)', $model, $identifier));
}
````
Since this shoul be part of the ````resolveModelAndIdentifiers```` method I added it there as a safeguard function ````guardResolvedModelAndIdentifier````

I also did some small Phpdoc updates. If I did it right (i did test it by loading my branch) no code should have been changed, only the logic...