Namespaces

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

Classes

  • ArrayHash
  • ArrayList
  • Callback
  • Configurator
  • DateTime
  • Environment
  • Framework
  • FreezableObject
  • Image
  • Object
  • ObjectMixin

Interfaces

  • IFreezable

Exceptions

  • ArgumentOutOfRangeException
  • DeprecatedException
  • DirectoryNotFoundException
  • FatalErrorException
  • FileNotFoundException
  • InvalidArgumentException
  • InvalidStateException
  • IOException
  • MemberAccessException
  • NotImplementedException
  • NotSupportedException
  • OutOfRangeException
  • StaticClassException
  • UnexpectedValueException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Object

Nette\Object is the ultimate ancestor of all instantiable classes.

It defines some handful methods and enhances object core of PHP: - access to undeclared members throws exceptions - support for conventional properties with getters and setters - support for event raising functionality - ability to add new methods to class (extension methods)

Properties is a syntactic sugar which allows access public getter and setter methods as normal object variables. A property is defined by a getter method or setter method (no setter method means read-only property).

$val = $obj->label;     // equivalent to $val = $obj->getLabel();
$obj->label = 'Nette';  // equivalent to $obj->setLabel('Nette');

Property names are case-sensitive, and they are written in the camelCaps or PascalCaps.

Event functionality is provided by declaration of property named 'on{Something}' Multiple handlers are allowed.

public $onClick;                // declaration in class
$this->onClick[] = 'callback';  // attaching event handler
if (!empty($this->onClick)) ... // are there any handlers?
$this->onClick($sender, $arg);  // raises the event with arguments

Adding method to class (i.e. to all instances) works similar to JavaScript prototype property. The syntax for adding a new method is:

MyClass::extensionMethod('newMethod', function (MyClass $obj, $arg, ...) { ... });
$obj = new MyClass;
$obj->newMethod($x);

Direct known subclasses

Nette\Application\Application, Nette\Application\Diagnostics\RoutingPanel, Nette\Application\Routers\Route, Nette\Templating\Template, Nette\Utils\Finder, Nette\Utils\Html, Nette\Utils\Neon, Nette\Utils\Paginator, Nette\Utils\Validators, NetteModule\ErrorPresenter, NetteModule\MicroPresenter, Nette\Application\Routers\SimpleRouter, Nette\ArrayList, Nette\Caching\Cache, Nette\Caching\OutputHelper, Nette\Caching\Storages\DevNullStorage, Nette\Caching\Storages\FileJournal, Nette\Caching\Storages\FileStorage, Nette\Caching\Storages\MemcachedStorage, Nette\Caching\Storages\MemoryStorage, Nette\Application\PresenterFactory, Nette\Caching\Storages\SQLiteStorage, Nette\Callback, Nette\ComponentModel\Component, Nette\Configurator, Nette\Database\Connection, Nette\Database\Context, Nette\Database\Diagnostics\ConnectionPanel, Nette\Database\Drivers\MsSqlDriver, Nette\Database\Drivers\MySqlDriver, Nette\Database\Drivers\OciDriver, Nette\Application\Request, Nette\Database\Drivers\OdbcDriver, Nette\Database\Drivers\PgSqlDriver, Nette\Database\Drivers\SqliteDriver, Nette\Database\Drivers\SqlsrvDriver, Nette\Database\Reflection\ConventionalReflection, Nette\Database\Reflection\DiscoveredReflection, Nette\Database\ResultSet, Nette\Database\SqlLiteral, Nette\Database\SqlPreprocessor, Nette\Database\Table\Selection, Nette\Application\Responses\FileResponse, Nette\Database\Table\SqlBuilder, Nette\DI\Compiler, Nette\DI\CompilerExtension, Nette\DI\Config\Adapters\IniAdapter, Nette\DI\Config\Adapters\NeonAdapter, Nette\DI\Config\Adapters\PhpAdapter, Nette\DI\Config\Loader, Nette\DI\Container, Nette\DI\ContainerBuilder, Nette\DI\Diagnostics\ContainerPanel, Nette\Application\Responses\ForwardResponse, Nette\DI\Extensions\NetteAccessor, Nette\DI\ServiceDefinition, Nette\DI\Statement, Nette\Diagnostics\Bar, Nette\Diagnostics\BlueScreen, Nette\Diagnostics\FireLogger, Nette\Diagnostics\Logger, Nette\Diagnostics\OutputDebugger, Nette\Forms\ControlGroup, Nette\Forms\Helpers, Nette\Application\Responses\JsonResponse, Nette\Forms\Rendering\DefaultFormRenderer, Nette\Forms\Rule, Nette\Forms\Rules, Nette\FreezableObject, Nette\Http\Context, Nette\Http\Diagnostics\SessionPanel, Nette\Http\FileUpload, Nette\Http\Request, Nette\Http\RequestFactory, Nette\Http\Response, Nette\Application\Responses\RedirectResponse, Nette\Http\Session, Nette\Http\SessionSection, Nette\Http\Url, Nette\Http\UserStorage, Nette\Image, Nette\Latte\Compiler, Nette\Latte\Engine, Nette\Latte\HtmlNode, Nette\Latte\MacroNode, Nette\Latte\Macros\CacheMacro, Nette\Application\Responses\TextResponse, Nette\Latte\Macros\MacroSet, Nette\Latte\Parser, Nette\Latte\PhpWriter, Nette\Latte\Token, Nette\Loaders\AutoLoader, Nette\Loaders\NetteLoader, Nette\Loaders\RobotLoader, Nette\Mail\MimePart, Nette\Mail\SendmailMailer, Nette\Mail\SmtpMailer, Nette\Application\Routers\CliRouter, Nette\PhpGenerator\ClassType, Nette\PhpGenerator\Method, Nette\PhpGenerator\Parameter, Nette\PhpGenerator\Property, Nette\Reflection\Annotation, Nette\Security\Diagnostics\UserPanel, Nette\Security\Identity, Nette\Security\Permission, Nette\Security\SimpleAuthenticator, Nette\Security\User

