Skip to content
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

Use default Doctrine config in OrmExtension #241

Open
foxycode opened this issue Mar 7, 2016 · 3 comments
Open

Use default Doctrine config in OrmExtension #241

foxycode opened this issue Mar 7, 2016 · 3 comments
Labels
Milestone

Comments

@foxycode
Copy link
Contributor

foxycode commented Mar 7, 2016

Connection setting is under doctrine / dbal / connections DoctrineBundle: http://symfony.com/doc/current/reference/configuration/doctrine.html

I'd like it same way to not think what is different in Kdyby\Doctrine against default implementation.

I currently using config like this:

doctrine:
    metadata:
        App\Model\Entities: %appDir%/model/Entities
    types:
        convertabledatetime: App\Model\ConvertableDateTimeType
    dql:
        datetime:
            date:           Oro\ORM\Query\AST\Functions\SimpleFunction
            time:           Oro\ORM\Query\AST\Functions\SimpleFunction
            timestamp:      Oro\ORM\Query\AST\Functions\SimpleFunction
            convert_tz:     Oro\ORM\Query\AST\Functions\DateTime\ConvertTz
            timestampdiff:  Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff
            dayofyear:      Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofmonth:     Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofweek:      Oro\ORM\Query\AST\Functions\SimpleFunction
            week:           Oro\ORM\Query\AST\Functions\SimpleFunction
            day:            Oro\ORM\Query\AST\Functions\SimpleFunction
            hour:           Oro\ORM\Query\AST\Functions\SimpleFunction
            minute:         Oro\ORM\Query\AST\Functions\SimpleFunction
            month:          Oro\ORM\Query\AST\Functions\SimpleFunction
            quarter:        Oro\ORM\Query\AST\Functions\SimpleFunction
            second:         Oro\ORM\Query\AST\Functions\SimpleFunction
            year:           Oro\ORM\Query\AST\Functions\SimpleFunction
        numeric:
            sign:           Oro\ORM\Query\AST\Functions\Numeric\Sign
            pow:            Oro\ORM\Query\AST\Functions\Numeric\Pow
        string:
            group_concat:   Oro\ORM\Query\AST\Functions\String\GroupConcat
            concat_ws:      Oro\ORM\Query\AST\Functions\String\ConcatWs
            cast:           Oro\ORM\Query\AST\Functions\Cast
    default:
        driver: pdo_mysql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx
    deals:
        driver: pdo_pgsql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx

I have it splitted to more neon files of course, but still it is weird to have connection names on same level that another config sections. It then creates another problems like this: mrtnzlml-archive/testbench#14

@foxycode foxycode changed the title Use default Doctrine in OrmExtension Use default Doctrine config in OrmExtension Mar 7, 2016
@fprochazka
Copy link
Member

That is not "default implementation", but symfony's custom config structure. I wouldn't wanna break the compatibility just to be compliant with symfony.

Your configuration can be rewritten to this

doctrine:
    default:
        driver: pdo_mysql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx
        metadata:
            App\Model\Entities: %appDir%/model/Entities
    deals:
        driver: pdo_pgsql
        host: localhost
        user: xxx
        password: xxx
        dbname: xxx
        metadata:
            App\Model\Entities: %appDir%/model/Entities
    types:
        convertabledatetime: App\Model\ConvertableDateTimeType
    dql:
        datetime:
            date:           Oro\ORM\Query\AST\Functions\SimpleFunction
            time:           Oro\ORM\Query\AST\Functions\SimpleFunction
            timestamp:      Oro\ORM\Query\AST\Functions\SimpleFunction
            convert_tz:     Oro\ORM\Query\AST\Functions\DateTime\ConvertTz
            timestampdiff:  Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff
            dayofyear:      Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofmonth:     Oro\ORM\Query\AST\Functions\SimpleFunction
            dayofweek:      Oro\ORM\Query\AST\Functions\SimpleFunction
            week:           Oro\ORM\Query\AST\Functions\SimpleFunction
            day:            Oro\ORM\Query\AST\Functions\SimpleFunction
            hour:           Oro\ORM\Query\AST\Functions\SimpleFunction
            minute:         Oro\ORM\Query\AST\Functions\SimpleFunction
            month:          Oro\ORM\Query\AST\Functions\SimpleFunction
            quarter:        Oro\ORM\Query\AST\Functions\SimpleFunction
            second:         Oro\ORM\Query\AST\Functions\SimpleFunction
            year:           Oro\ORM\Query\AST\Functions\SimpleFunction
        numeric:
            sign:           Oro\ORM\Query\AST\Functions\Numeric\Sign
            pow:            Oro\ORM\Query\AST\Functions\Numeric\Pow
        string:
            group_concat:   Oro\ORM\Query\AST\Functions\String\GroupConcat
            concat_ws:      Oro\ORM\Query\AST\Functions\String\ConcatWs
            cast:           Oro\ORM\Query\AST\Functions\Cast

basically everything should be possible to add only to the section of the named configuration (under default or deals).

@fprochazka
Copy link
Member

Let me think about this a bit more, it might not be a bad idea to be compatible, but at this point, before refactoring most of this library out ( #238 ), there would be a lot of unnecesary overhead even if you'd did it - I'd still have to review&test&merge it.

@fprochazka fprochazka added this to the v4.0 milestone Mar 8, 2016
@foxycode
Copy link
Contributor Author

foxycode commented Mar 8, 2016

@fprochazka I wouldn't suggest such BC break if you didn't planned release 4.0 :) Let me know if I can help. If you give me some guidance, we can minimize your review work and my refactoring.

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

No branches or pull requests

2 participants