Packages

  • 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

Classes

Interfaces

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  * @package Nette\Database
 7:  */
 8: 
 9: 
10: 
11: /**
12:  * Represents a single table row.
13:  *
14:  * @author     David Grudl
15:  * @package Nette\Database
16:  */
17: class NRow extends NArrayHash
18: {
19: 
20:     public function __construct(NStatement $statement)
21:     {
22:         $data = array();
23:         foreach ((array) $this as $key => $value) {
24:             $data[$key] = $value;
25:             unset($this->$key);
26:         }
27:         foreach ($statement->normalizeRow($data) as $key => $value) {
28:             $this->$key = $value;
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_slice((array) $this, $key, 1);
42:             if (!$arr) {
43:                 trigger_error('Undefined offset: ' . __CLASS__ . "[$key]", E_USER_NOTICE);
44:             }
45:             return current($arr);
46:         }
47:         return $this->$key;
48:     }
49: 
50: 
51:     /**
52:      * Checks if $key exists.
53:      * @param  mixed  key or index
54:      * @return bool
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.18 (for PHP 5.2, prefixed) API documentation generated by ApiGen 2.8.0