Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow behaviors to load classes without being the main model of a capsule #2423

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

Tofandel
Copy link
Contributor

@Tofandel Tofandel commented Feb 6, 2024

Makes the logic for finding behavioral models part of the Capsule helper and allow to load classes without being the main model of a capsule

Fixes an issue with some behaviors simply not working if they are not part of the main model of the capsule

For example for HasSlugs of the class Package\Capsules\MyCapsule\MySubCapsule this is the order it will try to load classes in

  1. App\Twill\Models\Slugs\MySubCapsuleSlug
  2. Package\Capsules\MyCapsule\MySubCapsuleSlug // Will not fail if the model is a secondary model of the capsule
  3. Package\Capsules\MyCapsule\Slugs\MySubCapsuleSlug
  4. Package\Capsules\MyCapsule\MyCapsuleSlug // Will fail if the model is a secondary model of a capsule

Fix the method getSlugClass which had the wrong return type and was missing parenthesis (so it was trying to find a property rather than calling a method)

@Tofandel Tofandel force-pushed the patch-4 branch 2 times, most recently from c73548f to 4685e83 Compare February 6, 2024 14:51
@ifox ifox merged commit 8212530 into area17:3.x Feb 14, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants