Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Model's field type issue

Hey guys!

I have a table:

CREATE TABLE `office_stats` (
...
`source` TINYINT(1) UNSIGNED NULL DEFAULT NULL
...
)

in php:

$leadRef = new OfficeStats();
...
$leadRef->source = 3;
$leadRef->save();

And catch: Exception: Parameter 'source' must be a string

Why?

Clear metadata maybe?

edited 28d ago
    class OfficeStats extends Model {

        public function getSource() {
            return 'office_stats';
        }

    }

Or where?



7.0k
Accepted
answer
edited 28d ago

Renamed source to xsource, and error has lost. Maybe source is a reserved word in Phalcon Models, because it is not exactly reserved in mysql.

Oh yea sure it's very possible it's reserved word. As i remember you can't havy any property named which has get/set in Model which getSource is a case obviously.