zf-fr/zfr-rest

Change signature of renderResource

bakura10 opened this issue · 1 comments

After a bit of usage, I've realized that the order of parameters is a bit inconsistent. When creating a a ResourceViewModel, it is:

return new ResourceViewModel(['user' => $user], ['template' => 'user']);

However the resourceRender helper work like this:

$this->renderResource('templateName', ['user' => $user]);

I'm considering changing that for 0.5 to keep the same order. What do you think @grizzm0 ?

Nah. The current signature matches ViewModel($variables, $options); aswell as partial($template, $variables) and partialLoop($template, $variables);

They make sense imho as the model doesn't always require options and is therefore less important.
Same goes for the renderers. They require template name which should be prio 1. They however don't require variables.