zf-fr / zfr-rest

A module for Zend Framework 2 that aims to simplify RESTful
81 stars 31 forks source link

Change signature of renderResource #191

Open bakura10 opened 9 years ago

bakura10 commented 9 years ago

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 ?

grizzm0 commented 9 years ago

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.