Skip to content

Instantly share code, notes, and snippets.

@dennis-fedco
Last active August 30, 2017 21:09
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 dennis-fedco/fc8164c84a5919d927519966e0ace0f0 to your computer and use it in GitHub Desktop.
Save dennis-fedco/fc8164c84a5919d927519966e0ace0f0 to your computer and use it in GitHub Desktop.
Form Code
<?php
class MyFormFactory
{
public function __invoke(ServiceManager $container)
{
/**
* code to get quote id
*/
if (isset($_GET['quote_id']))
$quote_id = filter_var($_GET['quote_id'], FILTER_VALIDATE_INT);
else if (isset($_SESSION['quote_id']))
$quote_id = filter_var($_SESSION['quote_id'], FILTER_VALIDATE_INT);
else
$quote_id = 0;
$repository = new MyRepository($quote_id, $container->get(MySql::class));
return new MyFormAction($repository, $container->get(PhpRenderer::class));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment