acelaya / doctrine-enum-type

A custom Doctrine type that maps column values to enum objects using myclabs/php-enum
MIT License
132 stars 15 forks source link

Removed column comment from type SQL declaration. #3

Closed maxbrokman closed 8 years ago

maxbrokman commented 8 years ago

Some platforms supported by doctrine don't support comments (e.g sqlite, which I'm trying to use for integration tests). Looking into the primary doctrine column definitions it doesn't seem like doctrine uses comments anywhere.

Seeing as the comment doesn't seem to have any programmtic use I've removed it.

acelaya commented 8 years ago

Looks good. Let me check it this afternoon and I'll merge it :-)

maxbrokman commented 8 years ago

Great, thanks buddy!

acelaya commented 8 years ago

I've just tagged version 1.0.2. Thank you for your contribution!

maxbrokman commented 8 years ago

You're welcome! Thanks for accepting!

mjpvandenberg commented 7 years ago

Doctrine will keep complaining about a database out-of-sync with the mapping files until we add SQL comments. Please add this to PhpEnumType.php:

    /**
     * @param AbstractPlatform $platform
     * @return boolean
     */
    public function requiresSQLCommentHint(AbstractPlatform $platform)
    {
        return true;
    }
acelaya commented 7 years ago

I'm not sure if it is a good idea to merge this specific use cases.

I probably shouldn't have merge this one in the first place, without testing it with all supported database systems. However, it looked pretty logic.

So, from now on, I'm going to promote extending the base PhpEnumType class instead, in order to provide custom behavior.

In your case, just do this:

class MyPhpEnumType extends PhpEnumType
{
    /**
     * @param AbstractPlatform $platform
     * @return boolean
     */
    public function requiresSQLCommentHint(AbstractPlatform $platform)
    {
        return true;
    }
}

And remember to register enums with your own enum type.