本文整理匯總了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();
}
}