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 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:
NMyClass::extensionMethod('newMethod', function(MyClass $obj, $arg, ...) { ... }); $obj = new MyClass; $obj->newMethod($x);
Direct known subclasses
NAnnotation, NApplication, NConfigCompiler, NConfigCompilerExtension, NConfigIniAdapter, NConfigLoader, NConfigNeonAdapter, NConfigPhpAdapter, NConfigurator, NContainerPanel, NConventionalReflection, NDatabasePanel, NArrayList, NDebugBar, NDebugBlueScreen, NDefaultFormRenderer, NDevNullStorage, NDIContainerBuilder, NDiscoveredReflection, NDIServiceDefinition, NDIStatement, Nette_MicroPresenter, NFileJournal, NAutoLoader, NFileResponse, NFileStorage, NFinder, NFireLogger, NFormGroup, NForwardResponse, NFreezableObject, NHtml, NHtmlNode, NHttpContext, NCache, NHttpRequest, NHttpRequestFactory, NHttpResponse, NHttpUploadedFile, NImage, NJsonResponse, NLatteCompiler, NLatteFilter, NLatteToken, NLogger, NCacheMacro, NMacroNode, NMacroSet, NMailMimePart, NMemcachedStorage, NMemoryStorage, NMsSqlDriver, NMySqlDriver, NNeon, NOciDriver, NOdbcDriver, NCachingHelper, NPaginator, NParser, NPermission, NPgSqlDriver, NPhpClassType, NPhpMethod, NPhpParameter, NPhpProperty, NPhpWriter, NPresenterFactory, NCallback, NRedirectResponse, NRoute, NRoutingDebugger, NRule, NRules, NSendmailMailer, NSession, NSessionSection, NSimpleAuthenticator, NSimpleRouter, NCliRouter, NSmtpMailer, NSqlBuilder, NSqliteDriver, NSqlLiteral, NSqlPreprocessor, NTableRow, NTableSelection, NTemplate, NTextResponse, NTokenizer, NComponent, NUser, NUserPanel, NUserStorage, NValidatorsIndirect known subclasses
NAppForm, NButton, NFormContainer, NFormControl, NFormMacros, NGroupedTableSelection, NHiddenField, NIdentity, NImageButton, NMacroTokenizer, NMail, NMultiplier, NCheckbox, NMultiSelectBox, NNetteExtension, NNetteLoader, NPhpExtension, NPhpFileStorage, NPresenter, NPresenterComponent, NPresenterRequest, NRadioList, NRobotLoader, NComponentContainer, NRouteList, NSelectBox, NSqlite2Driver, NSubmitButton, NTextArea, NTextBase, NTextInput, NUIMacros, NUploadControl, NUrl, NConstantsExtension, NUrlScript, NControl, NCoreMacros, NDIContainer, NFileTemplate, NForm
public
|
|
public
mixed
|
|
public static
mixed
|
|
public static
mixed
|
|
public
mixed
&
|
|
public
|
|
public
boolean
|
|
public
|
public read-only
|
$reflection |