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

Unable to use with sofa/eloquence #1

Closed
gerardbalaoro opened this issue Nov 22, 2019 · 2 comments
Closed

Unable to use with sofa/eloquence #1

gerardbalaoro opened this issue Nov 22, 2019 · 2 comments
Labels
Enhancement New feature or request

Comments

@gerardbalaoro
Copy link

Sofa/Eloquence ports with its own QueryBuilder class that extends Laravel's. So calling joinRelations on a model that uses Eloquence throws:

ReflectionException: Given object is not an instance of the class this property was declared in
..\vendor\reedware\laravel-relation-joins\src\Concerns\ForwardsParentCalls.php:78

It was this method:

public function assignAcquiredProperties($parent)
    {
        foreach ((new ReflectionClass($parent))->getProperties() as $property) {
 
            if($property->isStatic()) {
                continue;
            }
 
            $property->setAccessible(true);
 
            $property->setValue($parent, $property->getValue($this));
 
        }
 
        return $this;
  }
@tylernathanreed tylernathanreed added the Enhancement New feature or request label Nov 25, 2019
@tylernathanreed
Copy link
Owner

@gerardbalaoro

Since this is a cross-over issue with another third-party package, I'm considering this an enhancement, rather than a bug.

Nevertheless, I'll take a stab at it the next chance I get, but feel free to submit your own PR.

@tylernathanreed
Copy link
Owner

@gerardbalaoro,

With the introduction of Mixins in Laravel 6.x (and that now being the minimum supported version), I was able to rebuild this package using Mixins, rather than having to override the default query builder and relations.

Since that was the core issue here, I believe we can call this resolved.

lparede added a commit to lparede/laravel-relation-joins that referenced this issue Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants