本文整理汇总了PHP中DataObjectInterface::getManyManyComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectInterface::getManyManyComponents方法的具体用法?PHP DataObjectInterface::getManyManyComponents怎么用?PHP DataObjectInterface::getManyManyComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectInterface
的用法示例。
在下文中一共展示了DataObjectInterface::getManyManyComponents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleSave
/**
* Called when a grid field is saved, converts the StatefulGridFieldList to a RelationList
* @param {GridField} $field
* @param {DataObjectInterface} $record
*/
public function handleSave(GridField $grid, DataObjectInterface $record)
{
$list = $grid->getList();
if ($list instanceof StatefulGridFieldList) {
$relationName = $list->getRelationName();
if ($record->has_many($relationName)) {
$list->changeToList($record->getComponents($list->getRelationName()));
} else {
if ($record->many_many($relationName)) {
$list->changeToList($record->getManyManyComponents($list->getRelationName()));
} else {
throw new InvalidArgumentException('Record does not have a has_many or many_many relationship called "' . $relationName . '"', null, null);
}
}
}
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-statefulunsavedlist,代码行数:21,代码来源:StatefulGridFieldListSaveHandler.php