-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
OneToMany not syncing with Eloquent Driver #43
Comments
I'm also dealing with this issue. I did some digging and found a couple things: In $this->effectedEntries = array_merge(
$this->effectedEntries,
$entries->keyBy('id')->all()
); This leads to an issue in if ($relationship->rightType == 'entry' && ! array_key_exists($id, $this->effectedEntries)) {
return false;
} I tested out replacing This lead to another issue though. After the update, saving an entry with a relationship did not work. I would link an entry using the CP but after it saved, the entry would just disappear. So I looked a little further and it seems to be an issue in foreach ($results->added as $addedId) {
if ($this->shouldProcessRelationship($relationship, $addedId)) {
$this->dependencies[] = $addedId;
$dependent = Data::find($this->getDependency($relationship, $addedId));
if ($this->withDependent && $dependent !== null && $inverse = $relationship->getInverse()) {
$leftReference = $dependent->get($relationship->leftField);
if (($key = array_search($addedId, $leftReference)) !== false) {
unset($leftReference[$key]);
$dependent->set($relationship->leftField, array_values($leftReference));
$dependent->saveQuietly();
}
}
$this->setFieldValue($relationship, $this->getEffectedEntity($relationship, $addedId));
}
} |
It seems I'm running into this as well, although I'm seeing the issue (using Eloquent) with a one to many relationship between entries and users. I've also seen examples of users getting related to entries that shouldn't be related. So something must definitely be off here. |
I cannot seem to get my collectons to sync using a OneToMany relationship. I'm using eloquent driver with the following setup:
My two collections are as follows:
I'm trying to set up the following relationship:
My blueprints have the following fields:
article.yaml
quote.yaml
Output of php please relate:list
Some observations:
Is there a misconfiguration on my part, or is there a potential bug at play?
The text was updated successfully, but these errors were encountered: