Closed lasmanis closed 7 years ago
I'm experience the same issue.
Hi @lasmanis and @Charl13 thanks for reporting. Can you send a PR request fixing those issues? Please make sure all unit tests are passing and maybe if possible write a new one that tests this particular behavior. I guess I will not have enough time until the next week to do that, sorry about that. If you can, please send a PR :D
I fixed the database connection issue, maybe this fix the problem you were experiencing. JG
I'm trying to access a repeater field like so:
$this->acf->repeater('field_name');
Where
$this
is an instance of a Model that is a child of Corcel\Post through 2 levels of inheritance. My Model overridesprotected $postType = 'my_post_type';
.By using this code I'm getting an error in line 113 of the BasicField class.
Particularly,
$post
isnull
.I tried changing the line
$post = $this->post->where('post_name', $fieldKey)->first();
to$post = Post::where('post_name', $fieldKey)->first();
and that seem to work. It seems like$this->post
is adding apost_type
restriction to the SQL query that's being executed.I would appreciate to hear your thoughts on this.
Edit:
I'm actually having the same issue anywhere the
$post
variable is being used to perform a query. For instance, line 52 of File.php ($post->find($value);
doesn't work,Post::find($value);
does). So this is an issue not just related to the repeater field.Regards, Leonidas