Indirect known subclasses

Nette\Application\Routers\RouteList, Nette\Application\UI\Control, Nette\DI\Extensions\ConstantsExtension, Nette\DI\Extensions\ExtensionsExtension, Nette\DI\Extensions\NetteExtension, Nette\DI\Extensions\PhpExtension, Nette\Forms\Container, Nette\Forms\Controls\BaseControl, Nette\Forms\Controls\Button, Nette\Forms\Controls\Checkbox, Nette\Forms\Controls\CheckboxList, Nette\Forms\Controls\ChoiceControl, Nette\Application\UI\Form, Nette\Forms\Controls\CsrfProtection, Nette\Forms\Controls\HiddenField, Nette\Forms\Controls\ImageButton, Nette\Forms\Controls\MultiChoiceControl, Nette\Forms\Controls\MultiSelectBox, Nette\Forms\Controls\RadioList, Nette\Forms\Controls\SelectBox, Nette\Forms\Controls\SubmitButton, Nette\Forms\Controls\TextArea, Nette\Forms\Controls\TextBase, Nette\Application\UI\Multiplier, Nette\Forms\Controls\TextInput, Nette\Forms\Controls\UploadControl, Nette\Forms\Form, Nette\Http\UrlScript, Nette\Latte\Macros\CoreMacros, Nette\Latte\Macros\FormMacros, Nette\Latte\Macros\UIMacros, Nette\Latte\MacroTokens, Nette\Mail\Message, Nette\Templating\FileTemplate, Nette\Application\UI\Presenter, Nette\Application\UI\PresenterComponent, Nette\Caching\Storages\PhpFileStorage, Nette\ComponentModel\Container, Nette\Database\Drivers\Sqlite2Driver, Nette\Database\Table\GroupedSelection
Abstract
Namespace: Nette
Author: David Grudl
Located at common/Object.php
Methods summary
public static Nette\Reflection\ClassType
# getReflection( )

Access to reflection.

Access to reflection.

Returns

Nette\Reflection\ClassType
public mixed
# __call( string $name, array $args )

Call to undefined method.

Call to undefined method.

Parameters

$name
string
method name
$args
array
arguments

Returns

mixed

Throws

Nette\MemberAccessException
public static mixed
# __callStatic( string $name, array $args )

Call to undefined static method.

Call to undefined static method.

Parameters

$name
string
method name (in lower case!)
$args
array
arguments

Returns

mixed

Throws

Nette\MemberAccessException
public static mixed
# extensionMethod( string $name, callable $callback = NULL )

Adding method to class.

Adding method to class.

Parameters

$name
string
method name
$callback
callable

Returns

mixed
public mixed &
# __get( string $name )

Returns property value. Do not call directly.

Returns property value. Do not call directly.

Parameters

$name
string
property name

Returns

mixed
property value

Throws

Nette\MemberAccessException
if the property is not defined.
public
# __set( string $name, mixed $value )

Sets value of a property. Do not call directly.

Sets value of a property. Do not call directly.

Parameters

$name
string
property name
$value
mixed
property value

Throws

Nette\MemberAccessException
if the property is not defined or is read-only
public boolean
# __isset( string $name )

Is property defined?

Is property defined?

Parameters

$name
string
property name

Returns

boolean
public
# __unset( string $name )

Access to undeclared property.

Access to undeclared property.

Parameters

$name
string
property name

Throws

Nette\MemberAccessException
Magic properties summary
public read-only Nette\Reflection\ClassType $reflection
#
Nette 2.1 API documentation generated by ApiGen 2.8.0