/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = KuserToUserRolePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setKuserId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setUserRoleId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCreatedAt($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUpdatedAt($arr[$keys[4]]); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(KuserToUserRolePeer::DATABASE_NAME); $criteria->add(KuserToUserRolePeer::ID, $pks, Criteria::IN); $objs = KuserToUserRolePeer::doSelect($criteria, $con); } return $objs; }
/** * @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->addAnd(KuserToUserRolePeer::KUSER_ID, $this->getId(), Criteria::EQUAL); $selectResults = KuserToUserRolePeer::doSelect($c); foreach ($selectResults as $selectResult) { if ($this->roleIds != '') { $this->roleIds .= ','; } $this->roleIds .= $selectResult->getUserRoleId(); } } return $this->roleIds; }
/** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = new Criteria(KuserToUserRolePeer::DATABASE_NAME); $criteria->add(KuserToUserRolePeer::ID, $this->id); if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(KuserToUserRolePeer::UPDATED_AT)) { $theModifiedColumn = null; foreach ($this->modifiedColumns as $modifiedColumn) { if ($modifiedColumn != KuserToUserRolePeer::UPDATED_AT) { $theModifiedColumn = $modifiedColumn; } } $atomicColumns = KuserToUserRolePeer::getAtomicColumns(); if (in_array($theModifiedColumn, $atomicColumns)) { $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL); } } return $criteria; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this kuser is new, it will return * an empty collection; or if this kuser has previously * been saved, it will retrieve related KuserToUserRoles from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in kuser. */ public function getKuserToUserRolesJoinUserRole($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(kuserPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collKuserToUserRoles === null) { if ($this->isNew()) { $this->collKuserToUserRoles = array(); } else { $criteria->add(KuserToUserRolePeer::KUSER_ID, $this->id); $this->collKuserToUserRoles = KuserToUserRolePeer::doSelectJoinUserRole($criteria, $con, $join_behavior); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(KuserToUserRolePeer::KUSER_ID, $this->id); if (!isset($this->lastKuserToUserRoleCriteria) || !$this->lastKuserToUserRoleCriteria->equals($criteria)) { $this->collKuserToUserRoles = KuserToUserRolePeer::doSelectJoinUserRole($criteria, $con, $join_behavior); } } $this->lastKuserToUserRoleCriteria = $criteria; return $this->collKuserToUserRoles; }
<?php /** * enable feature for each partner * set to all partners with partner->partnerPackage > 1 to 1 * @package Deployment * @subpackage updates */ $dryRun = true; //TODO: change for real run if (in_array('realrun', $argv)) { $dryRun = false; } require_once dirname(__FILE__) . '/../../bootstrap.php'; $con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2); KalturaStatement::setDryRun($dryRun); $c = new Criteria(); $c->add(UserRolePeer::NAME, "System Administrator", Criteria::EQUAL); $adminRoles = UserRolePeer::doSelect($c, $con); foreach ($adminRoles as $adminRole) { $c = new Criteria(); $c->add(KuserToUserRolePeer::USER_ROLE_ID, $adminRole->getId(), Criteria::EQUAL); $admins = KuserToUserRolePeer::doSelect($c, $con); foreach ($admins as $admin) { $adminUser = $admin->getkuser($con); if ($adminUser) { $adminUser->setAllowedPartners('*'); $adminUser->save(); } } }
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; }
/** * 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; }
/** * @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; }
public static function clearMemory() { accessControlPeer::clearInstancePool(); kuserPeer::clearInstancePool(); kshowPeer::clearInstancePool(); entryPeer::clearInstancePool(); // kvotePeer::clearInstancePool(); // commentPeer::clearInstancePool(); // flagPeer::clearInstancePool(); // favoritePeer::clearInstancePool(); // KshowKuserPeer::clearInstancePool(); // MailJobPeer::clearInstancePool(); SchedulerPeer::clearInstancePool(); SchedulerWorkerPeer::clearInstancePool(); SchedulerStatusPeer::clearInstancePool(); SchedulerConfigPeer::clearInstancePool(); ControlPanelCommandPeer::clearInstancePool(); BatchJobPeer::clearInstancePool(); // PriorityGroupPeer::clearInstancePool(); BulkUploadResultPeer::clearInstancePool(); // blockedEmailPeer::clearInstancePool(); // conversionPeer::clearInstancePool(); // flickrTokenPeer::clearInstancePool(); PuserKuserPeer::clearInstancePool(); // PuserRolePeer::clearInstancePool(); PartnerPeer::clearInstancePool(); // WidgetLogPeer::clearInstancePool(); // adminKuserPeer::clearInstancePool(); // notificationPeer::clearInstancePool(); moderationPeer::clearInstancePool(); moderationFlagPeer::clearInstancePool(); roughcutEntryPeer::clearInstancePool(); // widgetPeer::clearInstancePool(); uiConfPeer::clearInstancePool(); // PartnerStatsPeer::clearInstancePool(); // PartnerActivityPeer::clearInstancePool(); ConversionProfilePeer::clearInstancePool(); // ConversionParamsPeer::clearInstancePool(); // KceInstallationErrorPeer::clearInstancePool(); FileSyncPeer::clearInstancePool(); accessControlPeer::clearInstancePool(); mediaInfoPeer::clearInstancePool(); assetParamsPeer::clearInstancePool(); assetParamsOutputPeer::clearInstancePool(); assetPeer::clearInstancePool(); conversionProfile2Peer::clearInstancePool(); flavorParamsConversionProfilePeer::clearInstancePool(); categoryPeer::clearInstancePool(); syndicationFeedPeer::clearInstancePool(); TrackEntryPeer::clearInstancePool(); // SystemUserPeer::clearInstancePool(); StorageProfilePeer::clearInstancePool(); // EmailIngestionProfilePeer::clearInstancePool(); UploadTokenPeer::clearInstancePool(); // invalidSessionPeer::clearInstancePool(); DynamicEnumPeer::clearInstancePool(); UserLoginDataPeer::clearInstancePool(); PermissionPeer::clearInstancePool(); UserRolePeer::clearInstancePool(); PermissionItemPeer::clearInstancePool(); PermissionToPermissionItemPeer::clearInstancePool(); KuserToUserRolePeer::clearInstancePool(); $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaMemoryCleaner'); foreach ($pluginInstances as $pluginInstance) { $pluginInstance->cleanMemory(); } if (function_exists('gc_collect_cycles')) { // php 5.3 and above gc_collect_cycles(); } }