--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Pagerfanta/Adapter/DoctrineCollectionAdapter.php Fri Oct 21 17:10:54 2011 +0200
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This file is part of the Pagerfanta package.
+ *
+ * (c) Pablo Díez <pablodip@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Pagerfanta\Adapter;
+
+use Doctrine\Common\Collections\Collection;
+
+/**
+ * DoctrineCollectionAdapter.
+ *
+ * @author Pablo Díez <pablodip@gmail.com>
+ *
+ * @api
+ */
+class DoctrineCollectionAdapter implements AdapterInterface
+{
+ private $collection;
+
+ /**
+ * Constructor.
+ *
+ * @param Collection $collection A Doctrine collection.
+ *
+ * @api
+ */
+ public function __construct(Collection $collection)
+ {
+ $this->collection = $collection;
+ }
+
+ /**
+ * Returns the collection.
+ *
+ * @return Collection The collection.
+ *
+ * @api
+ */
+ public function getCollection()
+ {
+ return $this->collection;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getNbResults()
+ {
+ return $this->collection->count();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSlice($offset, $length)
+ {
+ return $this->collection->slice($offset, $length);
+ }
+}