本文整理匯總了PHP中FileSet::Find方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSet::Find方法的具體用法?PHP FileSet::Find怎麽用?PHP FileSet::Find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileSet
的用法示例。
在下文中一共展示了FileSet::Find方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createAndGetSet
/**
* Creats a new fileset if set doesn't exists
*
* If we find a multiple groups with the same properties,
* we return an array containing each group
* @param string $fs_name
* @param int $fs_type
* @param int $fs_uid
* @return Mixed
*
* Dev Note: This will create duplicate sets with the same name if a set exists owned by another user!!!
*/
public static function createAndGetSet($fs_name, $fs_type, $fs_uid=false) {
if (!$fs_uid) {
$u = new User();
$fs_uid = $u->uID;
}
$file_set = new FileSet();
$criteria = array($fs_name,$fs_type,$fs_uid);
$matched_sets = $file_set->Find('fsName=? AND fsType=? and uID=?',$criteria);
if (1 === count($matched_sets) ) {
return $matched_sets[0];
}
else if (1 < count($matched_sets)) {
return $matched_sets;
}
else{
//AS: Adodb Active record is complaining a ?/value array mismatch unless
//we explicatly set the primary key ID field to null
$file_set->fsID = null;
$file_set->fsName = $fs_name;
$file_set->fsOverrideGlobalPermissions = 0;
$file_set->fsType = $fs_type;
$file_set->uID = $fs_uid;
$file_set->save();
return $file_set;
}
}