当前位置: 首页>>代码示例>>PHP>>正文


PHP Relation::get_all_by_meaningId方法代码示例

本文整理汇总了PHP中Relation::get_all_by_meaningId方法的典型用法代码示例。如果您正苦于以下问题:PHP Relation::get_all_by_meaningId方法的具体用法?PHP Relation::get_all_by_meaningId怎么用?PHP Relation::get_all_by_meaningId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Relation的用法示例。


在下文中一共展示了Relation::get_all_by_meaningId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cloneMeaning

 /**
  * Different from __clone(). We save the object to the database to assign it an ID. We also clone its descendants,
  * relations, sources and tags.
  **/
 public function cloneMeaning($newLexemId, $newParentId)
 {
     $clone = $this->parisClone();
     $clone->lexemId = $newLexemId;
     $clone->parentId = $newParentId;
     $clone->save();
     // Clone its tags
     $mtms = MeaningTagMap::get_all_by_meaningId($this->id);
     foreach ($mtms as $mtm) {
         $mtmClone = $mtm->parisClone();
         $mtmClone->meaningId = $clone->id;
         $mtmClone->save();
     }
     // Clone its sources
     $mss = MeaningSource::get_all_by_meaningId($this->id);
     foreach ($mss as $ms) {
         $msClone = $ms->parisClone();
         $msClone->meaningId = $clone->id;
         $msClone->save();
     }
     // Clone its relations
     $relations = Relation::get_all_by_meaningId($this->id);
     foreach ($relations as $r) {
         $rc = $r->parisClone();
         $rc->meaningId = $clone->id;
         $rc->save();
     }
     // Clone its children
     $children = Meaning::get_all_by_parentId($this->id);
     foreach ($children as $child) {
         $child->cloneMeaning($newLexemId, $clone->id);
     }
 }
开发者ID:florinp,项目名称:dexonline,代码行数:37,代码来源:Meaning.php

示例2: goodForVariant

function goodForVariant($meanings)
{
    if (empty($meanings)) {
        return true;
    }
    if (count($meanings) > 1) {
        return false;
    }
    $m = $meanings[0];
    $mss = MeaningSource::get_all_by_meaningId($m->id);
    $relations = Relation::get_all_by_meaningId($m->id);
    return count($mss) && !$m->internalRep && !$m->internalEtymology && !$m->internalComment && empty($relations);
}
开发者ID:florinp,项目名称:dexonline,代码行数:13,代码来源:lexemEdit.php


注:本文中的Relation::get_all_by_meaningId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。