Trait LocatorAwareTrait
Contains method for setting and accessing LocatorInterface instance
Namespace: Cake\ORM\Locator
Property Summary
-
$_tableLocator protected
Cake\ORM\Locator\LocatorInterface|null
Table locator instance
-
$defaultTable protected
string|null
This object's default table alias.
Method Summary
-
fetchTable() public
Convenience method to get a table instance.
-
getTableLocator() public
Gets the table locator.
-
setTableLocator() public
Sets the table locator.
Method Detail
fetchTable() ¶ public
fetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\Table
Convenience method to get a table instance.
Parameters
-
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.
Returns
Cake\ORM\Table
Throws
Cake\Core\Exception\CakeException
If `$alias` argument and `$defaultTable` property both are `null`.
See Also
\Cake\ORM\TableLocator::get()
getTableLocator() ¶ public
getTableLocator(): Cake\ORM\Locator\LocatorInterface
Gets the table locator.
Returns
Cake\ORM\Locator\LocatorInterface
setTableLocator() ¶ public
setTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $this
Sets the table locator.
Parameters
-
Cake\ORM\Locator\LocatorInterface
$tableLocator LocatorInterface instance.
Returns
$this