本文整理汇总了PHP中FormField::saveInto方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::saveInto方法的具体用法?PHP FormField::saveInto怎么用?PHP FormField::saveInto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::saveInto方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveInto
public function saveInto(\DataObjectInterface $record)
{
$fieldname = $this->name;
$relation = $fieldname && $record && $record->hasMethod($fieldname) ? $record->{$fieldname}() : null;
$value = $this->dataValue();
if ($relation) {
// TODO: Save to relation
} else {
if (is_array($value)) {
$this->value = json_encode(array_values($value));
}
}
parent::saveInto($record);
}
示例2: saveInto
/**
* Only save if field was shown on the client, and is not empty.
*
* @param DataObjectInterface $record
*
* @return boolean
*/
public function saveInto(DataObjectInterface $record)
{
if (!$this->isSaveable()) {
return false;
}
if (!($this->canBeEmpty && !$this->value)) {
parent::saveInto($record);
}
}
示例3: saveInto
public function saveInto(\DataObjectInterface $record)
{
$v = $this->Value();
// if (is_array($v)) {
$allItems = array();
foreach ($this->children as $field) {
$fieldname = $field->getName();
if (strpos($fieldname, '__') > 0) {
$bits = array_reverse(explode('__', $fieldname));
if (count($bits) > 3) {
list($dataFieldName, $id, $classname) = $bits;
if (!isset($allItems["{$classname}-{$id}"])) {
$item = $this->records->filter(array('ClassName' => $classname, 'ID' => $id))->first();
$allItems["{$classname}-{$id}"] = $item;
}
$item = $allItems["{$classname}-{$id}"];
if ($item) {
if ($field) {
$field->setName($dataFieldName);
$field->saveInto($item);
}
}
}
}
}
foreach ($allItems as $item) {
$item->write();
}
parent::saveInto($record);
}
示例4: saveInto
/**
* Only save if field was shown on the client,
* and is not empty.
*
* @param DataObject $record
* @return bool
*/
function saveInto(DataObject $record) {
if(!$this->isSaveable()) return false;
if(!($this->canBeEmpty && !$this->value)) {
parent::saveInto($record);
}
}