Skip to content

Documentation


Documentation / @blazetrails/activerecord / AssociationReflection

Class: AssociationReflection ​

Defined in: packages/activerecord/lib/reflection.ts:508

Extends ​

Extended by ​

Constructors ​

Constructor ​

new AssociationReflection(name, scope, options, activeRecord): AssociationReflection

Defined in: packages/activerecord/lib/reflection.ts:513

Parameters ​

ParameterType
namestring | null
scopeScopeBlock | null
optionsRecord<string, unknown>
activeRecordtypeof Base

Returns ​

AssociationReflection

Overrides ​

MacroReflection.constructor

Properties ​

activeRecord ​

readonly activeRecord: typeof Base

Defined in: packages/activerecord/lib/reflection.ts:383

Inherited from ​

MacroReflection.activeRecord


name ​

readonly name: string

Defined in: packages/activerecord/lib/reflection.ts:381

Inherited from ​

MacroReflection.name


options ​

readonly options: Record<string, unknown>

Defined in: packages/activerecord/lib/reflection.ts:382

Inherited from ​

MacroReflection.options


parentReflection ​

parentReflection: AssociationReflection | ThroughReflection | null = null

Defined in: packages/activerecord/lib/reflection.ts:509


pluralName ​

readonly pluralName: string

Defined in: packages/activerecord/lib/reflection.ts:384

Inherited from ​

MacroReflection.pluralName

Accessors ​

activeRecordPrimaryKey ​

Get Signature ​

get activeRecordPrimaryKey(): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:764

Returns ​

string | string[]


associationForeignKey ​

Get Signature ​

get associationForeignKey(): string

Defined in: packages/activerecord/lib/reflection.ts:741

Returns ​

string


autosave ​

Set Signature ​

set autosave(value): void

Defined in: packages/activerecord/lib/reflection.ts:416

Parameters ​
ParameterType
valueboolean
Returns ​

void

Inherited from ​

MacroReflection.autosave


chain ​

Get Signature ​

get chain(): AbstractReflection[]

Defined in: packages/activerecord/lib/reflection.ts:177

Returns ​

AbstractReflection[]

Inherited from ​

MacroReflection.chain


className ​

Get Signature ​

get className(): string

Defined in: packages/activerecord/lib/reflection.ts:132

Returns ​

string

Inherited from ​

MacroReflection.className


foreignType ​

Get Signature ​

get foreignType(): string | null

Defined in: packages/activerecord/lib/reflection.ts:617

Returns ​

string | null


joinForeignKey ​

Get Signature ​

get joinForeignKey(): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:760

Returns ​

string | string[]


joinPrimaryType ​

Get Signature ​

get joinPrimaryType(): string | null

Defined in: packages/activerecord/lib/reflection.ts:756

Returns ​

string | null


joinTable ​

Get Signature ​

get joinTable(): string

Defined in: packages/activerecord/lib/reflection.ts:632

Returns ​

string


klass ​

Get Signature ​

get klass(): typeof Base

Defined in: packages/activerecord/lib/reflection.ts:432

Returns ​

typeof Base

Inherited from ​

MacroReflection.klass


macro ​

Get Signature ​

get macro(): MacroType

Defined in: packages/activerecord/lib/reflection.ts:534

Returns ​

MacroType


nameString ​

Get Signature ​

get protected nameString(): string

Defined in: packages/activerecord/lib/reflection.ts:402

Returns ​

string

Inherited from ​

MacroReflection.nameString


scope ​

Get Signature ​

get scope(): ScopeBlock | null

Defined in: packages/activerecord/lib/reflection.ts:428

Returns ​

ScopeBlock | null

Inherited from ​

MacroReflection.scope


scopes ​

Get Signature ​

get scopes(): ScopeBlock[]

Defined in: packages/activerecord/lib/reflection.ts:141

Returns ​

ScopeBlock[]

Inherited from ​

MacroReflection.scopes


sourceReflection ​

Get Signature ​

get sourceReflection(): this

Defined in: packages/activerecord/lib/reflection.ts:834

Returns ​

this


strictLoading ​

Get Signature ​

get strictLoading(): boolean

Defined in: packages/activerecord/lib/reflection.ts:932

Returns ​

boolean

Overrides ​

MacroReflection.strictLoading


tableName ​

Get Signature ​

get tableName(): string | null

Defined in: packages/activerecord/lib/reflection.ts:121

Returns ​

string | null

Inherited from ​

MacroReflection.tableName


throughReflection ​

Get Signature ​

get throughReflection(): null

Defined in: packages/activerecord/lib/reflection.ts:830

Returns ​

null


type ​

Get Signature ​

get type(): string | null

Defined in: packages/activerecord/lib/reflection.ts:748

Returns ​

string | null

Methods ​

_klass() ​

_klass(className): typeof Base

Defined in: packages/activerecord/lib/reflection.ts:441

Parameters ​

ParameterType
classNamestring

Returns ​

typeof Base

Inherited from ​

MacroReflection._klass


addAsPolymorphicThrough() ​

addAsPolymorphicThrough(reflection, seed): AbstractReflection[]

Defined in: packages/activerecord/lib/reflection.ts:885

Parameters ​

ParameterType
reflectionAssociationReflection | ThroughReflection
seedAbstractReflection[]

Returns ​

AbstractReflection[]


addAsSource() ​

addAsSource(seed): AbstractReflection[]

Defined in: packages/activerecord/lib/reflection.ts:881

Parameters ​

ParameterType
seedAbstractReflection[]

Returns ​

AbstractReflection[]


addAsThrough() ​

addAsThrough(seed): AbstractReflection[]

Defined in: packages/activerecord/lib/reflection.ts:892

Parameters ​

ParameterType
seedAbstractReflection[]

Returns ​

AbstractReflection[]


aliasCandidate() ​

aliasCandidate(name): string

Defined in: packages/activerecord/lib/reflection.ts:344

Parameters ​

ParameterType
namestring

Returns ​

string

Inherited from ​

MacroReflection.aliasCandidate


associationClass() ​

associationClass(): typeof BelongsToAssociation | typeof HasOneAssociation | typeof HasManyAssociation

Defined in: packages/activerecord/lib/reflection.ts:869

Returns ​

typeof BelongsToAssociation | typeof HasOneAssociation | typeof HasManyAssociation


associationPrimaryKey() ​

associationPrimaryKey(klass?): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:737

Parameters ​

ParameterType
klass?typeof Base

Returns ​

string | string[]


associationScopeCache() ​

associationScopeCache(klass, owner, block): any

Defined in: packages/activerecord/lib/reflection.ts:785

Parameters ​

ParameterType
klasstypeof Base
ownerBase
block(params) => any

Returns ​

any


belongsTo() ​

belongsTo(): boolean

Defined in: packages/activerecord/lib/reflection.ts:153

Returns ​

boolean

Inherited from ​

MacroReflection.belongsTo


buildAssociation() ​

buildAssociation(attributes?, block?): Base

Defined in: packages/activerecord/lib/reflection.ts:125

Parameters ​

ParameterType
attributesRecord<string, unknown> | Map<string, unknown> | PermittedAttributes
block?(record) => void

Returns ​

Base

Inherited from ​

MacroReflection.buildAssociation


buildScope() ​

buildScope(table?, predicateBuilder?, klass?): any

Defined in: packages/activerecord/lib/reflection.ts:185

Parameters ​

ParameterType
table?Table | TableAlias
predicateBuilder?PredicateBuilder
klass?typeof Base

Returns ​

any

Inherited from ​

MacroReflection.buildScope


canFindInverseOfAutomatically() ​

protected canFindInverseOfAutomatically(reflection, inverseReflection?): boolean

Defined in: packages/activerecord/lib/reflection.ts:715

Parameters ​

ParameterTypeDefault value
reflectionAssociationReflection | ThroughReflectionundefined
inverseReflectionbooleanfalse

Returns ​

boolean


checkEagerLoadableBang() ​

checkEagerLoadableBang(): void

Defined in: packages/activerecord/lib/reflection.ts:815

Returns ​

void


checkValidityBang() ​

checkValidityBang(): void

Defined in: packages/activerecord/lib/reflection.ts:795

