Cell base.
string
'cell'
Constant for folder name containing cell templates.
Cake\View\View
Instance of the View created during rendering. Won't be set until after Cell::__toString()/render() is called.
array|bool
Caching setup.
string
Default class name for new event objects.
Cake\Event\EventManagerInterface|null
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
array<callableCake\Datasource\Locator\LocatorInterface>
A list of overridden model factory functions.
string
The model type to use.
Cake\ORM\Locator\LocatorInterface|null
Table locator instance
array<string>
List of valid options (constructor's fourth arguments) Override this property in subclasses to allow which options you want set as properties in your Cell.
Cake\View\ViewBuilder|null
The view builder instance being used.
string
The cell's action to invoke.
array
Arguments to pass to cell's action.
string|null
This object's default table alias.
string|null
This object's primary model class name. Should be a plural form. CakePHP will not inflect the name.
Cake\Http\ServerRequest
An instance of a Cake\Http\ServerRequest object that contains information about the current request. This object contains all the information about a request and several methods for reading additional information about the request.
Cake\Http\Response
An instance of a Response object that contains information about the impending response
Constructor.
Debug info.
Magic method.
Generate the cache key to use for this cell.
Set the modelClass property based on conventions.
Constructs the view class instance based on the current configuration.
Wrapper for creating and dispatching events.
Convenience method to get a table instance.
Returns the Cake\Event\EventManager manager instance for this object.
Get the model type to be used by this class
Gets the table locator.
Initialization hook method.
Loads and constructs repository objects required by this object
Override a existing callable to generate repositories of a given type.
Render the cell.
Saves a variable or an associative array of variables for use inside a template.
Returns the Cake\Event\EventManagerInterface instance for this object.
Set the model type to be used by this class
Sets the table locator.
Get the view builder being used.
__construct(Cake\Http\ServerRequest $request, Cake\Http\Response $response, Cake\Event\EventManagerInterface|null $eventManager = null, array<string, mixed> $cellOptions = [])
Constructor.
Cake\Http\ServerRequest
$request The request to use in the cell.
Cake\Http\Response
$response The response to use in the cell.
Cake\Event\EventManagerInterface|null
$eventManager optional The eventManager to bind events to.
array<string, mixed>
$cellOptions optional Cell options to apply.
__debugInfo(): array<string, mixed>
Debug info.
array<string, mixed>
__toString(): string
Magic method.
Starts the rendering process when Cell is echoed.
Note This method will trigger an error when view rendering has a problem. This is because PHP will not allow a __toString() method to throw an exception.
string
Error
_cacheConfig(string $action, string|null $template = null): array
Generate the cache key to use for this cell.
If the key is undefined, the cell class and action name will be used.
string
$action The action invoked.
string|null
$template optional The name of the template to be rendered.
array
_setModelClass(string $name): void
Set the modelClass property based on conventions.
If the property is already set it will not be overwritten
string
$name Class name.
void
createView(string|null $viewClass = null): Cake\View\View
Constructs the view class instance based on the current configuration.
string|null
$viewClass optional Optional namespaced class name of the View class to instantiate.
Cake\View\View
Cake\View\Exception\MissingViewException
dispatchEvent(string $name, array|null $data = null, object|null $subject = null): Cake\Event\EventInterface
Wrapper for creating and dispatching events.
Returns a dispatched event.
string
$name Name of the event.
array|null
$data optional Any value you wish to be transported with this event to it can be read by listeners.
object|null
$subject optional The object that this event applies to ($this by default).
Cake\Event\EventInterface
fetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\Table
Convenience method to get a table instance.
string|null
$alias optional The alias name you want to get. Should be in CamelCase format. If null
then the value of $defaultTable property is used.
array<string, mixed>
$options optional The options you want to build the table with. If a table has already been loaded the registry options will be ignored.
Cake\ORM\Table
Cake\Core\Exception\CakeException
getEventManager(): Cake\Event\EventManagerInterface
Returns the Cake\Event\EventManager manager instance for this object.
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Cake\Event\EventManagerInterface
getModelType(): string
Get the model type to be used by this class
string
getTableLocator(): Cake\ORM\Locator\LocatorInterface
Gets the table locator.
Cake\ORM\Locator\LocatorInterface
initialize(): void
Initialization hook method.
Implement this method to avoid having to overwrite the constructor and calling parent::__construct().
void
loadModel(string|null $modelClass = null, string|null $modelType = null): Cake\Datasource\RepositoryInterface
Loads and constructs repository objects required by this object
Typically used to load ORM Table objects as required. Can also be used to load other types of repository objects your application uses.
If a repository provider does not return an object a MissingModelException will be thrown.
string|null
$modelClass optional Name of model class to load. Defaults to $this->modelClass. The name can be an alias like 'Post'
or FQCN like App\Model\Table\PostsTable::class
.
string|null
$modelType optional The type of repository to load. Defaults to the getModelType() value.
Cake\Datasource\RepositoryInterface
Cake\Datasource\Exception\MissingModelException
UnexpectedValueException
modelFactory(string $type, Cake\Datasource\Locator\LocatorInterface|callable $factory): void
Override a existing callable to generate repositories of a given type.
string
$type The name of the repository type the factory function is for.
Cake\Datasource\Locator\LocatorInterface|callable
$factory The factory function used to create instances.
void
render(string|null $template = null): string
Render the cell.
string|null
$template optional Custom template name to render. If not provided (null), the last value will be used. This value is automatically set by CellTrait::cell()
.
string
Cake\View\Exception\MissingCellTemplateException
BadMethodCallException
set(array|string $name, mixed $value = null): $this
Saves a variable or an associative array of variables for use inside a template.
array|string
$name A string or an array of data.
mixed
$value optional Value in case $name is a string (which then works as the key). Unused if $name is an associative array, otherwise serves as the values to $name's keys.
$this
setEventManager(Cake\Event\EventManagerInterface $eventManager): $this
Returns the Cake\Event\EventManagerInterface instance for this object.
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Cake\Event\EventManagerInterface
$eventManager the eventManager to set
$this
setModelType(string $modelType): $this
Set the model type to be used by this class
string
$modelType The model type
$this
setTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $this
Sets the table locator.
Cake\ORM\Locator\LocatorInterface
$tableLocator LocatorInterface instance.
$this
viewBuilder(): Cake\View\ViewBuilder
Get the view builder being used.
Cake\View\ViewBuilder
Instance of the View created during rendering. Won't be set until after Cell::__toString()/render() is called.
Cake\View\View
Caching setup.
array|bool
Default class name for new event objects.
string
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
Cake\Event\EventManagerInterface|null
A list of overridden model factory functions.
array<callableCake\Datasource\Locator\LocatorInterface>
The model type to use.
string
Table locator instance
Cake\ORM\Locator\LocatorInterface|null
List of valid options (constructor's fourth arguments) Override this property in subclasses to allow which options you want set as properties in your Cell.
array<string>
The view builder instance being used.
Cake\View\ViewBuilder|null
The cell's action to invoke.
string
Arguments to pass to cell's action.
array
This object's default table alias.
string|null
This object's primary model class name. Should be a plural form. CakePHP will not inflect the name.
Example: For an object named 'Comments', the modelClass would be 'Comments'. Plugin classes should use Plugin.Comments
style names to correctly load models from the correct plugin.
Use empty string to not use auto-loading on this object. Null auto-detects based on controller name.
string|null
An instance of a Cake\Http\ServerRequest object that contains information about the current request. This object contains all the information about a request and several methods for reading additional information about the request.
Cake\Http\ServerRequest
An instance of a Response object that contains information about the impending response
Cake\Http\Response
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.View.Cell.html