Skip to content

Instantly share code, notes, and snippets.

@asgrim
Created April 2, 2014 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asgrim/9934756 to your computer and use it in GitHub Desktop.
Save asgrim/9934756 to your computer and use it in GitHub Desktop.
<?php
// gumf at the top
class Foo extends AbstractActionController
{
public function someCommonLogic()
{
if ($something) {
return $this->redirect()->toRoute('someRoute');
}
// some logic to populate some $viewModel thing
return $viewModel;
}
public function myAction()
{
$vm = $this->someCommonLogic();
if ($vm->isRedirect())
{
return $vm;
}
// other logic
return $vm;
}
public function anotherAction()
{
$vm = $this->someCommonLogic();
if ($vm->isRedirect())
{
return $vm;
}
// other logic
return $vm;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment