本文整理汇总了PHP中SplSubject::getEventObject方法的典型用法代码示例。如果您正苦于以下问题:PHP SplSubject::getEventObject方法的具体用法?PHP SplSubject::getEventObject怎么用?PHP SplSubject::getEventObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplSubject
的用法示例。
在下文中一共展示了SplSubject::getEventObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillJoins
/**
* @param \SplSubject|Logic $subject
*/
protected function fillJoins($subject)
{
$models = $subject->getEventObject();
$modelConfig = $subject->getModelService()->getParsedModelConfig($subject->getModelName());
if (!(is_array($models) || $models instanceof ResultSetInterface)) {
$models = [$models];
}
$aModels = [];
foreach ($models as $_k => $aclModel) {
if ($aclModel instanceof AclDataModel) {
$mymodel = $aclModel->getDataModel();
} else {
$mymodel = $aclModel;
}
foreach ($modelConfig->joins as $_k => $join) {
if ($join['type'] == 'lookup') {
$this->fillLookup($join, $subject, $mymodel);
} elseif ($join['type'] == 'static_lookup') {
$this->fillStaticLookup($join, $subject, $mymodel);
}
}
$aModels[] = $mymodel->getArrayCopy();
}
if ($models instanceof ResultSetInterface) {
$models->initialize($aModels);
}
// else
// {
// $models = $aModels;
// }
}
示例2: update
/**
* @param \SplSubject|Logic $subject
*
* @throws \Exception
*/
public function update(\SplSubject $subject)
{
$models = $subject->getEventObject();
$fs = $subject->getFilesystemServiceVerify();
foreach ($models as $id => $model) {
$results[$id] = $fs->deleteFile($model->document());
}
return $results;
}
示例3: update
/**
* @param \SplSubject|Logic $subject
*
* @throws \Exception
*/
public function update(\SplSubject $subject)
{
$models = $subject->getEventObject();
if (!(is_array($models) || $models instanceof ResultSetInterface)) {
$models = [$models];
}
foreach ($models as $_k => $model) {
if ($model instanceof AclDataModel) {
$dataModel = $model->getDataModel();
} else {
$dataModel = $model;
}
$subject->getGatewayServiceVerify()->get($dataModel->getModelName())->delete(['_id' => $dataModel->id()]);
}
}
示例4: update
/**
* @param \SplSubject|Logic $subject
*/
public function update(\SplSubject $subject)
{
$model = $subject->getEventObject();
$settings = $this->getRootConfig();
if ($model->{$settings}['isdefault_field'] == 'true') {
$gw = $subject->getGatewayServiceVerify()->get($model->getModelName());
$searchQuery = [];
foreach ($settings['unique_fields'] as $field) {
$searchQuery[$field] = $model->{$field};
}
$searchQuery['-_id'] = $model->_id;
$otherModels = $gw->find($searchQuery);
foreach ($otherModels as $othrModel) {
$othrModel->{$settings}['isdefault_field'] = 'false';
$gw->save($othrModel);
}
}
}