本文整理汇总了PHP中Espo\Core\Utils\Util::unsetInArrayByValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::unsetInArrayByValue方法的具体用法?PHP Util::unsetInArrayByValue怎么用?PHP Util::unsetInArrayByValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Espo\Core\Utils\Util
的用法示例。
在下文中一共展示了Util::unsetInArrayByValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUnsetInArrayByValueWithoutReindex
public function testUnsetInArrayByValueWithoutReindex()
{
$newArray = json_decode('[
"__APPEND__",
{
"name":"populating",
"label":"Populating",
"view":"Advanced:TargetList.Record.Panels.Populating"
}
]', true);
$result = json_decode('{
"1": {
"name": "populating",
"label": "Populating",
"view": "Advanced:TargetList.Record.Panels.Populating"
}
}', true);
$this->assertEquals($result, Util::unsetInArrayByValue('__APPEND__', $newArray, false));
}
示例2: delete
/**
* Unset some fields and other stuff in metadat
*
* @param string $key1
* @param string $key2
* @param array | string $unsets Ex. 'fields.name'
*
* @return bool
*/
public function delete($key1, $key2, $unsets)
{
if (!is_array($unsets)) {
$unsets = (array) $unsets;
}
$normalizedData = array('__APPEND__');
$metaUnsetData = array();
foreach ($unsets as $unsetItem) {
$normalizedData[] = $unsetItem;
$metaUnsetData[] = implode('.', array($key1, $key2, $unsetItem));
}
$unsetData = array($key1 => array($key2 => $normalizedData));
$this->deletedData = Util::merge($this->deletedData, $unsetData);
$this->deletedData = Util::unsetInArrayByValue('__APPEND__', $this->deletedData);
$this->meta = Util::unsetInArray($this->getData(), $metaUnsetData);
}