Skip to content

Commit

Permalink
More improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandLTU committed Feb 5, 2015
1 parent 26d6fb0 commit f7ef945
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
32 changes: 25 additions & 7 deletions Resources/doc/sync/descriptors/descriptors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -89,20 +89,38 @@ 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:
#
# Create and delete descriptors omitted for brevity.
#
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%
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/sync/sync.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This bundle provides implementation which uses mysql database as synchronization
Configuration
~~~~~~~~~~~~~

See `Extraction Descriptors documentation <descriptors/sql_relations.rst>`_ for information on how to configure what should be
See `Extraction Descriptors documentation <descriptors/descriptors.rst>`_ for information on how to configure what should be
included in continuous synchronization.

Sub-topics
Expand Down
36 changes: 17 additions & 19 deletions Tests/app/config/injection_test.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 ] ]

0 comments on commit f7ef945

Please sign in to comment.