Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created March 21, 2014 13:16
Show Gist options
  • Save renepardon/9685963 to your computer and use it in GitHub Desktop.
Save renepardon/9685963 to your computer and use it in GitHub Desktop.
<?php
/**
* Class SampleController
*
* ZF2 Controller Action after dispatch overwrite.
*/
class SampleController
{
/**
* This is our sample action.
*
* A route for this may look like this:
* /sample/:id[/:somethingDifferent]
*
* @example /sample/12/test
*
* @param int $id
* @param string $somethingDifferent
*
* @return array|ViewModel
*/
public function myPerfectAction($id, $somethingDifferent = 'different thing')
{
// Returns an array with 12 as $id and "test" as $somethingDifferent.
return [$id, $somethingDifferent];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment