Skip to content

hasMany shortcut association not recognised by include - "association not found" error #3208

Description

@chapmandu

Describe the bug
Wheels v4. Using a hasMany shortcut with the name of an existing model, an "association not found" exception occurs.

To Reproduce

// models/Product.cfc
hasMany(name = "ProductCategories", shortcut = "Category");

// models/ProductCategory.cfc
belongsTo(name = "Product");
belongsTo(name = "Category");

// models/Category.cfc
hasMany(name = "ProductCategories");

// throws "association not found" exception
model("Product").findAll(include = "Category");

Expected behavior
The model findAll call should join to Category model through the ProductCategories "bridge" table/model.

Additional context
Apologies for pseudo-code.. I had to change branches for work and wanted to log the issue before I forgot the specifics.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions