Packages

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • NArrayTools
  • NCallback
  • NComponent
  • NComponentContainer
  • NConfigurator
  • NDateTime53
  • NDebug
  • NEnvironment
  • NFramework
  • NFreezableObject
  • NGenericRecursiveIterator
  • NImage
  • NImageMagick
  • NInstanceFilterIterator
  • NObject
  • NObjectMixin
  • NPaginator
  • NRecursiveComponentIterator
  • NServiceLocator
  • NSmartCachingIterator
  • NString
  • NTools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • NAmbiguousServiceException
  • Overview
  • Package
  • Class
  • Tree
  • Other releases

Class NObject

NObject 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 and optional 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:

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

Direct known subclasses

NAnnotation, NApplication, NConventionalRenderer, NDownloadResponse, NDummyStorage, NFileStorage, NFormGroup, NForwardingResponse, NFreezableObject, NFtp, NHtml, NHttpContext, NAutoLoader, NHttpRequest, NHttpResponse, NHttpUploadedFile, NImage, NInstantClientScript, NJsonResponse, NLatteFilter, NLatteMacros, NLink, NMailMimePart, NBaseTemplate, NMemcachedStorage, NPaginator, NPermission, NRedirectingResponse, NRenderResponse, NRoute, NRule, NRules, NSendmailMailer, NServiceLocator, NCache, NSession, NSessionNamespace, NSimpleAuthenticator, NSimpleRouter, NSnippetHelper, NUser, NCachingHelper, NCallback, NCliRouter, NComponent, NConfigurator

Indirect known subclasses

NAppForm, NButton, NHiddenField, NIdentity, NImageButton, NImageMagick, NMail, NMultiSelectBox, NNetteLoader, NPresenter, NPresenterComponent, NPresenterRequest, NCheckbox, NRadioList, NRobotLoader, NSelectBox, NSubmitButton, NTemplate, NTemplateCacheStorage, NTextArea, NTextBase, NTextInput, NUri, NComponentContainer, NUriScript, NControl, NCurlyBracketsMacros, NFileUpload, NForm, NFormContainer, NFormControl
Abstract
Package: Nette
Author: David Grudl
Located at Utils/Object.php
Methods summary
public NClassReflection
# getReflection( )

Access to reflection.

Access to reflection.

Returns

NClassReflection
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

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

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

Adding method to class.

Adding method to class.

Parameters

$name
string
method name
$callback
mixed
callback or closure

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

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

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

MemberAccessException
Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0