本文整理汇总了PHP中Label::setIdInstantiationType方法的典型用法代码示例。如果您正苦于以下问题:PHP Label::setIdInstantiationType方法的具体用法?PHP Label::setIdInstantiationType怎么用?PHP Label::setIdInstantiationType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::setIdInstantiationType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putLayers
public function putLayers($layers)
{
//mdump($layers);
$layerCE = new \StdClass();
$type = new Type();
$instances = $type->getInstantiationType('int_normal')->asQuery()->getResult();
$itNormal = $instances[0]['idInstantiationType'];
$hasFE = [];
try {
$transaction = $this->beginTransaction();
$label = new Label();
foreach ($layers as $layer) {
$idLayer = $layer->idLayer;
if ($idLayer == '') {
continue;
}
if ($layer->layerTypeEntry == 'lty_ce') {
$layerCE = $layer;
}
$labels = array();
if ($layer->idLayerType != 0) {
$delCriteria = $label->getDeleteCriteria()->where("idLayer = {$idLayer}")->delete();
if ($layer->layerTypeEntry == 'lty_cefe') {
$idFrame = $layer->idFrame;
unset($layer);
$layer = clone $layerCE;
$layer->layerTypeEntry = 'lty_cefe';
$queryCEFE = $this->getElementCxnFrame($idFrame);
$cefe = $queryCEFE->chunkResult('idEntityCE', 'idEntityFE');
foreach ($layerCE as $key => $value) {
if (substr($key, 0, 2) == 'wf') {
if ($cefe[$value]) {
$layer->{$key} = $cefe[$value];
}
}
}
}
$i = -1;
$l = 0;
$o = -1;
foreach ($layer as $key => $value) {
if (substr($key, 0, 2) == 'wf') {
$idLabelType = $layer->{$key};
if ($idLabelType == '') {
continue;
}
$pos = (int) substr($key, 2);
if ($idLabelType != $l || $pos > $o) {
$i++;
$labels[$i] = (object) ['idLabelType' => $idLabelType, 'startChar' => $pos, 'endChar' => $pos];
$l = $idLabelType;
} else {
$labels[$i]->endChar = $pos;
}
$o = $pos + 1;
}
}
}
if (count($labels)) {
if ($layer->layerTypeEntry == 'lty_fe') {
$hasFE[$layer->idAnnotationSet] = true;
}
if ($layer->layerTypeEntry == 'lty_ce') {
$hasFE[$layer->idAnnotationSet] = true;
}
foreach ($labels as $labelObj) {
$label->setPersistent(FALSE);
$label->setIdLayer($idLayer);
$label->setIdLabelType($labelObj->idLabelType);
$label->setStartChar($labelObj->startChar);
$label->setEndChar($labelObj->endChar);
$label->setMulti(0);
$label->setIdInstantiationType($itNormal);
$label->save();
}
}
if ($layer->ni->{$idLayer}) {
$hasFE[$layer->idAnnotationSet] = true;
foreach ($layer->ni->{$idLayer} as $idLabelType => $ni) {
$label->setPersistent(FALSE);
$label->setIdLayer($idLayer);
$label->setIdLabelType($idLabelType);
$label->setidInstantiationType($ni->idInstantiationType);
$label->setStartChar(NULL);
$label->setEndChar(NULL);
$label->setMulti(0);
$label->save();
}
}
}
$transaction->commit();
return $hasFE;
} catch (EModelException $e) {
$transaction->rollback();
throw new EModelException($e->getMessage());
}
}