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


PHP Relationship::ManyToOneType方法代码示例

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


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

示例1: Query

 /**
  * Gets the classes whose objects the user can execute certain action
  *
  * @param $action object - The action that the user should be allowed to do
  * @param $user User - The user that holds de permissions
  * @return Array - an array of class objects
  */
 function &findByPermission($action, $user)
 {
     $classQuery = new Query("Class");
     // Navigate relationships
     $folderClassQuery =& $classQuery->queryRelationedClass("FolderClass");
     $permissionQuery =& $folderClassQuery->queryRelationedClass("Permission");
     $actionQuery =& $permissionQuery->queryRelationedClass("Action", Relationship::ManyToOneType());
     $roleQuery =& $permissionQuery->queryRelationedClass("Role", Relationship::ManyToOneType());
     $roleUserQuery =& $roleQuery->queryRelationedClass("RoleUser");
     $userQuery =& $roleUserQuery->queryRelationedClass("User", Relationship::ManyToOneType());
     // Criterias
     $criteriaGroup = new CriteriaGroup();
     $actionCriteria = new Criteria($actionQuery, "action", $action->getAction());
     $userCriteria = new Criteria($userQuery, "ID", $user->getId());
     $criteriaGroup->addCriterion($actionCriteria);
     $criteriaGroup->addCriterion($userCriteria);
     $classQuery->setCriterion($criteriaGroup);
     // sorting
     $order = new Order($classQuery, "title", "ASC");
     $classQuery->addOrder($order);
     // Execute the query
     $recordset =& $classQuery->execute();
     $array = $this->mapAll($recordset);
     return $array;
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:32,代码来源:baseClassMapper.php

示例2: CriteriaGroup

 /**
  * Gets the folders for a user to do certain action.
  *
  * @param $action Action - that the user intends to do
  * @param $user User - the user that tries to get his folders.
  * @return Array - vector of folder objects
  */
 function &findByPermission($action, $user)
 {
     $folderQuery = $this->newQueryObject();
     $folderClassQuery =& $folderQuery->queryRelationedClass("FolderClass");
     $permissionQuery =& $folderClassQuery->queryRelationedClass("Permission");
     $actionQuery =& $permissionQuery->queryRelationedClass("Action", Relationship::ManyToOneType());
     $roleQuery =& $permissionQuery->queryRelationedClass("Role", Relationship::ManyToOneType());
     $roleUserQuery =& $roleQuery->queryRelationedClass("RoleUser");
     $criteriaGroup = new CriteriaGroup();
     $actionCriteria = new Criteria($actionQuery, "action", $action->getAction());
     $criteriaGroup->addCriterion($actionCriteria);
     $userCriteria = new Criteria($roleUserQuery, "userID", $user->getId());
     $criteriaGroup->addCriterion($userCriteria);
     // Set the criterion
     $folderQuery->setCriterion($criteriaGroup);
     // Execute
     return $this->mapAll($folderQuery->execute());
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:25,代码来源:folderMapper.php

示例3: Criteria

 /**
  * Gets the objects in a given folder
  * 
  * @param $folderId id of a certain folder
  * @return List of Object class objects
  */
 function &findByFolder($folderId)
 {
     $objectQuery = $this->newQueryObject();
     $objectFolderQuery =& $objectQuery->queryRelationedClass("ObjectFolder");
     $folderQuery =& $objectFolderQuery->queryRelationedClass("Folder", Relationship::ManyToOneType());
     $criteria =& new Criteria($folderQuery, "ID", $folderId);
     $objectQuery->setCriterion($criteria);
     $order = new Order($objectFolderQuery, "position", Order::OrderTypeAsc());
     $objectQuery->addOrder($order);
     return $this->mapAll($objectQuery->execute());
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:17,代码来源:objectMapper.php


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