本文整理匯總了PHP中DataObjectInterface::getSchemas方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataObjectInterface::getSchemas方法的具體用法?PHP DataObjectInterface::getSchemas怎麽用?PHP DataObjectInterface::getSchemas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataObjectInterface
的用法示例。
在下文中一共展示了DataObjectInterface::getSchemas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveInto
public function saveInto(DataObjectInterface $record)
{
$schemas = $record->getSchemas();
$value = $this->Value();
$metadata = array();
foreach ($schemas as $schema) {
$metadata[$schema->Name] = array();
$fields = $schema->getFormFields();
$namesMap = array();
foreach ($fields as $field) {
$brPos = strrpos($field->getName(), '[');
$name = substr($field->getName(), $brPos + 1, -1);
$namesMap[$field->getName()] = $name;
}
if (isset($value[$schema->Name])) {
foreach ($fields as $field) {
$fName = $field->getName();
$sName = $namesMap[$fName];
if (array_key_exists($sName, $value[$schema->Name])) {
$field->setValue($value[$schema->Name][$sName], $value[$schema->Name]);
} else {
$field->setValue(null);
}
}
}
foreach ($fields as $field) {
$name = $namesMap[$field->getName()];
$schemaField = $schema->Fields()->find('Name', $name);
$toSave = $schemaField->processBeforeWrite($field->dataValue(), $record);
$metadata[$schema->Name][$name] = $toSave;
}
}
$record->{$this->name} = serialize($metadata);
}