Class EmbedOne
Represents an embedded document that only contains one instance.
Constants
Property Summary
-
$alias protected
string
The alias this association uses.
-
$entityClass protected
string
The class to use for the embeded document.
-
$indexClass protected
string
The index class this embed is linked to
-
$property protected
string
The property the embedded document is located under.
Method Summary
-
__construct() public
Constructor
-
entityClass() public deprecated
Get/set the entity/document class used for this embed.
-
getAlias() public
Get the alias for this embed.
-
getEntityClass() public
Get the entity/document class used for this embed.
-
getIndexClass() public
Get the index class used for this embed.
-
getProperty() public
Get the property this embed is attached to.
-
hydrate() public
Hydrate an instance from the parent documents data.
-
indexClass() public deprecated
Get/set the index class used for this embed.
-
property() public deprecated
Get/set the property this embed is attached to.
-
setEntityClass() public
Sets the entity/document class used for this embed.
-
setIndexClass() public
Set the index class used for this embed.
-
setProperty() public
Set the property this embed is attached to.
-
type() public
Get the type of association this is.
Method Detail
__construct() ¶ public
__construct(string $alias, array $options = [])
Constructor
Parameters
-
string
$alias The alias/name for the embedded document.
-
array
$options optional The options for the embedded document.
entityClass() ¶ public
entityClass(string|null $name = null): string
Get/set the entity/document class used for this embed.
Parameters
-
string|null
$name optional The class name to set.
Returns
string
getEntityClass() ¶ public
getEntityClass(): string
Get the entity/document class used for this embed.
Returns
string
getIndexClass() ¶ public
getIndexClass(): string
Get the index class used for this embed.
Returns
string
getProperty() ¶ public
getProperty(): string
Get the property this embed is attached to.
Returns
string
hydrate() ¶ public
hydrate(array $data, array $options): Cake\ElasticSearch\Document
Hydrate an instance from the parent documents data.
Parameters
-
array
$data The data to use in the embedded document.
-
array
$options The options to use in the new document.
Returns
Cake\ElasticSearch\Document
indexClass() ¶ public
indexClass(Cake\ElasticSearch\Index|string|null $name = null): string
Get/set the index class used for this embed.
Parameters
-
Cake\ElasticSearch\Index|string|null
$name optional The class name to set.
Returns
string
property() ¶ public
property(string|null $name = null): string
Get/set the property this embed is attached to.
Parameters
-
string|null
$name optional The property name to set.
Returns
string
setEntityClass() ¶ public
setEntityClass(string $name): $this
Sets the entity/document class used for this embed.
Parameters
-
string
$name The name of the class to use
Returns
$this
setIndexClass() ¶ public
setIndexClass(Cake\ElasticSearch\Index|string|null $name): $this
Set the index class used for this embed.
Parameters
-
Cake\ElasticSearch\Index|string|null
$name The class name to set.
Returns
$this
setProperty() ¶ public
setProperty(string|null $name = null): $this
Set the property this embed is attached to.
Parameters
-
string|null
$name optional The property name to set.
Returns
$this
type() ¶ public
type(): string
Get the type of association this is.
Returns one of the association type constants.
Returns
string