Skip to content

Cascade delete throws a ambiguous column exception #11170

@lbvnieuw

Description

@lbvnieuw

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.5.1.

What I did

I created a table Pages with an hasMany association Images, the foreign key is "foreign_key", dependent and cascadeDelete are both true. The Image table on its own has a hasMany association Translations, the foreign key is "foreign_key", dependent and cascadeDelete for this association are also true.

What happened

When I try to delete a Page I got the "column foreign_key in where clause is ambiguous" exception.
The exception is thrown from the DependentDeleteHelper.
The created conditions are lacking the table aliasses.

What you expected to happen

That deleting a page also triggers the callbacks for deleting an image and that image its translations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions