1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: */
11:
12: namespace Nette\Database;
13:
14: use Nette;
15:
16:
17:
18: /**
19: * Represents a single table row.
20: *
21: * @author David Grudl
22: */
23: class Row extends Nette\ArrayHash
24: {
25:
26: public function __construct(Statement $statement)
27: {
28: $statement->normalizeRow($this);
29: }
30:
31:
32:
33: /**
34: * Returns a item.
35: * @param mixed key or index
36: * @return mixed
37: */
38: public function offsetGet($key)
39: {
40: if (is_int($key)) {
41: $arr = array_values((array) $this);
42: return $arr[$key];
43: }
44: return $this->$key;
45: }
46:
47: }
48: