platform/api/laravel/Database/Eloquent/Relations/HasOneOrMany.yaml
2024-09-02 10:44:11 -07:00

491 lines
12 KiB
YAML

name: HasOneOrMany
class_comment: null
dependencies:
- 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: InteractsWithDictionary
type: class
source: Illuminate\Database\Eloquent\Relations\Concerns\InteractsWithDictionary
- name: UniqueConstraintViolationException
type: class
source: Illuminate\Database\UniqueConstraintViolationException
- name: InteractsWithDictionary
type: class
source: InteractsWithDictionary
properties:
- name: foreignKey
visibility: protected
comment: "# * @template TRelatedModel of \\Illuminate\\Database\\Eloquent\\Model\n\
# * @template TDeclaringModel of \\Illuminate\\Database\\Eloquent\\Model\n# *\
\ @template TResult\n# *\n# * @extends \\Illuminate\\Database\\Eloquent\\Relations\\\
Relation<TRelatedModel, TDeclaringModel, TResult>\n# */\n# abstract class HasOneOrMany\
\ extends Relation\n# {\n# use InteractsWithDictionary;\n# \n# /**\n# * The foreign\
\ key of the parent model.\n# *\n# * @var string"
- name: localKey
visibility: protected
comment: '# * The local key of the parent model.
# *
# * @var string'
methods:
- name: __construct
visibility: public
parameters:
- name: query
- name: parent
- name: foreignKey
- name: localKey
comment: "# * @template TRelatedModel of \\Illuminate\\Database\\Eloquent\\Model\n\
# * @template TDeclaringModel of \\Illuminate\\Database\\Eloquent\\Model\n# *\
\ @template TResult\n# *\n# * @extends \\Illuminate\\Database\\Eloquent\\Relations\\\
Relation<TRelatedModel, TDeclaringModel, TResult>\n# */\n# abstract class HasOneOrMany\
\ extends Relation\n# {\n# use InteractsWithDictionary;\n# \n# /**\n# * The foreign\
\ key of the parent model.\n# *\n# * @var string\n# */\n# protected $foreignKey;\n\
# \n# /**\n# * The local key of the parent model.\n# *\n# * @var string\n# */\n\
# protected $localKey;\n# \n# /**\n# * Create a new has one or many relationship\
\ instance.\n# *\n# * @param \\Illuminate\\Database\\Eloquent\\Builder<TRelatedModel>\
\ $query\n# * @param TDeclaringModel $parent\n# * @param string $foreignKey\n\
# * @param string $localKey\n# * @return void"
- name: make
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Create and return an un-saved instance of the related model.
# *
# * @param array $attributes
# * @return TRelatedModel'
- name: makeMany
visibility: public
parameters:
- name: records
comment: '# * Create and return an un-saved instance of the related models.
# *
# * @param iterable $records
# * @return \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>'
- name: addConstraints
visibility: public
parameters: []
comment: '# * Set the base constraints on the relation query.
# *
# * @return void'
- name: addEagerConstraints
visibility: public
parameters:
- name: models
comment: '# @inheritDoc'
- name: matchOne
visibility: public
parameters:
- name: models
- name: results
- name: relation
comment: '# * Match the eagerly loaded results to their single parents.
# *
# * @param array<int, TDeclaringModel> $models
# * @param \Illuminate\Database\Eloquent\Collection<int, TRelatedModel> $results
# * @param string $relation
# * @return array<int, TDeclaringModel>'
- name: matchMany
visibility: public
parameters:
- name: models
- name: results
- name: relation
comment: '# * Match the eagerly loaded results to their many parents.
# *
# * @param array<int, TDeclaringModel> $models
# * @param \Illuminate\Database\Eloquent\Collection<int, TRelatedModel> $results
# * @param string $relation
# * @return array<int, TDeclaringModel>'
- name: matchOneOrMany
visibility: protected
parameters:
- name: models
- name: results
- name: relation
- name: type
comment: '# * Match the eagerly loaded results to their many parents.
# *
# * @param array<int, TDeclaringModel> $models
# * @param \Illuminate\Database\Eloquent\Collection<int, TRelatedModel> $results
# * @param string $relation
# * @param string $type
# * @return array<int, TDeclaringModel>'
- name: getRelationValue
visibility: protected
parameters:
- name: dictionary
- name: key
- name: type
comment: '# * Get the value of a relationship by one or many type.
# *
# * @param array $dictionary
# * @param string $key
# * @param string $type
# * @return mixed'
- name: buildDictionary
visibility: protected
parameters:
- name: results
comment: '# * Build model dictionary keyed by the relation''s foreign key.
# *
# * @param \Illuminate\Database\Eloquent\Collection<int, TRelatedModel> $results
# * @return array<array<int, TRelatedModel>>'
- name: findOrNew
visibility: public
parameters:
- name: id
- name: columns
default: '[''*'']'
comment: '# * Find a model by its primary key or return a new instance of the related
model.
# *
# * @param mixed $id
# * @param array $columns
# * @return ($id is (\Illuminate\Contracts\Support\Arrayable<array-key, mixed>|array<mixed>)
? \Illuminate\Database\Eloquent\Collection<int, TRelatedModel> : TRelatedModel)'
- name: firstOrNew
visibility: public
parameters:
- name: attributes
default: '[]'
- name: values
default: '[]'
comment: '# * Get the first related model record matching the attributes or instantiate
it.
# *
# * @param array $attributes
# * @param array $values
# * @return TRelatedModel'
- name: firstOrCreate
visibility: public
parameters:
- name: attributes
default: '[]'
- name: values
default: '[]'
comment: '# * Get the first record matching the attributes. If the record is not
found, create it.
# *
# * @param array $attributes
# * @param array $values
# * @return TRelatedModel'
- name: createOrFirst
visibility: public
parameters:
- name: attributes
default: '[]'
- name: values
default: '[]'
comment: '# * Attempt to create the record. If a unique constraint violation occurs,
attempt to find the matching record.
# *
# * @param array $attributes
# * @param array $values
# * @return TRelatedModel'
- name: updateOrCreate
visibility: public
parameters:
- name: attributes
- name: values
default: '[]'
comment: '# * Create or update a related record matching the attributes, and fill
it with values.
# *
# * @param array $attributes
# * @param array $values
# * @return TRelatedModel'
- name: save
visibility: public
parameters:
- name: model
comment: '# * Attach a model instance to the parent model.
# *
# * @param TRelatedModel $model
# * @return TRelatedModel|false'
- name: saveQuietly
visibility: public
parameters:
- name: model
comment: '# * Attach a model instance without raising any events to the parent model.
# *
# * @param TRelatedModel $model
# * @return TRelatedModel|false'
- name: saveMany
visibility: public
parameters:
- name: models
comment: '# * Attach a collection of models to the parent instance.
# *
# * @param iterable<TRelatedModel> $models
# * @return iterable<TRelatedModel>'
- name: saveManyQuietly
visibility: public
parameters:
- name: models
comment: '# * Attach a collection of models to the parent instance without raising
any events to the parent model.
# *
# * @param iterable<TRelatedModel> $models
# * @return iterable<TRelatedModel>'
- name: create
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Create a new instance of the related model.
# *
# * @param array $attributes
# * @return TRelatedModel'
- name: createQuietly
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Create a new instance of the related model without raising any events
to the parent model.
# *
# * @param array $attributes
# * @return TRelatedModel'
- name: forceCreate
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Create a new instance of the related model. Allow mass-assignment.
# *
# * @param array $attributes
# * @return TRelatedModel'
- name: forceCreateQuietly
visibility: public
parameters:
- name: attributes
default: '[]'
comment: '# * Create a new instance of the related model with mass assignment without
raising model events.
# *
# * @param array $attributes
# * @return TRelatedModel'
- name: createMany
visibility: public
parameters:
- name: records
comment: '# * Create a Collection of new instances of the related model.
# *
# * @param iterable $records
# * @return \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>'
- name: createManyQuietly
visibility: public
parameters:
- name: records
comment: '# * Create a Collection of new instances of the related model without
raising any events to the parent model.
# *
# * @param iterable $records
# * @return \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>'
- name: setForeignAttributesForCreate
visibility: protected
parameters:
- name: model
comment: '# * Set the foreign ID for creating a related model.
# *
# * @param TRelatedModel $model
# * @return void'
- name: getRelationExistenceQuery
visibility: public
parameters:
- name: query
- name: parentQuery
- name: columns
default: '[''*'']'
comment: '# @inheritDoc'
- name: getRelationExistenceQueryForSelfRelation
visibility: public
parameters:
- name: query
- name: parentQuery
- name: columns
default: '[''*'']'
comment: '# * Add the constraints for a relationship query on the same table.
# *
# * @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: take
visibility: public
parameters:
- name: value
comment: '# * Alias to set the "limit" value of the query.
# *
# * @param int $value
# * @return $this'
- name: limit
visibility: public
parameters:
- name: value
comment: '# * Set the "limit" value of the query.
# *
# * @param int $value
# * @return $this'
- name: getExistenceCompareKey
visibility: public
parameters: []
comment: '# * Get the key for comparing against the parent key in "has" query.
# *
# * @return string'
- name: getParentKey
visibility: public
parameters: []
comment: '# * Get the key value of the parent''s local key.
# *
# * @return mixed'
- name: getQualifiedParentKeyName
visibility: public
parameters: []
comment: '# * Get the fully qualified parent key name.
# *
# * @return string'
- name: getForeignKeyName
visibility: public
parameters: []
comment: '# * Get the plain foreign key.
# *
# * @return string'
- name: getQualifiedForeignKeyName
visibility: public
parameters: []
comment: '# * Get the foreign key for the relationship.
# *
# * @return string'
- name: getLocalKeyName
visibility: public
parameters: []
comment: '# * Get the local key for the relationship.
# *
# * @return string'
traits:
- Illuminate\Database\Eloquent\Builder
- Illuminate\Database\Eloquent\Collection
- Illuminate\Database\Eloquent\Model
- Illuminate\Database\Eloquent\Relations\Concerns\InteractsWithDictionary
- Illuminate\Database\UniqueConstraintViolationException
- InteractsWithDictionary
interfaces: []