本文整理汇总了PHP中Alchemy\Phrasea\Application::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::form方法的具体用法?PHP Application::form怎么用?PHP Application::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alchemy\Phrasea\Application
的用法示例。
在下文中一共展示了Application::form方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateForm
public function testCreateForm()
{
$factory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
$app = new Application(Application::ENV_TEST);
$app['form.factory'] = $factory;
$form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
$type = $this->getMock('Symfony\\Component\\Form\\FormTypeInterface');
$data = ['some' => 'data'];
$options = [];
$parent = $this->getMockBuilder('Symfony\\Component\\Form\\FormBuilder')->disableOriginalConstructor()->getMock();
$factory->expects($this->once())->method('create')->with($this->equalTo($type), $this->equalTo($data), $this->equalTo($options), $this->equalTo($parent))->will($this->returnValue($form));
$this->assertEquals($form, $app->form($type, $data, $options, $parent));
}
示例2: authenticate
/**
* Authenticate to phraseanet
*
* @param Application $app A Silex application where the controller is mounted on
* @param Request $request The current request
* @return RedirectResponse
*/
public function authenticate(PhraseaApplication $app, Request $request)
{
$form = $app->form(new PhraseaAuthenticationForm());
$redirector = function (array $params = []) use($app) {
return $app->redirectPath('homepage', $params);
};
try {
return $this->doAuthentication($app, $request, $form, $redirector);
} catch (AuthenticationException $e) {
return $e->getResponse();
}
}