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
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Clip to Evernote

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.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>