Returns ​

void


checkValidityOfInverseBang() ​

checkValidityOfInverseBang(): void

Defined in: packages/activerecord/lib/reflection.ts:271

Returns ​

void

Inherited from ​

MacroReflection.checkValidityOfInverseBang


clearAssociationScopeCache() ​

clearAssociationScopeCache(): void

Defined in: packages/activerecord/lib/reflection.ts:842

Returns ​

void


collectJoinChain() ​

collectJoinChain(): AbstractReflection[]

Defined in: packages/activerecord/lib/reflection.ts:838

Returns ​

AbstractReflection[]

Overrides ​

MacroReflection.collectJoinChain


computeClass() ​

computeClass(name): typeof Base

Defined in: packages/activerecord/lib/reflection.ts:902

Parameters ​

ParameterType
namestring

Returns ​

typeof Base

Overrides ​

MacroReflection.computeClass


constraints() ​

constraints(): ScopeBlock[]

Defined in: packages/activerecord/lib/reflection.ts:247

Returns ​

ScopeBlock[]

Inherited from ​

MacroReflection.constraints


counterCacheColumn() ​

counterCacheColumn(): string | null

Defined in: packages/activerecord/lib/reflection.ts:251

Returns ​

string | null

Inherited from ​

MacroReflection.counterCacheColumn


equals() ​

equals(other): boolean

Defined in: packages/activerecord/lib/reflection.ts:406

Parameters ​

ParameterType
otherunknown

Returns ​

boolean

Inherited from ​

MacroReflection.equals


extensions() ​

extensions(): any[]

Defined in: packages/activerecord/lib/reflection.ts:896

Returns ​

any[]


foreignKey() ​

foreignKey(__namedParameters?): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:539

Parameters ​

ParameterType
__namedParameters{ inferFromInverseOf?: boolean; }
__namedParameters.inferFromInverseOf?boolean

Returns ​

string | string[]


hasActiveCachedCounter() ​

hasActiveCachedCounter(): boolean

Defined in: packages/activerecord/lib/reflection.ts:328

Returns ​

boolean

Inherited from ​

MacroReflection.hasActiveCachedCounter


hasCachedCounter() ​

hasCachedCounter(): boolean

Defined in: packages/activerecord/lib/reflection.ts:319

Returns ​

boolean

Inherited from ​

MacroReflection.hasCachedCounter


hasInverse() ​

hasInverse(): string | false | null

Defined in: packages/activerecord/lib/reflection.ts:647

Returns ​

string | false | null

Overrides ​

MacroReflection.hasInverse


hasOne() ​

hasOne(): boolean

Defined in: packages/activerecord/lib/reflection.ts:161

Returns ​

boolean

Inherited from ​

MacroReflection.hasOne


hasScope() ​

hasScope(): boolean

Defined in: packages/activerecord/lib/reflection.ts:848

Returns ​

boolean


inverseOf() ​

inverseOf(): AssociationReflection | ThroughReflection | null

Defined in: packages/activerecord/lib/reflection.ts:651

Returns ​

AssociationReflection | ThroughReflection | null

Overrides ​

MacroReflection.inverseOf


inverseWhichUpdatesCounterCache() ​

inverseWhichUpdatesCounterCache(): AbstractReflection | null

Defined in: packages/activerecord/lib/reflection.ts:287

Returns ​

AbstractReflection | null

Inherited from ​

MacroReflection.inverseWhichUpdatesCounterCache


isBelongsTo() ​

isBelongsTo(): boolean

Defined in: packages/activerecord/lib/reflection.ts:157

Returns ​

boolean

Inherited from ​

MacroReflection.isBelongsTo


isCollection() ​

isCollection(): boolean

Defined in: packages/activerecord/lib/reflection.ts:169

Returns ​

boolean

Inherited from ​

MacroReflection.isCollection


isCounterMustBeUpdatedByHasMany() ​

isCounterMustBeUpdatedByHasMany(): boolean

Defined in: packages/activerecord/lib/reflection.ts:340

Returns ​

boolean

Inherited from ​

MacroReflection.isCounterMustBeUpdatedByHasMany


