Rowset
authorMichael Wallner <mike@php.net>
Wed, 15 Oct 2014 13:48:31 +0000 (15:48 +0200)
committerMichael Wallner <mike@php.net>
Wed, 15 Oct 2014 13:48:31 +0000 (15:48 +0200)
22 files changed:
pq-gateway/pq/Gateway/Rowset.md
pq-gateway/pq/Gateway/Rowset/__construct.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/__invoke.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/append.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/apply.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/count.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/create.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/current.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/delete.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/filter.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/getRowPrototype.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/getRows.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/getTable.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/hydrate.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/jsonSerialize.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/key.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/next.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/rewind.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/seek.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/setRowPrototype.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/update.md [new file with mode: 0644]
pq-gateway/pq/Gateway/Rowset/valid.md [new file with mode: 0644]

index 2a433350e21809f934ceff4d69b4acf148bab12f..80d176213d73f500af3581a438b48d6dbb80ba54 100644 (file)
@@ -1,4 +1,4 @@
-# class pq\Gateway\Rowset implements SeekableIterator, JsonSerialize, Countable
+# class pq\Gateway\Rowset implements SeekableIterator, JsonSerializable, Countable
 
 The rowset gateway.
 
diff --git a/pq-gateway/pq/Gateway/Rowset/__construct.md b/pq-gateway/pq/Gateway/Rowset/__construct.md
new file mode 100644 (file)
index 0000000..f8a8b76
--- /dev/null
@@ -0,0 +1,10 @@
+# void pq\Gateway\Rowset::__construct(pq\Gateway\Table $table[, pq\Result $result = NULL])
+
+Create a new rowset gateway.
+
+## Params:
+
+* pq\Gateway\Table $table  
+  The originating table.
+* Optional pq\Result $result = NULL  
+  A result to hydrate.
diff --git a/pq-gateway/pq/Gateway/Rowset/__invoke.md b/pq-gateway/pq/Gateway/Rowset/__invoke.md
new file mode 100644 (file)
index 0000000..96ad69a
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::__invoke([pq\Result $result = NULL])
+
+Copy constructor.
+
+## Params:
+
+* Optional pq\Result $result = NULL  
+  The result the clone should hydrate.
+
+## Returns:
+
+* pq\Gateway\Rowset, clone.
diff --git a/pq-gateway/pq/Gateway/Rowset/append.md b/pq-gateway/pq/Gateway/Rowset/append.md
new file mode 100644 (file)
index 0000000..cff4b1b
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::append(pq\Gateway\Row $row)
+
+Append a row to the rowset.
+
+## Params:
+
+* pq\Gateway\Row $row
+  The row to append.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/apply.md b/pq-gateway/pq/Gateway/Rowset/apply.md
new file mode 100644 (file)
index 0000000..8ede9ab
--- /dev/null
@@ -0,0 +1,26 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::apply(callable $cb)
+
+Apply a callback to each row of this rowset.
+
+## Params:
+
+* callable $cb  
+  A callback as function(pq\Gateway\Row $row, pq\Gateway\Rowset $rowset).
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
+
+## Example:
+
+       <?php
+       
+       use pq\Gateway\Table;
+       
+       $table = new Table("account");
+       $table->find()->apply(function($row) {
+               printf("Hello %s!\n", $row->name);
+       });
+       
+       ?>
+       
diff --git a/pq-gateway/pq/Gateway/Rowset/count.md b/pq-gateway/pq/Gateway/Rowset/count.md
new file mode 100644 (file)
index 0000000..81babf3
--- /dev/null
@@ -0,0 +1,11 @@
+# int pq\Gateway\Rowset::count()
+
+Implements Countable.
+
+## Params:
+
+None.
+
+## Returns:
+
+* int, the number of rows in this rowset.
diff --git a/pq-gateway/pq/Gateway/Rowset/create.md b/pq-gateway/pq/Gateway/Rowset/create.md
new file mode 100644 (file)
index 0000000..a20e706
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::create([mixed $txn = TRUE])
+
+Create all rows in this rowset.
+
+## Params:
+
+* Optional mixed $txn = TRUE  
+  Whether to perform the inserts within an transaction, could also be an instance of pq\Transaction to use.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/current.md b/pq-gateway/pq/Gateway/Rowset/current.md
new file mode 100644 (file)
index 0000000..2115d52
--- /dev/null
@@ -0,0 +1,11 @@
+# pq\Gateway\Row pq\Gateway\Rowset::current()
+
+Implements Iterator.
+
+## Params:
+
+None.
+
+## Returns:
+
+* pq\Gateway\Row, the current iterator element.
diff --git a/pq-gateway/pq/Gateway/Rowset/delete.md b/pq-gateway/pq/Gateway/Rowset/delete.md
new file mode 100644 (file)
index 0000000..dc519b3
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::delete([mixed $txn = TRUE])
+
+Delete all rows in this rowset.
+
+## Params:
+
+* Optional mixed $txn = TRUE  
+  Whether to perform the deletes within an transaction, could also be an instance of pq\Transaction to use.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/filter.md b/pq-gateway/pq/Gateway/Rowset/filter.md
new file mode 100644 (file)
index 0000000..def3a3c
--- /dev/null
@@ -0,0 +1,28 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::filter(callable $cb)
+
+Filter the rows a copy of the rowset should contain.
+
+## Params:
+
+* callable $cb  
+  A filter callback which should return bool as function(pq\Gateway\Row $row)
+
+## Returns:
+
+* pq\Gateway\Rowset, clone.
+
+## Example:
+
+       <?php
+       
+       use pq\Gateway\Table;
+       
+       $table = new Table("account");
+       $table->find()
+               ->apply(function($row) {
+                       // ...
+               })->filter(function ($row) {
+                       return $row->isDirty();
+               })->update();
+       
+       ?>
diff --git a/pq-gateway/pq/Gateway/Rowset/getRowPrototype.md b/pq-gateway/pq/Gateway/Rowset/getRowPrototype.md
new file mode 100644 (file)
index 0000000..554a63a
--- /dev/null
@@ -0,0 +1,4 @@
+# mixed pq\Gateway\Rowset::getRowPrototype()
+
+Retrieve the row prototype.
+See pq\Gatway\Rowset::setRowPrototype().
diff --git a/pq-gateway/pq/Gateway/Rowset/getRows.md b/pq-gateway/pq/Gateway/Rowset/getRows.md
new file mode 100644 (file)
index 0000000..40ea179
--- /dev/null
@@ -0,0 +1,11 @@
+# array pq\Gateway\Rowset::getRows()
+
+Retrieve the rows this rowset contains.
+
+## Params:
+
+None.
+
+## Returns:
+
+array, the rows of this rowset.
diff --git a/pq-gateway/pq/Gateway/Rowset/getTable.md b/pq-gateway/pq/Gateway/Rowset/getTable.md
new file mode 100644 (file)
index 0000000..4e64b36
--- /dev/null
@@ -0,0 +1,11 @@
+# pq\Gateway\Table pq\Gateway\Rowset::getTable()
+
+Retrieve the table from which this rowset originates.
+
+## Params:
+
+None.
+
+## Returns:
+
+* pq\Gateway\Table, the originating table.
diff --git a/pq-gateway/pq/Gateway/Rowset/hydrate.md b/pq-gateway/pq/Gateway/Rowset/hydrate.md
new file mode 100644 (file)
index 0000000..ab68093
--- /dev/null
@@ -0,0 +1,12 @@
+# protected pq\Gateway\Rowset pq\Gateway\Rowset::hydrate([pq\Result $result = NULL])
+
+Hydrate a result.
+
+## Params:
+
+* Optional pq\Result $result = NULL  
+  The result from which to extract the rows into the rowset.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/jsonSerialize.md b/pq-gateway/pq/Gateway/Rowset/jsonSerialize.md
new file mode 100644 (file)
index 0000000..d99462d
--- /dev/null
@@ -0,0 +1,11 @@
+# array pq\Gateway\Rowset::jsonSerialize()
+
+Implements JsonSerializable.
+
+## Params:
+
+None.
+
+## Returns:
+
+* array, list of rows, which have also been prepared for JSON serialization.
diff --git a/pq-gateway/pq/Gateway/Rowset/key.md b/pq-gateway/pq/Gateway/Rowset/key.md
new file mode 100644 (file)
index 0000000..88598a5
--- /dev/null
@@ -0,0 +1,11 @@
+# int pq\Gateway\Rowset::key()
+
+Implements Iterator.
+
+## Params:
+
+None.
+
+## Returns:
+
+* int, the iterator index.
diff --git a/pq-gateway/pq/Gateway/Rowset/next.md b/pq-gateway/pq/Gateway/Rowset/next.md
new file mode 100644 (file)
index 0000000..9302884
--- /dev/null
@@ -0,0 +1,7 @@
+# void pq\Gateway\Rowset::next()
+
+Implements Iterator.
+
+## Params:
+
+None.
diff --git a/pq-gateway/pq/Gateway/Rowset/rewind.md b/pq-gateway/pq/Gateway/Rowset/rewind.md
new file mode 100644 (file)
index 0000000..8798476
--- /dev/null
@@ -0,0 +1,7 @@
+# void pq\Gateway\Rowset::rewind()
+
+Implements Iterator.
+
+## Params:
+
+None.
diff --git a/pq-gateway/pq/Gateway/Rowset/seek.md b/pq-gateway/pq/Gateway/Rowset/seek.md
new file mode 100644 (file)
index 0000000..fac1856
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::seek(int $pos)
+
+Implements SeekableIterator.
+
+## Params:
+
+* int $pos  
+  The position to seek to.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/setRowPrototype.md b/pq-gateway/pq/Gateway/Rowset/setRowPrototype.md
new file mode 100644 (file)
index 0000000..90bcda1
--- /dev/null
@@ -0,0 +1,29 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::setRowPrototype(mixed $row)
+
+Set the row prototype.
+
+## Params:
+
+* mixed $row  
+  The name of a class extending pq\Gateway\Row or a callable as function(array $data).
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
+
+## Example:
+
+       <?php
+       
+       use pq\Gateway as gw;
+       
+       class Account extends gw\Row {
+               // ...
+       }
+       
+       $table = new gw\Table("account");
+       $table->setRowsetPrototype(
+               (new gw\Rowset($table))->setRowPrototype(new Account($table))
+       );
+       
+       ?>
diff --git a/pq-gateway/pq/Gateway/Rowset/update.md b/pq-gateway/pq/Gateway/Rowset/update.md
new file mode 100644 (file)
index 0000000..3551e18
--- /dev/null
@@ -0,0 +1,12 @@
+# pq\Gateway\Rowset pq\Gateway\Rowset::update([mixed $txn = TRUE])
+
+Update all rows in this rowset.
+
+## Params:
+
+* Optional mixed $txn = TRUE  
+  Whether to perform the updates within an transaction, could also be an instance of pq\Transaction to use.
+
+## Returns:
+
+* pq\Gateway\Rowset, self.
diff --git a/pq-gateway/pq/Gateway/Rowset/valid.md b/pq-gateway/pq/Gateway/Rowset/valid.md
new file mode 100644 (file)
index 0000000..b84a25b
--- /dev/null
@@ -0,0 +1,11 @@
+# bool pq\Gateway\Rowset::valid()
+
+Implements Iterator.
+
+## Params:
+
+None.
+
+## Returns:
+
+* bool, whether the iterator's state is valid.