-
Notifications
You must be signed in to change notification settings - Fork 21
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
Hotfix/reset fallback #321
Conversation
This is now correctly handled in FallbackResetSubscriber and should be handled in user land respectively for all occasions where the subscriber is not available. This is needed as we have no clue how to filter the values otherwise.
We now determine the reset behaviour by examining the parent child relationship definitions.
This is an attempt to solve #303 (which is duped by MetaModels/core#35). Deprecates `DataProviderInterface::resetFallback()`.
I found a warning with
if I open the list of attributes (attribut icon) we have the follow warning
|
This does not happen on my side. I can list the attributes just fine. |
is fixed with #323 |
this implementation MetaModels/core#1213 have a bug in https://github.com/contao-community-alliance/dc-general/blob/master/src/ContaoCommunityAlliance/DcGeneral/Contao/Subscriber/FallbackResetSubscriber.php#L90 this method should reset the parameter e.g. "isdefault" only if the new item is set as default (=1) private function handleFallback(AbstractModelAwareEvent $event)
{
$model = $event->getModel();
$dataProvider = $event->getEnvironment()->getDataProvider($model->getProviderName());
$properties = $event->getEnvironment()->getDataDefinition()->getPropertiesDefinition();
foreach (array_keys($model->getPropertiesAsArray()) as $propertyName) {
if (!$properties->hasProperty($propertyName)) {
continue;
}
$extra = (array) $properties->getProperty($propertyName)->getExtra();
if (array_key_exists('fallback', $extra) && (true === $extra['fallback'])) {
// BC Layer - use old reset fallback methodology until it get's removed.
if (null === ($config = $this->determineFilterConfig($event))) {
// @codingStandardsIgnoreStart
@trigger_error(
'DataProviderInterface::resetFallback is deprecated - ' .
'Please specify proper parent child relationship',
E_USER_DEPRECATED
);
// @codingStandardsIgnoreEnd
$dataProvider->resetFallback($propertyName);
}
+ if (!$model->getProperty($propertyName)) {
+ continue;
+ }
$models = $dataProvider->fetchAll($config);
foreach ($models as $resetModel) {
if ($model->getId() === $resetModel->getId()) {
continue;
}
$resetModel->setProperty($propertyName, null);
$dataProvider->save($resetModel);
}
}
}
}
`` |
Please open a new ticket in instead of necroposting to merged pull requests. |
done #402 |
This reverts commit 66159cb.
This is an attempt to solve #303 (which is duped by MetaModels/core#35).
We are now examining the parent child relationship of the data container to determine the siblings of the passed model and reset only within those.
Additionally, the method
DataProviderInterface::resetFallback()
has been deprecated, as it won't be possible to implement it properly without passing a config and/or making the driver stateful of which both are not good at all.I like the approach to shift the responsibility into the reset listener much more.
Please test this implementation, I performed tests with MetaModels/core and defining render settings and input screens worked again.