-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
String instead of Attribute passed down in AttributeBag #32
Comments
I will take a look at this. |
@DraperStudio please paste the data and your code. It seems odd that you get different results in this case. The best would be calls from tinker, where you store the value, then get it with error. |
ghost
mentioned this issue
Oct 23, 2015
Psy Shell v0.5.2 (PHP 5.6.14-1+deb.sury.org~trusty+1 — cli) by Justin Hileman
>>> namespace App;
=> null
>>> Post::first()->options
=> [
"some_option" => false,
"another_option" => false,
]
>>> Category::first()->posts()->first()->options
=> Argument 1 passed to Sofa\Eloquence\Metable\AttributeBag::addInstance() must be an instance of Sofa\Eloquence\Metable\Attribute, string given, called in /home/vagrant/Code/homestead/vendor/sofa/eloquence/src/Metable/AttributeBag.php on line 66 and defined
>>> |
fixed in 5.1.5 |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to store an array of data as a meta attribute. This attribute gets stored as JSON with a
meta_type
ofStdClass
.Now when I retrieve a model directly and retrieve the meta attribute like this
Post::first()->options
everything is working fine. Now comes the weird issue.When I want to retrieve the model through a relationship and try to access the meta attribute like this
Category::first()->posts()->first()->options
I get the following exception.When I dump the value that is passed down in Line 66 it is the value of the
meta_value
column instead of anAttribute
instance.What could cause this issue? I am trying to figure it out but can't really find anything.
The text was updated successfully, but these errors were encountered: