From f7ef9457a3489a7c75c49484de26502d2a222bc3 Mon Sep 17 00:00:00 2001 From: Aivaras Gotovskis Date: Thu, 5 Feb 2015 15:59:48 +0200 Subject: [PATCH] More improvements. --- .../doc/sync/descriptors/descriptors.rst | 32 +++++++++++++---- Resources/doc/sync/sync.rst | 2 +- Tests/app/config/injection_test.yml | 36 +++++++++---------- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/Resources/doc/sync/descriptors/descriptors.rst b/Resources/doc/sync/descriptors/descriptors.rst index fe6ae6c..dd5c1ae 100644 --- a/Resources/doc/sync/descriptors/descriptors.rst +++ b/Resources/doc/sync/descriptors/descriptors.rst @@ -37,21 +37,21 @@ Example simple extraction Descriptors setup: # Descriptor for category creation. my_project.extractor.descriptors.category.create: class: %ongr_connections.extractor.descriptor.class% - arguments: [my_categories, C, 1, category, NEW.categories_id] + arguments: [my_categories, C, NEW.categories_id, 1, category] tags: - { name: ongr_connections.extraction_descriptor } # This tag is used to collect all descriptors. # Descriptor for category update. my_project.extractor.descriptors.category.update: class: %ongr_connections.extractor.descriptor.class% - arguments: [my_categories, U, 1, category, NEW.categories_id] + arguments: [my_categories, U, NEW.categories_id, 1, category] tags: - { name: ongr_connections.extraction_descriptor } # This tag is used to collect all descriptors. # Descriptor for category deletion my_project.extractor.descriptors.category.delete: class: %ongr_connections.extractor.descriptor.class% - arguments: [my_categories, D, 1, category, OLD.categories_id] + arguments: [my_categories, D, OLD.categories_id, 1, category] tags: - { name: ongr_connections.extraction_descriptor } # This tag is used to collect all descriptors. @@ -89,8 +89,26 @@ Example cascading change configuration: .. code-block:: yaml - parameters: - ongr_connections.extractor.join_relation.class: ONGR\ConnectionsBundle\Sync\Extractor\Relation\JoinRelation + services: + # + # Create and delete descriptors omitted for brevity. + # + my_project.extractor.descriptors.category.update: + class: %ongr_connections.extractor.descriptor.class% + arguments: [my_categories, U, NEW.categories_id, 1, category] + tags: + - { name: ongr_connections.extraction_descriptor } + calls: + - [ addRelation, [ @my_project.extractor.descriptors.product.join.category ] ] # Call this relation if category is updated. + + my_project.extractor.descriptors.product.join.category: + class: %ongr_connections.extractor.join_relation.class% + arguments: [my_products_to_categories AS product_to_category, product_to_category.products_id, product_to_category.categories_id=NEW.categories_id, product, U, 1] +.. + +Example cascading change but not effecting triggered item: + +.. code-block:: yaml services: # @@ -98,11 +116,11 @@ Example cascading change configuration: # my_project.extractor.descriptors.category.update: class: %ongr_connections.extractor.descriptor.class% - arguments: [my_categories, U, 1, category, NEW.categories_id] + arguments: [my_categories, U, NEW.categories_id] tags: - { name: ongr_connections.extraction_descriptor } calls: - - [ addRelation, [ @my_project.sql_relations.product.join.category ] ] # Call this relation if category is updated. + - [ addRelation, [ @my_project.extractor.descriptors.product.join.category ] ] # Call this relation if category is updated. my_project.extractor.descriptors.product.join.category: class: %ongr_connections.extractor.join_relation.class% diff --git a/Resources/doc/sync/sync.rst b/Resources/doc/sync/sync.rst index 52b8fd8..03e46bb 100644 --- a/Resources/doc/sync/sync.rst +++ b/Resources/doc/sync/sync.rst @@ -69,7 +69,7 @@ This bundle provides implementation which uses mysql database as synchronization Configuration ~~~~~~~~~~~~~ -See `Extraction Descriptors documentation `_ for information on how to configure what should be +See `Extraction Descriptors documentation `_ for information on how to configure what should be included in continuous synchronization. Sub-topics diff --git a/Tests/app/config/injection_test.yml b/Tests/app/config/injection_test.yml index 049cb24..b07ca61 100644 --- a/Tests/app/config/injection_test.yml +++ b/Tests/app/config/injection_test.yml @@ -1,6 +1,4 @@ parameters: - ongr_project.extractor.descriptor.class: ONGR\ConnectionsBundle\Sync\Extractor\Descriptor\ExtractionDescriptor - ongr_project.extractor.join_relation.class: ONGR\ConnectionsBundle\Sync\Extractor\Descriptor\JoinRelation ongr_project.sql_relations.category.fields: - OXTITLE # import modifier test class. @@ -9,48 +7,48 @@ parameters: ongr_connections.sync.execute.modifier.class: ONGR\ConnectionsBundle\Tests\Functional\Fixtures\SyncCommandsTest\TestModifyEventListener services: - ongr_project.sql_relations.category.delete: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.category.delete: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxcategories, D, OLD.OXID, 1, category] tags: - { name: ongr_connections.extraction_descriptor } calls: - - [ addRelation, [ @ongr_project.sql_relations.category.join.articles ] ] + - [ addRelation, [ @ongr_project.extractor.descriptors.category.join.articles ] ] - ongr_project.sql_relations.category.update: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.category.update: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxcategories, U, OLD.OXID, 1, category, %ongr_project.sql_relations.category.fields%] tags: - { name: ongr_connections.extraction_descriptor } calls: - - [ addRelation, [ @ongr_project.sql_relations.category.join.articles ] ] + - [ addRelation, [ @ongr_project.extractor.descriptors.category.join.articles ] ] - ongr_project.sql_relations.category.join.articles: - class: %ongr_project.extractor.join_relation.class% + ongr_project.extractor.descriptors.category.join.articles: + class: %ongr_connections.extractor.join_relation.class% arguments: [oxobject2category AS oc, oc.OXOBJECTID, oc.OXCATNID=NEW.OXID, product, U, 1] - ongr_project.sql_relations.product.create: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.product.create: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxarticles, C, NEW.OXID, 1, product] tags: - { name: ongr_connections.extraction_descriptor } - ongr_project.sql_relations.product.update: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.product.update: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxarticles, U, OLD.OXID, 1, product] tags: - { name: ongr_connections.extraction_descriptor } - ongr_project.sql_relations.product.delete: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.product.delete: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxarticles, D, OLD.OXID, 1, product] tags: - { name: ongr_connections.extraction_descriptor } - ongr_project.sql_relations.category.product.update: - class: %ongr_project.extractor.descriptor.class% + ongr_project.extractor.descriptors.category.product.update: + class: %ongr_connections.extractor.descriptor.class% arguments: [oxcategories, U, OLD.OXID] tags: - { name: ongr_connections.extraction_descriptor } calls: - - [ addRelation, [ @ongr_project.sql_relations.category.join.articles ] ] + - [ addRelation, [ @ongr_project.extractor.descriptors.category.join.articles ] ]