This weekend I ran into a problem which took me way too long to fix. I was missing a mapped column in my database. Unfortunately Doctrine didn’t want to update my schema according to the entities, even though all the annotations were present. After using the Google search without success I was about to check-in on IRC when I noticed the problem.

I was 100% sure that I used all the annotations that are necessary. I even compared my entities, checked if I was using a reserved keyword by any chance and even tried switching the type of column. What I did not kept in mind, was the proper syntax of a comment! When I added a php annotation (@var), my editor didn’t properly highlight the annotation. Why would that be? Because I was missing one * at the beginning of the block comment! Just to illustrate:

    <?php

    /*
     * This was my old block comment with
     * @ORM\Column(...)
     */

This would be the proper way to write the comment and with that Doctrine recognize my column properly:

    <?php
    /**
     * This is the correct way.
     * @ORM\Column(...)
     */

It’s the always the small things, isn’t it?