Column name containing parentheses causes errors
I have a column named: billtime(rounded) which is legal in MySQL. How can this be represented in the Phalcon model?
/**
*
* @var string
*/
public $billtime(rounded);
Leaving it as is, causes errors to be thrown.
php does not support brackets in variable names. http://php.net/manual/en/language.variables.basics.php
You could try independent column mapping: https://docs.phalconphp.com/en/latest/reference/models.html#independent-column-mapping
public $billtime_rounded;
public $etc;
public function columnMap()
{
return array(
'billtime(rounded)' => 'billtime_rounded',
'etc' => 'etc',
);
}
Right @Green-Cat, PHP does not support it, which is why it is a bug that the dev tools create it that way, and the reason for my inquiry as to how the Phalcon team expects people to handle it. Thank you for your work around @VCJeroen! Presumably you have to define every column in the model though. In this particular case, this table has 30+ columns. Not impossible to do, but a pain to specify each of them individually.
@SoccerField24x7 please follow the advice of @VCJeroen
Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues