本文整理汇总了PHP中Base::relation方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::relation方法的具体用法?PHP Base::relation怎么用?PHP Base::relation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::relation方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listForEditor
public function listForEditor($idEntityCxn)
{
$criteria = $this->getCriteria()->select('idEntity,entries.name as name')->orderBy('entries.name');
Base::entryLanguage($criteria);
Base::relation($criteria, 'constructionelement', 'construction', 'rel_elementof');
$criteria->where("construction.idEntity = {$idEntityCxn}");
return $criteria;
}
示例2: listCE
public function listCE()
{
$ce = new ConstructionElement();
$criteria = $ce->getCriteria()->select('idConstructionElement, entry, entries.name as name, color.rgbFg, color.rgbBg, color.idColor');
Base::entryLanguage($criteria);
Base::relation($criteria, 'constructionelement', 'construction', 'rel_elementof');
$criteria->where("construction.idConstruction = {$this->getId()}");
$criteria->orderBy('entries.name');
return $criteria;
}
示例3: listLabelType
public function listLabelType($filter)
{
$idLanguage = \Manager::getSession()->idLanguage;
$criteria = $this->getCriteria()->select('idLayerType, entry, genericlabel.name as labelType, genericlabel.idEntity as idLabelType')->orderBy('entry, genericlabel.name');
Base::relation($criteria, 'layertype', 'genericlabel', 'rel_haslabeltype');
$criteria->where("genericlabel.idLanguage = {$idLanguage}");
if ($filter->entry) {
$criteria->where("entry = '{$filter->entry}'");
}
return $criteria;
}
示例4: listLUByWordForm
public function listLUByWordForm($wordform)
{
$criteria = $this->getCriteria();
$criteria->select('lexeme.lexemeentries.lemma.lus.idLU');
$criteria->where("upper(form) = upper('{$wordform}')");
$lus = $criteria->asQuery()->chunkResult('idLU', 'idLU');
if (count($lus) > 0) {
$lu = new LU();
$criteria = $lu->getCriteria()->select("idLU, concat(frame.entries.name,'.',name) as fullName");
Base::relation($criteria, 'lu', 'frame', 'rel_evokes');
Base::entryLanguage($criteria, 'frame');
$criteria->where("idLU", "IN", $lus);
$criteria->where("lemma.idLanguage", "=", "frame.entries.idLanguage");
return $criteria->asQuery()->chunkResult('idLU', 'fullName');
} else {
return new \stdClass();
}
}
示例5: getLabelTypesGL
public function getLabelTypesGL($idSentence)
{
$criteria = $this->getCriteria();
$criteria->select("idAnnotationSet, l.idLayer, genericlabel.idEntity as idLabelType, genericlabel.name as labelType, genericlabel.idColor, '' as coreType");
$criteria->join('annotationset', 'sentence s', "annotationset.idSentence = s.idSentence");
$criteria->join('annotationset', 'layer l', "annotationset.idAnnotationSet = l.idAnnotationSet");
$criteria->join('layer l', 'layertype lt', "l.idLayerType=lt.idLayerType");
Base::relation($criteria, 'layertype lt', 'genericlabel', 'rel_haslabeltype');
$criteria->where("idSentence = {$idSentence}");
$criteria->where("lt.entry <> 'lty_gf'");
$criteria->where("(genericlabel.idLanguage = s.idLanguage)");
if (!\Manager::checkAccess('MASTER', A_EXECUTE)) {
$criteria->where("idAnnotationSet = {$this->getId()}");
}
$criteria->orderBy('idAnnotationSet, l.idLayer, genericlabel.name');
return $criteria;
}
示例6: getBaseFrame
public function getBaseFrame()
{
// if template was created from a frame, this frame is the "base frame"
$frame = new Frame();
$criteria = $frame->getCriteria()->select('idFrame, entries.name as name, entries.description as description')->orderBy('entries.name');
Base::relation($criteria, 'template', 'frame', 'rel_createdfrom');
$criteria->where("template.idEntity = {$this->getIdEntity()}");
Base::entryLanguage($criteria);
return $criteria;
}
示例7: listByFrame
public function listByFrame($idFrame, $idLanguage = '', $idLU = NULL)
{
$criteria = $this->getCriteria()->select('*')->orderBy('name');
Base::relation($criteria, 'lu', 'frame', 'rel_evokes');
$criteria->where("frame.idFrame = {$idFrame}");
$criteria->where("lemma.idLanguage = {$idLanguage}");
if ($idLU) {
if (is_array($idLU)) {
$criteria->where("idLU", "IN", $idLU);
} else {
$criteria->where("idLU = {$idLU}");
}
}
$criteria->orderBy('name');
return $criteria;
}
示例8: listFE
public function listFE()
{
$fe = new FrameElement();
$criteria = $fe->getCriteria()->select('idFrameElement, entry, entries.name as name, typeinstance.entry as coreType, color.rgbFg, color.rgbBg, ' . 'typeinstance.idTypeInstance as idCoreType, color.idColor');
Base::entryLanguage($criteria);
Base::relation($criteria, 'frameelement', 'frame', 'rel_elementof');
Base::relation($criteria, 'frameelement', 'typeinstance', 'rel_hastype');
$criteria->where("frame.idFrame = {$this->idFrame}");
$criteria->orderBy('typeinstance.idTypeInstance, entries.name');
return $criteria;
}
示例9: addManualSubCorpusLU
public function addManualSubCorpusLU($data)
{
$transaction = $this->beginTransaction();
try {
// verifica se a LU já tem um SubCorpus manually-added
$criteria = $this->getCriteria()->select('min(idSubCorpus) as idSubCorpusManual');
Base::relation($criteria, 'lu', 'subcorpus', 'rel_hassubcorpus');
$criteria->where("lu.idLU = {$data->idLU}");
$criteria->where("entity.alias like 'sco_manually-added%'");
$idSubCorpus = $criteria->asQuery()->getResult()[0]['idSubCorpusManual'];
if ($idSubCorpus) {
$this->getById($idSubCorpus);
} else {
$entity = Base::createEntity('SC', 'sco_manually-added');
$this->setName('manually-added');
$this->setRank(0);
$this->setIdEntity($entity->getId());
$this->save();
}
$lu = LU::create($data->idLU);
Base::createEntityRelation($lu->getIdEntity(), 'rel_hassubcorpus', $this->getIdEntity());
$annotationSet = new AnnotationSet();
$annotationSet->setIdSubCorpus($this->getId());
$annotationSet->setIdSentence($data->idSentence);
$annotationSet->setIdAnnotationStatus('ast_manual');
$annotationSet->save();
$annotationSet->createLayersForLU($lu, $data);
$transaction->commit();
} catch (\Exception $ex) {
$transaction->rollback();
throw new \Exception($ex->getMessage());
}
}
示例10: save
public function save($data)
{
$transaction = $this->beginTransaction();
try {
if ($this->isPersistent()) {
$coreType = new TypeInstance($this->getIdCoreType());
Base::updateEntityRelation($this->getIdEntity(), 'rel_hastype', $coreType->getIdEntity());
$this->setActive(true);
$criteria = $this->getCriteria()->select('fe1.idFrameElement');
Base::relation($criteria, 'frameelement fe1', 'frameelement fe2', 'rel_hastemplate');
$criteria->where("fe2.idEntity = {$this->getIdEntity()}");
$fes = $criteria->asQuery()->getResult();
foreach ($fes as $fe) {
$feTemplated = new FrameElement($fe['idFrameElement']);
$feTemplated->setIdColor($this->getIdColor());
$feTemplated->save();
}
} else {
if ($data->idFrame) {
$schema = new Frame($data->idFrame);
} else {
if ($data->idTemplate) {
$schema = new Template($data->idTemplate);
}
}
$entity = new Entity();
$entity->setAlias($this->getEntry());
$entity->setType('FE');
$entity->save();
$entry = new Entry();
$entry->newEntry($this->getEntry());
Base::createEntityRelation($entity->getId(), 'rel_elementof', $schema->getIdEntity());
$coreType = new TypeInstance($data->idCoreType);
Base::createEntityRelation($entity->getId(), 'rel_hastype', $coreType->getIdEntity());
$this->setIdEntity($entity->getId());
$this->setActive(true);
}
parent::save();
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollback();
throw new \Exception($e->getMessage());
}
}