本文整理汇总了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;
}