We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

scaffolding a table with hyphenated column names

I am trying to scaffold a table that has hyphenated column names. eg. staff-id staff-name etc

I get this error:

C:\Apache24\htdocs\firsttut>phalcon scaffold --table-name staff

Phalcon DevTools (3.0.4)

PHP Parse error:  syntax error, unexpected '-', expecting ',' or ';' in C:\Apach
e24\htdocs\firsttut\app\models\Staff.php on line 13

Parse error: syntax error, unexpected '-', expecting ',' or ';' in C:\Apache24\h
tdocs\firsttut\app\models\Staff.php on line 13

Any advice on how to work around this. Nearly every table and most columns are named this way. Changing names is not really a possibillity for me.



1.9k

How Stuff.php model look like?



1.3k
edited Jan '17

I am guessing you meant the Staff.php

it is a pretty long file.. here is the start and I have marked line 13 as per the error message.

<?php

class Staff extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     * @Primary
     * @Identity
     * @Column(type="integer", length=11, nullable=false)
     */
    protected $staff-id;   /*    line 13     */

    /**
     *
     * @var string
     * @Column(type="string", nullable=false)
     */
    protected $staff-name;

    /**
     *
     * @var string
     * @Column(type="string", nullable=false)
     */
    protected $staff-last-name;