Class Index | File Index

## Classes

- _Association
- _global_
- Dataset
- ManyToMany
- ManyToOne
- MayToOne
- Migrations
- Model
- moose
- moose.adapters
- moose.adapters.client.Client
- moose.adapters.client.ConnectionPool
- moose.adapters.client.mysql.ConnectionPool
- moose.adapters.client.mysql.Query
- moose.adapters.client.mysql.TransactionQuery
- moose.adapters.mysql
- moose.adapters.mysql.types
- moose.plugins
- moose.plugins.AssociationPlugin
- moose.plugins.CachePlugin
- moose.plugins.QueryPlugin
- moose.plugins.TimeStampPlugin
- moose.Table
- OneToMany
- SQL
- Type

# Class _Association

Base class for all associations. NOT to be instantiated directly Its just documented for reference.
Defined in: _Association.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| _Association(options)

Field Summary
Field Attributes | Field Name and Description
--- | ---
<static> | _Association.fetch Fetch types
| fetchType Fetch type
| filter Our filter method
| leftKey The key on this models class to look up
| model the model associatied with this association.
| orderBy how to order our association
| rightKey The join key to look up on our associated model

Method Summary
Method Attributes | Method Name and Description
--- | ---
| fetch(parent) Filters and loads our association.
| inject(parent, name) Method to inject functionality into a model.
| isEager()

Class Detail
_Association(options)

Parameters:
{Object} options
{String} options.model
  a string to look up the model that we are associated with
{Function} options.filter
  a callback to find association if a filter is defined then the association is read only
{Object} options.key
  object with left key and right key
{String|Object} options.orderBy<String|Object>
  - how to order our association @see Dataset.order
{fetch.EAGER|fetch.LAZY} options.fetchType
  the fetch type of the model if fetch.Eager is supplied then the associations are automatically filled, if fetch.Lazy is supplied then a promise is returned and is called back with the loaded models

Field Detail
<static> _Association.fetch
Fetch types

fetchType
Fetch type

filter
Our filter method

leftKey
The key on this models class to look up

{Model} model
the model associatied with this association.

orderBy
how to order our association

rightKey
The join key to look up on our associated model
Method Detail
{comb.Promise} fetch(parent)
Filters and loads our association.

Parameters:
parent

Returns:
  {comb.Promise} Called back with the associations.

inject(parent, name)
Method to inject functionality into a model. This method alters the model to prepare it for associations, and initializes all required middleware calls to fulfill requirements needed to loaded the associations.

Parameters:
{Model} parent
  the model that is having an associtaion set on it.
{String} name
  the name of the association.

{Boolean} isEager()

Returns:
  {Boolean} true if the association is eager.

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Jun 11 2011 03:16:39 GMT-0500 (CDT)