diff options
author | Alex Legler <alex@a3li.li> | 2015-08-15 13:32:14 +0200 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2015-08-15 13:32:14 +0200 |
commit | d0cbe50515ded38cebcacb2c5690114caf610687 (patch) | |
tree | 9720ef5feb52b7233ec55d4b3f67a63bb2600ac1 /Flow/includes/Log/Query.php | |
parent | Add Thanks (diff) | |
download | extensions-d0cbe50515ded38cebcacb2c5690114caf610687.tar.gz extensions-d0cbe50515ded38cebcacb2c5690114caf610687.tar.bz2 extensions-d0cbe50515ded38cebcacb2c5690114caf610687.zip |
Add Flow
Diffstat (limited to 'Flow/includes/Log/Query.php')
-rw-r--r-- | Flow/includes/Log/Query.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Flow/includes/Log/Query.php b/Flow/includes/Log/Query.php new file mode 100644 index 00000000..256c92b4 --- /dev/null +++ b/Flow/includes/Log/Query.php @@ -0,0 +1,43 @@ +<?php + +namespace Flow\Log; + +use Flow\Formatter\AbstractQuery; +use Flow\Model\PostRevision; +use Flow\Model\UUID; + +class LogQuery extends AbstractQuery { + /** + * @param UUID[] $uuids + */ + public function loadMetadataBatch( $uuids ) { + $posts = $this->loadPostsBatch( $uuids ); + parent::loadMetadataBatch( $posts ); + } + + /** + * @param UUID[] $uuids + * @return PostRevision[] + */ + protected function loadPostsBatch( array $uuids ) { + $queries = array(); + foreach ( $uuids as $uuid ) { + $queries[] = array( 'rev_type_id' => $uuid ); + } + + $found = $this->storage->findMulti( + 'PostRevision', + $queries, + array( 'sort' => 'rev_id', 'order' => 'DESC', 'limit' => 1 ) + ); + + $revisions = array(); + foreach ( $found as $result ) { + /** @var PostRevision $revision */ + $revision = reset( $result ); + $revisions[$revision->getPostId()->getAlphadecimal()] = $revision; + } + + return $revisions; + } +} |