isHasOne() ​

isHasOne(): boolean

Defined in: packages/activerecord/lib/reflection.ts:165

Returns ​

boolean

Inherited from ​

MacroReflection.isHasOne


isInverseUpdatesCounterCache() ​

isInverseUpdatesCounterCache(): AbstractReflection | null

Defined in: packages/activerecord/lib/reflection.ts:304

Returns ​

AbstractReflection | null

Inherited from ​

MacroReflection.isInverseUpdatesCounterCache


isInverseUpdatesCounterInMemory() ​

isInverseUpdatesCounterInMemory(): boolean

Defined in: packages/activerecord/lib/reflection.ts:308

Returns ​

boolean

Inherited from ​

MacroReflection.isInverseUpdatesCounterInMemory


isNested() ​

isNested(): boolean

Defined in: packages/activerecord/lib/reflection.ts:844

Returns ​

boolean


isPolymorphic() ​

isPolymorphic(): boolean

Defined in: packages/activerecord/lib/reflection.ts:637

Returns ​

boolean

Overrides ​

MacroReflection.isPolymorphic


isThroughReflection() ​

isThroughReflection(): boolean

Defined in: packages/activerecord/lib/reflection.ts:111

Returns ​

boolean

Inherited from ​

MacroReflection.isThroughReflection


isValidate() ​

isValidate(): boolean

Defined in: packages/activerecord/lib/reflection.ts:641

Returns ​

boolean


joinIdFor() ​

joinIdFor(owner): any[]

Defined in: packages/activerecord/lib/reflection.ts:825

Parameters ​

ParameterType
ownerBase

Returns ​

any[]


joinPrimaryKey() ​

joinPrimaryKey(_klass?): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:752

Parameters ​

ParameterType
_klass?typeof Base

Returns ​

string | string[]


joinScope() ​

joinScope(table, foreignTable, foreignKlass): any

Defined in: packages/activerecord/lib/reflection.ts:193

Parameters ​

ParameterType
tableTable | TableAlias
foreignTableTable | TableAlias
foreignKlasstypeof Base

Returns ​

any

Inherited from ​

MacroReflection.joinScope


joinScopes() ​

joinScopes(table, predicateBuilder?, klass?, record?): any[]

Defined in: packages/activerecord/lib/reflection.ts:230

Parameters ​

ParameterType
tableTable | TableAlias
predicateBuilder?PredicateBuilder
klass?typeof Base
record?Base

Returns ​

any[]

Inherited from ​

MacroReflection.joinScopes


klassJoinScope() ​

klassJoinScope(table?, predicateBuilder?): any

Defined in: packages/activerecord/lib/reflection.ts:242

Parameters ​

ParameterType
table?Table | TableAlias
predicateBuilder?PredicateBuilder

Returns ​

any

Inherited from ​

MacroReflection.klassJoinScope


polymorphicInverseOf() ​

polymorphicInverseOf(associatedClass): AssociationReflection | ThroughReflection | null

Defined in: packages/activerecord/lib/reflection.ts:852

Parameters ​

ParameterType
associatedClasstypeof Base

Returns ​

AssociationReflection | ThroughReflection | null


polymorphicName() ​

polymorphicName(): string

Defined in: packages/activerecord/lib/reflection.ts:877

Returns ​

string


primaryKey() ​

protected primaryKey(klass): string | string[]

Defined in: packages/activerecord/lib/reflection.ts:115

Parameters ​

ParameterType
klasstypeof Base

Returns ​

string | string[]

Inherited from ​

MacroReflection.primaryKey


scopeFor() ​

scopeFor(relation, owner?): any

Defined in: packages/activerecord/lib/reflection.ts:457

Parameters ​

ParameterTypeDefault value
relationanyundefined
owneranynull

Returns ​

any

Inherited from ​

MacroReflection.scopeFor


strictLoadingViolationMessage() ​

strictLoadingViolationMessage(owner): string

Defined in: packages/activerecord/lib/reflection.ts:348

Parameters ​

ParameterType
ownerunknown

Returns ​

string

Inherited from ​

MacroReflection.strictLoadingViolationMessage