Skip to content

class Athena::ORM::Mapping::ManyToManyOwningSide
inherits Athena::ORM::Mapping::OwningSide #

Mapping for the owning side of a ManyToMany association. The owning side is responsible for managing the join table.

Without AORMA::JoinTable, AORMA::JoinColumn, and AORMA::InverseJoinColumn annotations, the join table is named <source>_<target> after the underscored class names, e.g. user_group. Its columns are named <class>_id after the underscored class names, e.g. user_id and group_id, referencing the id columns of the source and target tables. For a self-referencing association, they're named <class>_source and <class>_target instead, e.g. user_source and user_target. Join table columns are never nullable.

Default join columns are declared ON DELETE CASCADE, as are those given on_delete: "CASCADE", see #on_delete_cascade?. The database is then expected to delete the join table rows of a removed entity, rather than the ORM.

Included modules

Athena::ORM::Mapping::ManyToMany

Methods#

#index_by : String | ::Nil#

Optional index column for indexed collections.

Todo

Recorded, but collections aren't indexed by it yet.

View source

#index_by=(index_by : String | Nil)#

Optional index column for indexed collections.

Todo

Recorded, but collections aren't indexed by it yet.

View source

#join_table : JoinTable | ::Nil#

The join table mapping.

View source

#join_table=(join_table : JoinTable | Nil)#

The join table mapping.

View source

#relation_to_source_key_columns : Hash(String, String)#

Maps join table column name to source entity column name.

View source

#relation_to_source_key_columns=(relation_to_source_key_columns : Hash(String, String))#

Maps join table column name to source entity column name.

View source

#relation_to_target_key_columns : Hash(String, String)#

Maps join table column name to target entity column name.

View source

#relation_to_target_key_columns=(relation_to_target_key_columns : Hash(String, String))#

Maps join table column name to target entity column name.

View source