本文整理匯總了PHP中FileModel::attachmentTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileModel::attachmentTable方法的具體用法?PHP FileModel::attachmentTable怎麽用?PHP FileModel::attachmentTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileModel
的用法示例。
在下文中一共展示了FileModel::attachmentTable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetchObjectIdsByInstance
/**
* Fetches all object IDs, arranged by objectType, that belong to the given instance
*
* Array returned is of the form:
*
* array {
* ['<objectType>'] => array {
* [<objectID>] => true
* }
* }
*
* @param integer|string instance ID
* @return Array
*/
public static function fetchObjectIdsByInstance($instanceID)
{
if (!isset(self::$attachmentTable)) {
self::$attachmentTable = QFrame_Db_Table::getTable('attachment');
}
$result = array();
// Get all files assocated with this instance ID
$select = self::$attachmentTable->getAdapter()->select()->from(array('a' => 'attachment'), array('objectType', 'objectID'))->where('a.instanceID = ?', $instanceID);
$stmt = self::$attachmentTable->getAdapter()->query($select);
$rows = $stmt->fetchAll();
// Sort files by objectType and add them to the array to be returned
foreach ($rows as $row) {
$result[$row['objectType']][$row['objectID']] = true;
}
return $result;
}