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


PHP Relation类代码示例

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


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

示例1: updateRelation

 public function updateRelation(Relation $relation)
 {
     try {
         $relation->setLastModification(time());
         $this->dao->update($relation);
     } catch (Exception $e) {
         throw new EyePeopleException('Unable to update Relation ' . $relation->getId(), 0, $e);
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:9,代码来源:SQLRelationsProvider.php

示例2: actionAdd

 public function actionAdd()
 {
     $model = new Relation();
     if (($data = Yii::app()->getRequest()->getPost('Relation')) !== null) {
         $model->setAttributes($data);
         if ($model->validate()) {
             if ($model->addRelation()) {
                 $this->send(ERROR_NONE, 'success');
             }
         } else {
             $this->error->capture($model);
         }
     }
     $this->render('add', array('relation' => $model));
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:15,代码来源:RelationController.php

示例3: prepareRelation

 public function prepareRelation(Relation $relation)
 {
     $object = new ReflectionObject($relation);
     $properties = $object->getProperties();
     $cols = array();
     $cons = $relation->getContraints();
     foreach ($properties as $propertie) {
         $name = $propertie->getName();
         $docm = $propertie->getDocComment();
         preg_match("/@var (?P<type>\\w+) (?P<null>\\w+)/", $docm, $resp);
         array_push($cols, array('name' => $name, 'type' => $resp['type'], 'null' => $resp['null']));
     }
     $rname = strtolower(get_class($relation));
     array_push($this->prepareds, array('rname' => $rname, 'cols' => $cols, 'cons' => $cons));
 }
开发者ID:exildev,项目名称:corvus,代码行数:15,代码来源:RelationFactory.php

示例4: DelPair

function DelPair($relationName, $srcConcept, $srcAtom, $tgtConcept, $tgtAtom)
{
    if (func_num_args() != 5) {
        throw new Exception("Wrong number of arguments supplied for function DelPair(): " . func_num_args() . " arguments", 500);
    }
    Notifications::addLog("DelPair({$relationName},{$srcConcept},{$srcAtom},{$tgtConcept},{$tgtAtom})", 'ExecEngine');
    try {
        $database = Database::singleton();
        // Check if relation signature exists: $relationName[$srcConcept*$tgtConcept]
        $relation = Relation::isCombination($relationName, $srcConcept, $tgtConcept);
        $srcAtoms = explode('_AND', $srcAtom);
        $tgtAtoms = explode('_AND', $tgtAtom);
        if (count($srcAtoms) > 1) {
            throw new Exception('DelPair function call has more than one src atom', 501);
        }
        // 501: Not implemented
        if (count($tgtAtoms) > 1) {
            throw new Exception('DelPair function call has more than one tgt atom', 501);
        }
        // 501: Not implemented
        foreach ($srcAtoms as $a) {
            foreach ($tgtAtoms as $b) {
                $database->editDelete($relation, false, $a, $srcConcept, $b, $tgtConcept, 'ExecEngine');
            }
        }
        return 'Tuple (' . $srcAtom . ' - ' . $tgtAtom . ') deleted from ' . $relationName . '[' . $srcConcept . '*' . $tgtConcept . ']';
    } catch (Exception $e) {
        Notifications::addError('DelPair: ' . $e->getMessage());
    }
}
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:30,代码来源:insDelPairAtom.php

示例5: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         if (sfConfig::get('sf_cache_relations')) {
             Tagrelation::updateTagRelationCache();
         }
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Tag.php

示例6: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $genDoc = Document::getGenericDocument($this);
             $genDoc->setPublicationStatus("WAITING");
             $genDoc->save();
             $this->setId($genDoc->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:25,代码来源:Newsletter.php

示例7: render

 function render()
 {
     $param['network_id'] = PA::$network_info->network_id;
     $res = Network::get_members($param);
     $links['registered_users'] = count($res['users_data']);
     $this->email_domain_array = $this->get_email_by_domain($res['users_data']);
     $this->blog_post = Content::load_content_id_array(0, NULL, TRUE, 'ALL', 'created', 'DESC');
     $image_array = Image::load_images();
     $this->images = count($image_array);
     $this->profile_views = User::get_profile_view_stats('profile_visitor_count');
     $this->profile_visits_by_user = User::get_profile_view_stats('profile_visited_count');
     $relationship_stats = array();
     $maximum_relation = 0;
     $minimum_relation = 0;
     $average_relation = 0;
     $relationship_stats = Relation::relation_stats();
     if (count($relationship_stats) > 0) {
         $maximum_relation = max($relationship_stats);
         $minimum_relation = min($relationship_stats);
         $average_relation = array_sum($relationship_stats) / count($relationship_stats);
     }
     $this->relationship_stats = array('min' => $minimum_relation, 'max' => $maximum_relation, 'avg' => $average_relation);
     $this->inner_HTML = $this->generate_inner_html($links);
     $content = parent::render();
     return $content;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:26,代码来源:MISReportModule.php

示例8: save

 public function save($con = null, $parent = null)
 {
     try {
         $con = Propel::getConnection();
         $con->begin();
         if (!$this->getId()) {
             $this->setId(Document::getGenericDocument($this)->getId());
         }
         parent::save($con);
         // create relationship
         if (!$parent && !Document::getParentOf($this->getId())) {
             $parent = Rootfolder::getRootfolder($this);
         }
         Relation::saveRelation($parent, $this);
         $con->commit();
         Document::cacheObj($this, get_class($this));
         // get Lists object
         if (!$parent) {
             $parent = Document::getParentOf($this->getId());
         }
         // update list cache
         if (get_class($parent) == "Lists") {
             Lists::updateListCache($parent->getListId());
         }
         return true;
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
开发者ID:kotow,项目名称:work,代码行数:30,代码来源:Listitem.php

示例9: getRelationModel

 public static function getRelationModel($id, $relationType)
 {
     $model = Relation::where('model_name', $relationType)->where('model_id', $id)->first();
     if ($model) {
         return $relationType::find($model->relation_id);
     }
     return null;
 }
开发者ID:trantung,项目名称:company,代码行数:8,代码来源:CommonSite.php

示例10: parse_rule

 /**
  * @param string $rules
  *
  * @return Relation[][]
  */
 private static function parse_rule($rules)
 {
     $rules = self::extract_rule($rules);
     array_walk_recursive($rules, function (&$rule) {
         $rule = Relation::from($rule);
     });
     return $rules;
 }
开发者ID:icanboogie,项目名称:cldr,代码行数:13,代码来源:Rule.php

示例11: getAffectedInvConjunctIds

 public static function getAffectedInvConjunctIds($fullRelationSignature)
 {
     $allRelations = Relation::getAllRelations();
     if (!array_key_exists($fullRelationSignature, $allRelations)) {
         throw new Exception("Relation \\'{$fullRelationSignature}\\' does not exists in allRelations", 500);
     }
     return (array) $allRelations[$fullRelationSignature]['affectedInvConjunctIds'];
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:8,代码来源:Relation.php

示例12: delete

 public function delete($con = null)
 {
     $originalCacheRelations = sfConfig::get('sf_cache_relations');
     sfConfig::set('sf_cache_relations', false);
     try {
         $docId = $this->getId();
         $con = Propel::getConnection();
         $con->begin();
         // delete child relation
         $c = new Criteria();
         $c->add(RelationPeer::ID2, $docId);
         $relations = RelationPeer::doSelect($c);
         foreach ($relations as $relation) {
             $relation->delete(null, sfConfig::get('sf_cache_relations'));
             //$relation->delete();
         }
         // delete parent relations
         $children = Document::getChildrenOf($docId);
         foreach ($children as $child) {
             $relation = new Relation();
             $relation->setId1($docId);
             $relation->setId2($child->getId());
             $child->delete();
             $relation->delete();
         }
         // delete any tags for this document
         $c = new Criteria();
         $c->add(TagrelationPeer::ID, $docId);
         $tagRelations = TagrelationPeer::doSelect($c);
         foreach ($tagRelations as $tag) {
             $tag->delete();
         }
         parent::delete();
         $con->commit();
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
     // set 'sf_cache_relations' it's original value
     sfConfig::set('sf_cache_relations', $originalCacheRelations);
     if ($originalCacheRelations) {
         Relation::updateRelationCache();
     }
     return true;
 }
开发者ID:kotow,项目名称:work,代码行数:45,代码来源:Document.php

示例13: follow

 public function follow($user2_id)
 {
     $relation = Relation::where('user1_id', '=', $this->id)->where('user2_id', '=', $user2_id)->get()->first();
     if ($relation) {
         return $relation->type;
     } else {
         return 0;
     }
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:9,代码来源:User.php

示例14: getArray

 private function getArray(CDbCriteria $criteria)
 {
     $result = Relation::model()->findAll($criteria);
     $users = array();
     foreach ($result as $value) {
         array_push($users, $value->subUserId);
     }
     return array_values($users);
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:9,代码来源:RelationComponent.php

示例15: run

 public function run()
 {
     try {
         // 共通設定取得
         $base_dir = dirname(__FILE__) . '/../';
         $config = new Config($base_dir);
         $debug = $config->get_param('debug');
         // レポート用オブジェクト
         $report = new Report($config);
         // メンバー一覧のオブジェクト
         $member = new Member($config);
         // 担当者マスターの差分を取得する。
         $member->get_diff();
         $this->mail_body .= $member->print_diff();
         // プロジェクト一覧のオブジェクト
         $project = new Project($config);
         // プロジェクトマスターの差分を取得する。
         $project->get_diff();
         $this->mail_body .= $project->print_diff();
         // 担当プロジェクトのオブジェクト
         $relation = new Relation($config);
         // 担当プロジェクトの差分を取得する。
         $relation->set_member($member);
         $relation->set_project($project);
         $relation->get_diff();
         $this->mail_body .= $relation->print_diff();
         // BackLogIDが入力されているにもかかわらず担当者名が未入力のデータを検出する。
         $this->mail_body .= $relation->validate();
         // 複数コンテンツ障害の配信先
         // 全社向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('all');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // コンテンツ事業部向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('contents');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // レポート
         $report->out($this->mail_body);
         // 古いファイルを削除
         Util::remove_old_file($config->get_param('data_dir'), $config->get_param('keep_file_days'));
     } catch (Exception $e) {
         $member->remove();
         $project->remove();
         $relation->remove();
         $multi_alert->remove();
         if ($debug) {
             print $e->getMessage() . PHP_EOL;
         } else {
             $report->out($e->getMessage());
         }
     }
 }
开发者ID:cy-daisuke-senmyou,项目名称:SukumeRequestChecker,代码行数:59,代码来源:Main.php


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