How to add an index on Doctrine 2 using YAML

I know this post is kind of small but this is something not so easy to find on google. The easiest way to add an index to a column on a YAML mapping is using the @indexes contraint.

 

Entity\Post:
    type: entity
    table: posts
    indexes:
        # index name
        title_slug_idx:
            # one or multiple columns separated by comma
            columns: [ slug ]
    id:
        id:
            type: integer
            generator: { strategy: AUTO }

    fields:
        name:
            type: string
        slug:
            type: string

One thought on “How to add an index on Doctrine 2 using YAML

  1. Present to view taste while choosing accessories for your operate|service|duty|customary duty|office} dresses. Your jewels should not be distracting. For prompting, ankle bracelets, long tawdry earrings and execrable colors like hot pink should be avoided. Wakefulness, post earrings and {handsome|fine|classical|tasteful|in good taste|elegant} margarite necklaces are stupendous|ample|immense|herculean|cyclopean|great} ideas as accessories.

Leave a Reply

Your email address will not be published. Required fields are marked *