Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • Connection
  • Helpers
  • Row
  • SqlLiteral
  • SqlPreprocessor
  • Statement

Interfaces

  • IReflection
  • ISupplementalDriver
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 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:  * Represents a single table row.
19:  *
20:  * @author     David Grudl
21:  */
22: class Row extends Nette\ArrayHash
23: {
24: 
25:     public function __construct(Statement $statement)
26:     {
27:         $data = array();
28:         foreach ((array) $this as $key => $value) {
29:             $data[$key] = $value;
30:             unset($this->$key);
31:         }
32:         foreach ($statement->normalizeRow($data) as $key => $value) {
33:             $this->$key = $value;
34:         }
35:     }
36: 
37: 
38:     /**
39:      * Returns a item.
40:      * @param  mixed  key or index
41:      * @return mixed
42:      */
43:     public function offsetGet($key)
44:     {
45:         if (is_int($key)) {
46:             $arr = array_slice((array) $this, $key, 1);
47:             if (!$arr) {
48:                 trigger_error('Undefined offset: ' . __CLASS__ . "[$key]", E_USER_NOTICE);
49:             }
50:             return current($arr);
51:         }
52:         return $this->$key;
53:     }
54: 
55: 
56:     public function offsetExists($key)
57:     {
58:         if (is_int($key)) {
59:             return (bool) array_slice((array) $this, $key, 1);
60:         }
61:         return parent::offsetExists($key);
62:     }
63: 
64: }
65: 
Nette Framework 2.0.12 API API documentation generated by ApiGen 2.8.0