Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

SoftDelete Behavior broken for relationships if alias is different from className #147

Open
inigoflores opened this issue Nov 1, 2015 · 1 comment

Comments

@inigoflores
Copy link

MissingModelException is thrown if SoftDeleteBehavior is attached to models using belongTo relationships declared with an alias other than a valid existing className.

Bug was introduced by #139. The problem is further described by @ravage84 in a #139 comment.

He also provides hints for the fix: ravage84/softdeletebbehavior-prob@4cf935c

inigoflores added a commit to inigoflores/utils that referenced this issue Nov 1, 2015
@inigoflores
Copy link
Author

I have investigated the issue further, and what seems to be causing the problem is the SoftDelete behavior attaching to relationships and trying to query the database before the fixtures have been loaded.

The following will throw MissingTableException for relationships

        if ($model->hasField($flag)) {

Unfortunately #139 does not solve the problem for complex HABTM relationships.

Related:

Possibly related:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant