api/laravel/Database/Eloquent/Relations/Relation.yaml

500 lines
13 KiB
YAML
Raw Permalink Normal View History

2024-09-26 09:03:21 +00:00
name: Relation
class_comment: null
dependencies:
- name: Closure
type: class
source: Closure
- name: BuilderContract
type: class
source: Illuminate\Contracts\Database\Eloquent\Builder
- name: Builder
type: class
source: Illuminate\Database\Eloquent\Builder
- name: Collection
type: class
source: Illuminate\Database\Eloquent\Collection
- name: Model
type: class
source: Illuminate\Database\Eloquent\Model
- name: ModelNotFoundException
type: class
source: Illuminate\Database\Eloquent\ModelNotFoundException
- name: MultipleRecordsFoundException
type: class
source: Illuminate\Database\MultipleRecordsFoundException
- name: Expression
type: class
source: Illuminate\Database\Query\Expression
- name: ForwardsCalls
type: class
source: Illuminate\Support\Traits\ForwardsCalls
- name: Macroable
type: class
source: Illuminate\Support\Traits\Macroable
properties:
- name: query
visibility: protected
comment: "# * @template TRelatedModel of \\Illuminate\\Database\\Eloquent\\Model\n\
# * @template TDeclaringModel of \\Illuminate\\Database\\Eloquent\\Model\n# *\
\ @template TResult\n# *\n# * @mixin \\Illuminate\\Database\\Eloquent\\Builder<TRelatedModel>\n\
# */\n# abstract class Relation implements BuilderContract\n# {\n# use ForwardsCalls,\
\ Macroable {\n# Macroable::__call as macroCall;\n# }\n# \n# /**\n# * The Eloquent\
\ query builder instance.\n# *\n# * @var \\Illuminate\\Database\\Eloquent\\Builder<TRelatedModel>"
- name: parent
visibility: protected
comment: '# * The parent model instance.
# *
# * @var TDeclaringModel'
- name: related
visibility: protected
comment: '# * The related model instance.
# *
# * @var TRelatedModel'
- name: eagerKeysWereEmpty
visibility: protected
comment: '# * Indicates whether the eagerly loaded relation should implicitly return
an empty collection.
# *
# * @var bool'
- name: constraints
visibility: protected
comment: '# * Indicates if the relation is adding constraints.
# *
# * @var bool'
- name: morphMap
visibility: public
comment: '# * An array to map class names to their morph names in the database.
# *
# * @var array'
- name: requireMorphMap
visibility: protected
comment: '# * Prevents morph relationships without a morph map.
# *
# * @var bool'
- name: selfJoinCount
visibility: protected
comment: '# * The count of self joins.
# *
# * @var int'
methods:
- name: __construct
visibility: public
parameters:
- name: query
- name: parent
comment: "# * @template TRelatedModel of \\Illuminate\\Database\\Eloquent\\Model\n\
# * @template TDeclaringModel of \\Illuminate\\Database\\Eloquent\\Model\n# *\
\ @template TResult\n# *\n# * @mixin \\Illuminate\\Database\\Eloquent\\Builder<TRelatedModel>\n\
# */\n# abstract class Relation implements BuilderContract\n# {\n# use ForwardsCalls,\
\ Macroable {\n# Macroable::__call as macroCall;\n# }\n# \n# /**\n# * The Eloquent\
\ query builder instance.\n# *\n# * @var \\Illuminate\\Database\\Eloquent\\Builder<TRelatedModel>\n\
# */\n# protected $query;\n# \n# /**\n# * The parent model instance.\n# *\n# *\
\ @var TDeclaringModel\n# */\n# protected $parent;\n# \n# /**\n# * The related\
\ model instance.\n# *\n# * @var TRelatedModel\n# */\n# protected $related;\n\
# \n# /**\n# * Indicates whether the eagerly loaded relation should implicitly\
\ return an empty collection.\n# *\n# * @var bool\n# */\n# protected $eagerKeysWereEmpty\
\ = false;\n# \n# /**\n# * Indicates if the relation is adding constraints.\n\
# *\n# * @var bool\n# */\n# protected static $constraints = true;\n# \n# /**\n\
# * An array to map class names to their morph names in the database.\n# *\n#\
\ * @var array\n# */\n# public static $morphMap = [];\n# \n# /**\n# * Prevents\
\ morph relationships without a morph map.\n# *\n# * @var bool\n# */\n# protected\
\ static $requireMorphMap = false;\n# \n# /**\n# * The count of self joins.\n\
# *\n# * @var int\n# */\n# protected static $selfJoinCount = 0;\n# \n# /**\n#\
\ * Create a new relation instance.\n# *\n# * @param \\Illuminate\\Database\\\
Eloquent\\Builder<TRelatedModel> $query\n# * @param TDeclaringModel $parent\n\
# * @return void"
- name: noConstraints
visibility: public
parameters:
- name: callback
comment: '# * Run a callback with constraints disabled on the relation.
# *
# * @param \Closure $callback
# * @return mixed'
- name: getEager
visibility: public
parameters: []
comment: "# * Set the base constraints on the relation query.\n# *\n# * @return\
\ void\n# */\n# abstract public function addConstraints();\n# \n# /**\n# * Set\
\ the constraints for an eager load of the relation.\n# *\n# * @param array<int,\
\ TDeclaringModel> $models\n# * @return void\n# */\n# abstract public function\
\ addEagerConstraints(array $models);\n# \n# /**\n# * Initialize the relation\
\ on a set of models.\n# *\n# * @param array<int, TDeclaringModel> $models\n\
# * @param string $relation\n# * @return array<int, TDeclaringModel>\n# */\n\
# abstract public function initRelation(array $models, $relation);\n# \n# /**\n\
# * Match the eagerly loaded results to their parents.\n# *\n# * @param array<int,\
\ TDeclaringModel> $models\n# * @param \\Illuminate\\Database\\Eloquent\\Collection<int,\
\ TRelatedModel> $results\n# * @param string $relation\n# * @return array<int,\
\ TDeclaringModel>\n# */\n# abstract public function match(array $models, Collection\
\ $results, $relation);\n# \n# /**\n# * Get the results of the relationship.\n\
# *\n# * @return TResult\n# */\n# abstract public function getResults();\n# \n\
# /**\n# * Get the relationship for eager loading.\n# *\n# * @return \\Illuminate\\\
Database\\Eloquent\\Collection<int, TRelatedModel>"
- name: sole
visibility: public
parameters:
- name: columns
default: '[''*'']'
comment: '# * Execute the query and get the first result if it''s the sole matching
record.
# *
# * @param array|string $columns
# * @return TRelatedModel
# *
# * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<TRelatedModel>
# * @throws \Illuminate\Database\MultipleRecordsFoundException'
- name: get
visibility: public
parameters:
- name: columns
default: '[''*'']'
comment: '# * Execute the query as a "select" statement.
# *
# * @param array $columns
# * @return \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>'
- name: touch
visibility: public
parameters: []
comment: '# * Touch all of the related models for the relationship.
# *
# * @return void'
- name: rawUpdate
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Run a raw update against the base query.
# *
# * @param array $attributes
# * @return int'
- name: getRelationExistenceCountQuery
visibility: public
parameters:
- name: query
- name: parentQuery
comment: '# * Add the constraints for a relationship count query.
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param \Illuminate\Database\Eloquent\Builder<TDeclaringModel> $parentQuery
# * @return \Illuminate\Database\Eloquent\Builder<TRelatedModel>'
- name: getRelationExistenceQuery
visibility: public
parameters:
- name: query
- name: parentQuery
- name: columns
default: '[''*'']'
comment: '# * Add the constraints for an internal relationship existence query.
# *
# * Essentially, these queries compare on column names like whereColumn.
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param \Illuminate\Database\Eloquent\Builder<TDeclaringModel> $parentQuery
# * @param array|mixed $columns
# * @return \Illuminate\Database\Eloquent\Builder<TRelatedModel>'
- name: getRelationCountHash
visibility: public
parameters:
- name: incrementJoinCount
default: 'true'
comment: '# * Get a relationship join table hash.
# *
# * @param bool $incrementJoinCount
# * @return string'
- name: getKeys
visibility: protected
parameters:
- name: models
- name: key
default: 'null'
comment: '# * Get all of the primary keys for an array of models.
# *
# * @param array<int, TDeclaringModel> $models
# * @param string|null $key
# * @return array<int, int|string>'
- name: getRelationQuery
visibility: protected
parameters: []
comment: '# * Get the query builder that will contain the relationship constraints.
# *
# * @return \Illuminate\Database\Eloquent\Builder<TRelatedModel>'
- name: getQuery
visibility: public
parameters: []
comment: '# * Get the underlying query for the relation.
# *
# * @return \Illuminate\Database\Eloquent\Builder<TRelatedModel>'
- name: getBaseQuery
visibility: public
parameters: []
comment: '# * Get the base query builder driving the Eloquent builder.
# *
# * @return \Illuminate\Database\Query\Builder'
- name: toBase
visibility: public
parameters: []
comment: '# * Get a base query builder instance.
# *
# * @return \Illuminate\Database\Query\Builder'
- name: getParent
visibility: public
parameters: []
comment: '# * Get the parent model of the relation.
# *
# * @return TDeclaringModel'
- name: getQualifiedParentKeyName
visibility: public
parameters: []
comment: '# * Get the fully qualified parent key name.
# *
# * @return string'
- name: getRelated
visibility: public
parameters: []
comment: '# * Get the related model of the relation.
# *
# * @return TRelatedModel'
- name: createdAt
visibility: public
parameters: []
comment: '# * Get the name of the "created at" column.
# *
# * @return string'
- name: updatedAt
visibility: public
parameters: []
comment: '# * Get the name of the "updated at" column.
# *
# * @return string'
- name: relatedUpdatedAt
visibility: public
parameters: []
comment: '# * Get the name of the related model''s "updated at" column.
# *
# * @return string'
- name: whereInEager
visibility: protected
parameters:
- name: whereIn
- name: key
- name: modelKeys
- name: query
default: 'null'
comment: '# * Add a whereIn eager constraint for the given set of model keys to
be loaded.
# *
# * @param string $whereIn
# * @param string $key
# * @param array $modelKeys
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel>|null $query
# * @return void'
- name: whereInMethod
visibility: protected
parameters:
- name: model
- name: key
comment: '# * Get the name of the "where in" method for eager loading.
# *
# * @param \Illuminate\Database\Eloquent\Model $model
# * @param string $key
# * @return string'
- name: requireMorphMap
visibility: public
parameters:
- name: requireMorphMap
default: 'true'
comment: '# * Prevent polymorphic relationships from being used without model mappings.
# *
# * @param bool $requireMorphMap
# * @return void'
- name: requiresMorphMap
visibility: public
parameters: []
comment: '# * Determine if polymorphic relationships require explicit model mapping.
# *
# * @return bool'
- name: enforceMorphMap
visibility: public
parameters:
- name: map
- name: merge
default: 'true'
comment: '# * Define the morph map for polymorphic relations and require all morphed
models to be explicitly mapped.
# *
# * @param array $map
# * @param bool $merge
# * @return array'
- name: morphMap
visibility: public
parameters:
- name: map
default: 'null'
- name: merge
default: 'true'
comment: '# * Set or get the morph map for polymorphic relations.
# *
# * @param array|null $map
# * @param bool $merge
# * @return array'
- name: buildMorphMapFromModels
visibility: protected
parameters:
- name: models
default: 'null'
comment: '# * Builds a table-keyed array from model class names.
# *
# * @param string[]|null $models
# * @return array|null'
- name: getMorphedModel
visibility: public
parameters:
- name: alias
comment: '# * Get the model associated with a custom polymorphic type.
# *
# * @param string $alias
# * @return string|null'
- name: getMorphAlias
visibility: public
parameters:
- name: className
comment: '# * Get the alias associated with a custom polymorphic class.
# *
# * @param string $className
# * @return int|string'
- name: __call
visibility: public
parameters:
- name: method
- name: parameters
comment: '# * Handle dynamic method calls to the relationship.
# *
# * @param string $method
# * @param array $parameters
# * @return mixed'
- name: __clone
visibility: public
parameters: []
comment: '# * Force a clone of the underlying query builder when cloning.
# *
# * @return void'
traits:
- Closure
- Illuminate\Database\Eloquent\Builder
- Illuminate\Database\Eloquent\Collection
- Illuminate\Database\Eloquent\Model
- Illuminate\Database\Eloquent\ModelNotFoundException
- Illuminate\Database\MultipleRecordsFoundException
- Illuminate\Database\Query\Expression
- Illuminate\Support\Traits\ForwardsCalls
- Illuminate\Support\Traits\Macroable
interfaces:
- BuilderContract