本文整理汇总了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);
}
}
示例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);
}