Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Doctrine ORM "sharded" repository. #24

Open
dantleech opened this issue Jun 3, 2016 · 6 comments
Open

Doctrine ORM "sharded" repository. #24

dantleech opened this issue Jun 3, 2016 · 6 comments

Comments

@dantleech
Copy link
Member

dantleech commented Jun 3, 2016

We could support the Doctrine ORM by using "sharding" based on table fields to provide a hierarchy.

By providing a list of SQL field specifications we should be able to emulate a
hierarchy.

cmf_repository:
    repositories:
        invoices_by_date:
            # e.g. /2016/06/SYMCMF-01
            type: doctrine_orm_sharded
            class: AppBundle\Entity\Invoice
            name: {{ clientRef }}-{{ invoiceNo }} # property access

            # in SQL
            shards:
                - "DATE(date)"
                - "MONTH(date)"
        invoices_by_client:
            # e.g. /SYMCMF/00001
            type: doctrine_orm_sharded
            class: AppBundle\Entity\Invoice
            name: {{ invoiceNo }}

            # in SQL
            shards:
                - "clientRef"

        default:
            # mount in a composite e.g.
            #
            #   articles/
            #      ...
            #   invoices/
            #     date/
            #       2016/
            #         06/
            #           SYMCMF-0001
            #     client/
            #       SYMCMF/
            #         0001
            #  
            ty: composite
            mount:
                - 
                    repository: invoices_by_date
                    mountpoint: "/invoices/bydate"
                -
                    repository: invoices_by_client
                    mountpoint: "/invoices/byclient"
                -
                    repository: articles # f.e.
                    mountpoint: "/articles"
@dantleech
Copy link
Member Author

/cc @symfony-cmf/core

@dbu
Copy link
Member

dbu commented Jun 4, 2016

there are also doctrine extensions to make manifest trees on doctrine orm. not sure how much those could be useful instead.

i have nothing against doing these things, but don't see them as a priority for the cmf.

@dantleech
Copy link
Member Author

dantleech commented Jun 4, 2016

@dbu this isn't about making a tree (i.e. nested set, materialized path) in Doctrine ORM, its about taking an existing Entity and representing it as a resource, using fields as path elements, creating a virtual hierarchy. (though is that what you meant by manfest tree?)

@dbu
Copy link
Member

dbu commented Jun 4, 2016 via email

@wouterj
Copy link
Member

wouterj commented Jun 4, 2016

👍 Except that I would replace property access + sql with Symfony ExpressionLanguage instead:

name: 'model.clientRef ~ '-' ~ model.invoiceNo'
shards: ['year(date)', 'month(date)']

@dantleech
Copy link
Member Author

property access + sql with Symfony ExpressionLanguage instead:

Also replace the SQL? Was thinking this would be just DBAL SQL. If we replaced SQL with expression language it would be lots of work I would think.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants