开发者

Symfony set Field name when schema fields have spaces

We have a Excel spreadsheet with data to import into MySQL from a client. Some of the column names have spaces in them, so w开发者_运维技巧hen we build the schema with the data-dump function it adds spaces into the field names; thus the BaseModels have it too.

'Client Field': { type: string, peerName: client_field }

Wondering if there is an attribute to add to the field in the schema to add spaces to the field names? For example there is peerName and phpName: is there an attribute to remove the spaces from fields?


Not 100% sure what you mean (and having spaces in the field name is a bad design), but this might be what you want:

class YourModel extends BaseYourModel
{
    public function setClientField($value)
    {
        return parent::_set('Client Field', $value);
    }
    public function getClientField()
    {
        return parent::_get('Client Field');
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