-
Trying to use phalcon model relationships to save related models but get an error: "Value of field "db_file_id" does not exist on referenced table". Saving and processing services: Base classes for models: Models: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Well.. little difficult... i cant understand whole picture, but... i see that "belongs to" in Image model: $this->belongsTo(
'db_file_id',
DbFile::class,
'id',
[
'alias' => 'dbFile',
'foreignKey' => true,
'reusable' => true
]
); and in ImageService.php (see upload function)... is not set. You have "setDbFile" function in image.php, but the db_file_id is not set there and is missing. |
Beta Was this translation helpful? Give feedback.
-
I found where was a problem. In relationships declarations I specified column names instead of property names like $this->belongsTo('db_file_id... instead of $this->belongsTo('dbFileId... . After I changed it to property names, all works. |
Beta Was this translation helpful? Give feedback.
I found where was a problem. In relationships declarations I specified column names instead of property names like $this->belongsTo('db_file_id... instead of $this->belongsTo('dbFileId... . After I changed it to property names, all works.