+ unset($this->references[$r]);
+ }
+
+ /**
+ * Get a reference to a table
+ * @param string $table
+ * @param string $ref
+ * @return \pq\Gateway\Table\Reference
+ */
+ function getReference($table, $ref = null) {
+ if (isset($this->references[$table])) {
+ if (!strlen($ref)) {
+ return current($this->references[$table]);
+ }
+ if (isset($this->references[$table][$ref])) {
+ return $this->references[$table][$ref];
+ }
+ }
+ }
+
+ /**
+ * Implements \Countable
+ * @return int
+ */
+ function count() {
+ return array_sum(array_map("count", $this->references));
+ }
+
+ /**
+ * Implements \IteratorAggregate
+ * @return \ArrayIterator
+ */
+ function getIterator() {
+ return new \ArrayIterator($this->references);