开发者

Symfony set Field name when schema fields have spaces

开发者 https://www.devze.com 2023-01-24 08:01 出处:网络
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 s

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

精彩评论

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

关注公众号