I have read same disussions of these topic here in forum, but I have still some problems. I tried to do this example from doc https://docs.phalcon.io/en/latest/reference/models.html#storing-related-records But I get a error that artist_id can not be null I have defined the relations:
class Artists {
public $id;
public $name;
...
$this->hasMany('id', 'Albums', 'artist');
and
class Albums {
public $id;
public $name;
public $artist_id;
...
$this->belongsTo('artists_id', 'Artists', 'id');