コード例 #1
0
 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(KuserToUserRolePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     $stmt = KuserToUserRolePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
         $this->akuser = null;
         $this->aUserRole = null;
     }
     // if (deep)
 }
 /**
  * Selects a collection of KuserToUserRole objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of KuserToUserRole objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     KuserToUserRolePeer::addSelectColumns($criteria);
     $startcol2 = KuserToUserRolePeer::NUM_COLUMNS - KuserToUserRolePeer::NUM_LAZY_LOAD_COLUMNS;
     kuserPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (kuserPeer::NUM_COLUMNS - kuserPeer::NUM_LAZY_LOAD_COLUMNS);
     UserRolePeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + (UserRolePeer::NUM_COLUMNS - UserRolePeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(KuserToUserRolePeer::KUSER_ID, kuserPeer::ID, $join_behavior);
     $criteria->addJoin(KuserToUserRolePeer::USER_ROLE_ID, UserRolePeer::ID, $join_behavior);
     $stmt = KuserToUserRolePeer::doSelectStmt($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = KuserToUserRolePeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = KuserToUserRolePeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = KuserToUserRolePeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             KuserToUserRolePeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined kuser rows
         $key2 = kuserPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = kuserPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = kuserPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 kuserPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (KuserToUserRole) to the collection in $obj2 (kuser)
             $obj2->addKuserToUserRole($obj1);
         }
         // if joined row not null
         // Add objects for joined UserRole rows
         $key3 = UserRolePeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = UserRolePeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = UserRolePeer::getOMClass(false);
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 UserRolePeer::addInstanceToPool($obj3, $key3);
             }
             // if obj3 loaded
             // Add the $obj1 (KuserToUserRole) to the collection in $obj3 (UserRole)
             $obj3->addKuserToUserRole($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
コード例 #3
0
 /**
  * Lists user objects that are associated with an account.
  * Blocked users are listed unless you use a filter to exclude them.
  * Deleted users are not listed unless you use a filter to include them.
  * 
  * @action list
  * @param KalturaUserFilter $filter A filter used to exclude specific types of users
  * @param KalturaFilterPager $pager A limit for the number of records to display on a page
  * @return KalturaUserListResponse The list of user objects
  */
 public function listAction(KalturaUserFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaUserFilter();
     }
     if (!$pager) {
         $pager = new KalturaFilterPager();
     }
     $userFilter = new kuserFilter();
     $filter->toObject($userFilter);
     $c = KalturaCriteria::create(kuserPeer::OM_CLASS);
     $userFilter->attachToCriteria($c);
     if (!is_null($filter->roleIdEqual)) {
         $roleCriteria = new Criteria();
         $roleCriteria->add(KuserToUserRolePeer::USER_ROLE_ID, $filter->roleIdEqual);
         $roleCriteria->addSelectColumn(KuserToUserRolePeer::KUSER_ID);
         $rs = KuserToUserRolePeer::doSelectStmt($roleCriteria);
         $kuserIds = $rs->fetchAll(PDO::FETCH_COLUMN);
         $c->add(kuserPeer::ID, $kuserIds, KalturaCriteria::IN);
     }
     $c->addAnd(kuserPeer::PUSER_ID, NULL, KalturaCriteria::ISNOTNULL);
     $pager->attachToCriteria($c);
     $list = kuserPeer::doSelect($c);
     $totalCount = $c->getRecordsCount();
     $newList = KalturaUserArray::fromUserArray($list);
     $response = new KalturaUserListResponse();
     $response->objects = $newList;
     $response->totalCount = $totalCount;
     return $response;
 }
コード例 #4
0
ファイル: KalturaUserFilter.php プロジェクト: DBezemer/server
 public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $userFilter = $this->toObject();
     $c = KalturaCriteria::create(kuserPeer::OM_CLASS);
     $userFilter->attachToCriteria($c);
     if (!is_null($this->roleIdEqual)) {
         $roleCriteria = new Criteria();
         $roleCriteria->add(KuserToUserRolePeer::USER_ROLE_ID, $this->roleIdEqual);
         $roleCriteria->addSelectColumn(KuserToUserRolePeer::KUSER_ID);
         $rs = KuserToUserRolePeer::doSelectStmt($roleCriteria);
         $kuserIds = $rs->fetchAll(PDO::FETCH_COLUMN);
         $c->add(kuserPeer::ID, $kuserIds, KalturaCriteria::IN);
     }
     if (is_null($this->typeEqual) && is_null($this->typeIn)) {
         $c->add(kuserPeer::TYPE, KuserType::USER, KalturaCriteria::EQUAL);
     }
     $c->addAnd(kuserPeer::PUSER_ID, NULL, KalturaCriteria::ISNOTNULL);
     $pager->attachToCriteria($c);
     $list = kuserPeer::doSelect($c);
     $totalCount = $c->getRecordsCount();
     $newList = KalturaUserArray::fromDbArray($list, $responseProfile);
     $response = new KalturaUserListResponse();
     $response->objects = $newList;
     $response->totalCount = $totalCount;
     return $response;
 }
コード例 #5
0
ファイル: kuser.php プロジェクト: richhl/kalturaCE
 /**
  * @return string Comma seperated string of role ids associated to the current user
  */
 public function getRoleIds()
 {
     if (is_null($this->roleIds)) {
         $this->roleIds = '';
         $c = new Criteria();
         $c->addSelectColumn(KuserToUserRolePeer::USER_ROLE_ID);
         $c->addAnd(KuserToUserRolePeer::KUSER_ID, $this->getId(), Criteria::EQUAL);
         $stmt = KuserToUserRolePeer::doSelectStmt($c);
         $ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
         $this->roleIds = implode(',', $ids);
     }
     return $this->roleIds;
 }