Open dimahali opened 7 years ago
@dimahali hey! try to set your wp connection name to wordpress
or corcel
. Corcel checks for both connection names by default ;-)
Thanks @jgrossi it worked but what about repeater issue? I am getting the same issue
Call to a member function get() on null
when i change following function in Repeater.php
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(); //old line
$fields[$id][$name] = ($field) ? $field->get() : $meta->meta_value; //new line
}
return $fields;
}
i get result but i am not getting image, instead id of image as below
Collection {#1860 ▼
#items: array:2 [▼
0 => array:5 [▼
"sub_title" => "sadf"
"sub_title_urdu" => "dsaf"
"image" => "473"
"details" => "sadf"
"details_urdu" => "adsf"
]
1 => array:5 [▶]
]
}
i guess we are not getting field type in the following line
FieldFactory::make($meta->meta_key, $post);
hey @jgrossi any update?
Still a problem. Setting connection name to 'wordpress' or 'corcel' has no effect.
This was the solution for me (my repeater contained images) https://github.com/corcel/acf/pull/84/commits/9ee12a3f13962f988d679a902ead9e6ee298157c
Hopefully they will merge the PR soon. For the moment I have to modify the code directly or use a local repo.
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
another issue is when i try to query image following error occurs
i have created seprate connection as below
and added connection to post class
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...