Doctrine2, annotation driver. This seems to happen with composite keys.
A sample entity:
Generated PHP code:
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="tags_to_tickets")
*/
class TagsToTickets
{
/**
* @ORM\Id
* @ORM\Column(type="integer", options={"unsigned":true})
*/
private $user_id;
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Model\Entity\Ticket\Ticket", inversedBy="tagsToTickets")
* @ORM\JoinColumn(name="ticket_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
private $ticket;
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Model\Entity\Ticket\TicketTag", inversedBy="tagsToTickets")
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id", nullable=false, onDelete="RESTRICT")
*/
private $ticketTags;
}
Now, if a table is created by doctrine orm:schema-tool:create
based on such a file, the invalid order is reflected in the table definition:
I know (as stated in https://support.skipper18.com/2858/answered-configure-doctrine2-script-export-default-values?show=3843#c3843), that Skipper is not a PHP code generator but since it provides this particular feature, it should respect the declaration order of all fields (as far as no technical reason disallows it).