From a60c46164c02ee1f2de729ad96ecd484da52832c Mon Sep 17 00:00:00 2001 From: Axel Guckelsberger Date: Tue, 16 Jan 2024 20:24:12 +0100 Subject: [PATCH] remove support for deprecated notify change tracking policy --- .../cartridges/symfony/models/Entities.xtend | 13 +-------- .../symfony/models/entity/EntityMethods.xtend | 29 ------------------- .../symfony/smallstuff/FileHelper.xtend | 12 -------- .../extensions/ModelExtensions.xtend | 10 +------ 4 files changed, 2 insertions(+), 62 deletions(-) diff --git a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/Entities.xtend b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/Entities.xtend index 34f2c5fc7..0231e4ddb 100644 --- a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/Entities.xtend +++ b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/Entities.xtend @@ -145,10 +145,6 @@ class Entities { imports.add('Doctrine\\Common\\Collections\\Collection') } } - if (isBase && hasNotifyPolicy) { - imports.add('Doctrine\\Common\\NotifyPropertyChanged') - imports.add('Doctrine\\Common\\PropertyChangedListener') - } if (isBase || loggable || hasTranslatableFields || tree != EntityTreeType.NONE) { imports.add('Gedmo\\Mapping\\Annotation as Gedmo') } @@ -236,7 +232,7 @@ class Entities { * inherit orm properties. */ #[ORM\MappedSuperclass] - abstract class Abstract«name.formatForCodeCapital»«IF isInheriting» extends BaseEntity«ENDIF» implements AbstractEntityInterface«IF it instanceof Entity»«IF it.hasNotifyPolicy», NotifyPropertyChanged«ENDIF»«IF it.hasTranslatableFields», Translatable«ENDIF»«ENDIF» + abstract class Abstract«name.formatForCodeCapital»«IF isInheriting» extends BaseEntity«ENDIF» implements AbstractEntityInterface«IF it instanceof Entity»«IF it.hasTranslatableFields», Translatable«ENDIF»«ENDIF» { «modelEntityBaseImplBody(app)» } @@ -255,13 +251,6 @@ class Entities { * The tablename this object maps to */ protected string $_objectType = '«name.formatForCode»'; - «IF it instanceof Entity && (it as Entity).hasNotifyPolicy» - - /** - * List of change notification listeners - */ - protected array $_propertyChangedListeners = []; - «ENDIF» «IF hasUploadFieldsEntity» /** diff --git a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/entity/EntityMethods.xtend b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/entity/EntityMethods.xtend index fd94e5561..89dc389ad 100644 --- a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/entity/EntityMethods.xtend +++ b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/models/entity/EntityMethods.xtend @@ -32,7 +32,6 @@ class EntityMethods { ''' def dispatch generate(Entity it, Application app, Property thProp) ''' - «propertyChangedListener» «validationMethods» «createUrlArgs» @@ -56,34 +55,6 @@ class EntityMethods { «ENDIF» ''' - def private propertyChangedListener(Entity it) ''' - «IF hasNotifyPolicy» - /** - * Adds a property change listener. - */ - public function addPropertyChangedListener(PropertyChangedListener $listener): void - { - $this->_propertyChangedListeners[] = $listener; - } - - /** - * Notify all registered listeners about a changed property. - * - * @param mixed $oldValue The old property value - * @param mixed $newValue The new property value - */ - protected function _onPropertyChanged(string $propName, $oldValue, $newValue): void - { - if ($this->_propertyChangedListeners) { - foreach ($this->_propertyChangedListeners as $listener) { - $listener->propertyChanged($this, $propName, $oldValue, $newValue); - } - } - } - - «ENDIF» - ''' - def private createUrlArgs(Entity it) ''' /** * Creates url arguments array for easy creation of display urls. diff --git a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/smallstuff/FileHelper.xtend b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/smallstuff/FileHelper.xtend index e9b7a56dd..6dc6bbdb1 100644 --- a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/smallstuff/FileHelper.xtend +++ b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/cartridges/symfony/smallstuff/FileHelper.xtend @@ -5,22 +5,17 @@ import de.guite.modulestudio.metamodel.ArrayField import de.guite.modulestudio.metamodel.BooleanField import de.guite.modulestudio.metamodel.DatetimeField import de.guite.modulestudio.metamodel.DerivedField -import de.guite.modulestudio.metamodel.Entity import de.guite.modulestudio.metamodel.IntegerField import de.guite.modulestudio.metamodel.NumberField import de.guite.modulestudio.metamodel.NumberFieldType import de.guite.modulestudio.metamodel.UserField import org.zikula.modulestudio.generator.extensions.FormattingExtensions -import org.zikula.modulestudio.generator.extensions.ModelExtensions -import org.zikula.modulestudio.generator.extensions.ModelInheritanceExtensions import org.zikula.modulestudio.generator.extensions.ModelJoinExtensions import org.zikula.modulestudio.generator.extensions.Utils class FileHelper { extension FormattingExtensions = new FormattingExtensions - extension ModelExtensions = new ModelExtensions - extension ModelInheritanceExtensions = new ModelInheritanceExtensions extension ModelJoinExtensions = new ModelJoinExtensions extension Utils = new Utils @@ -88,18 +83,11 @@ class FileHelper { } ''' - def triggerPropertyChangeListeners(DerivedField it, String name) ''' - «IF null !== entity && ((entity instanceof Entity && (entity as Entity).hasNotifyPolicy) || entity.getInheritingEntities.exists[hasNotifyPolicy])» - $this->_onPropertyChanged('«name.formatForCode»', $this->«name.formatForCode», $«name»); - «ENDIF» - ''' - def private dispatch setterMethodImpl(DerivedField it, String name, String type, Boolean nullable) ''' «IF it instanceof NumberField» $«name» = «IF it.numberType == NumberFieldType::DECIMAL»(string) «ENDIF»round((float) $«name», «scale»); «ENDIF» if ($this->«name.formatForCode» !== $«name») { - «triggerPropertyChangeListeners(name)» «setterAssignment(name)» } ''' diff --git a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/extensions/ModelExtensions.xtend b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/extensions/ModelExtensions.xtend index 58e6cbe6a..c5bd7a2cb 100644 --- a/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/extensions/ModelExtensions.xtend +++ b/bundles/org.zikula.modulestudio.generator/src/org/zikula/modulestudio/generator/extensions/ModelExtensions.xtend @@ -12,7 +12,6 @@ import de.guite.modulestudio.metamodel.DerivedField import de.guite.modulestudio.metamodel.EmailField import de.guite.modulestudio.metamodel.EmailValidationMode import de.guite.modulestudio.metamodel.Entity -import de.guite.modulestudio.metamodel.EntityChangeTrackingPolicy import de.guite.modulestudio.metamodel.EntityIdentifierStrategy import de.guite.modulestudio.metamodel.EntityIndexType import de.guite.modulestudio.metamodel.EntityLockType @@ -28,11 +27,11 @@ import de.guite.modulestudio.metamodel.OneToOneRelationship import de.guite.modulestudio.metamodel.StringField import de.guite.modulestudio.metamodel.StringRole import de.guite.modulestudio.metamodel.TextField +import de.guite.modulestudio.metamodel.TextRole import de.guite.modulestudio.metamodel.UploadField import de.guite.modulestudio.metamodel.UploadNamingScheme import de.guite.modulestudio.metamodel.UrlField import de.guite.modulestudio.metamodel.UserField -import de.guite.modulestudio.metamodel.TextRole /** * This class contains model related extension methods. @@ -641,13 +640,6 @@ class ModelExtensions { } } - /** - * Checks whether this entity has enabled the notify tracking policy. - */ - def hasNotifyPolicy(Entity it) { - changeTrackingPolicy == EntityChangeTrackingPolicy.NOTIFY - } - /** * Checks whether this entity has enabled optimistic locking. */