Connection and repeater issue
- Dominant language
- PHP
- Stars
- 132
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
i am getting following error while querying for repeater
`Call to a member function get() on null`
here is my query
`$post->acf->repeater('activity_details')`
i guess it is because of not getting type of field required in Repeater class fetchFields function
```
In repeater.php following function is calling get on $field which is null
as FieldFactory::make is returning null becuse of type not found
protected function fetchFields($fieldName, Builder $builder)
{
$fields = [];
foreach ($builder->get() as $meta) {
$id = $this->retrieveIdFromFieldName($meta->meta_key, $fieldName);
$name = $this->retrieveFieldName($meta->meta_key, $fieldName, $id);
$post = $this->post->ID != $meta->post_id ? $this->post->find($meta->post_id) : $this->post;
$field = FieldFactory::make($meta->meta_key, $post);
$fields[$id][$name] = $field->get();
}
return $fields;
}
```
another issue is when i try to query image following error occurs
```
QueryException in Connection.php line 729:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'main_site_db.postmeta' doesn't exist (SQL: select * from `postmeta` where `post_id` = 275 and `meta_key` = _wp_attachment_metadata limit 1)
```
i have created seprate connection as below
```
'wp' => [
'driver' => 'mysql',
'host' => 'localhost',
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'localhost'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'kiu_',
'strict' => false,
'engine' => null,
],
```
and added connection to post class
```
namespace App;
use Corcel\Post as Corcel;
class Post extends Corcel
{
protected $connection = 'wp';
}
```
but still getting this error
If i change table prefix in laravel default connection which if for laravel error disapears but i get another error by laravel complaining about prefix..
i have same database for both laravel and wordpress but i am using prefix for only wordpress tables and laravel tables are without prefix...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.