本文整理汇总了PHP中CustomField::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::setName方法的具体用法?PHP CustomField::setName怎么用?PHP CustomField::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Delete custom fields
* @param $request
* @return unknown_type
*/
public function execute($request)
{
$admin = $this->getUser()->hasCredential(Auth::ADMIN_ROLE);
if (!$admin) {
$this->forward("auth", "unauthorized");
return;
}
$form = new CustomFieldForm(array(), array(), true);
$customFieldsService = $this->getCustomFieldService();
if ($request->isMethod('post')) {
$form->bind($request->getParameter($form->getName()));
if ($form->isValid()) {
$fieldNum = $form->getValue('field_num');
$customField = null;
if (isset($fieldNum)) {
$customField = $customFieldsService->getCustomField($fieldNum);
}
if (empty($customField)) {
$customField = new CustomField();
}
$customField->setName($form->getValue('name'));
$customField->setType($form->getValue('type'));
$customField->setScreen($form->getValue('screen'));
$customField->setExtraData($form->getValue('extra_data'));
$customFieldsService->saveCustomField($customField);
$this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::SAVE_SUCCESS)));
}
}
$this->redirect('pim/listCustomFields');
}
示例2: testSaveCustomField
public function testSaveCustomField()
{
$customField = new CustomField();
$customField->setName('Hobby');
$customField->setType(0);
$customField->setScreen('personal');
$result = $this->customFieldConfigurationDao->saveCustomField($customField);
$this->assertTrue($result instanceof CustomField);
$this->assertEquals('Hobby', $result->getName());
$this->assertEquals(6, $result->getId());
}