1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004, 2011 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: * @package Nette\Database
11: */
12:
13:
14:
15: /**
16: * Represents a single table row.
17: *
18: * @author David Grudl
19: */
20: class NRow extends NArrayHash
21: {
22:
23: public function __construct($statement)
24: {
25: $statement->normalizeRow($this);
26: }
27:
28:
29:
30: /**
31: * Returns a item.
32: * @param mixed key or index
33: * @return mixed
34: */
35: public function offsetGet($key)
36: {
37: if (is_int($key)) {
38: $arr = array_values((array) $this);
39: return $arr[$key];
40: }
41: return $this->$key;
42: }
43:
44: }
45: