Class Object
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
Annotation, Application, ConfigCompiler, ConfigCompilerExtension, ConfigIniAdapter, ConfigLoader, ConfigNeonAdapter, ConfigPhpAdapter, Configurator, ContainerPanel, ConventionalReflection, DatabasePanel, ArrayList, DebugBar, DebugBlueScreen, DefaultFormRenderer, DevNullStorage, DIContainerBuilder, DiscoveredReflection, DIServiceDefinition, DIStatement, FileJournal, FileResponse, AutoLoader, FileStorage, Finder, FireLogger, FormGroup, ForwardResponse, FreezableObject, Html, HtmlNode, HttpContext, HttpRequest, Cache, HttpRequestFactory, HttpResponse, HttpUploadedFile, Image, JsonResponse, LatteCompiler, LatteFilter, LatteToken, Logger, MacroNode, CacheMacro, MacroSet, MailMimePart, MemcachedStorage, MemoryStorage, MsSqlDriver, MySqlDriver, Neon, Nette_MicroPresenter, OciDriver, OdbcDriver, CachingHelper, Paginator, Parser, Permission, PgSqlDriver, PhpClassType, PhpMethod, PhpParameter, PhpProperty, PhpWriter, PresenterFactory, Callback, RedirectResponse, Route, RoutingDebugger, Rule, Rules, SendmailMailer, Session, SessionSection, SimpleAuthenticator, SimpleRouter, CliRouter, SmtpMailer, SqlBuilder, SqliteDriver, SqlLiteral, SqlPreprocessor, TableRow, TableSelection, Template, TextResponse, Tokenizer, Component, User, UserPanel, UserStorage, ValidatorsIndirect known subclasses
AppForm, Button, FormContainer, FormControl, FormMacros, GroupedTableSelection, HiddenField, Identity, ImageButton, MacroTokenizer, Mail, Multiplier, Checkbox, MultiSelectBox, NetteExtension, NetteLoader, PhpExtension, PhpFileStorage, Presenter, PresenterComponent, PresenterRequest, RadioList, RobotLoader, ComponentContainer, RouteList, SelectBox, Sqlite2Driver, SubmitButton, TextArea, TextBase, TextInput, UIMacros, UploadControl, Url, ConstantsExtension, UrlScript, Control, CoreMacros, DIContainer, FileTemplate, Form
public
|
|
public
mixed
|
|
public static
mixed
|
|
public static
mixed
|
|
public
mixed
&
|
|
public
|
|
public
boolean
|
|
public
|
public read-only
|
$reflection |