Hello,
Im using Phalcon3, Im getting the error "Not implemented" when saving a model. I already have data in my model, and then added a toMany relationship. I tried to update the model and then I got this error. It seems that the relationship it's well done since I can retrieve data from it, but since I added it I cannot update any reference to the model. Here are the classes: This class is the one giving the error on save:
class Team extends Model
{
public $id;
public $name;
public $url;
public $id_sport;
public $id_ext;
private $types = ["id" => "int", "name" =>"string", "url" => "string", "id_sport" => "int", "id_ext" => "int"];
/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSource('team');
$this->belongsTo('id_sport', 'Sport', 'id', NULL);
$this->hasMany(
['id'],
TeamToGroups::class,
['id_team'],
[
'reusable' => true, // cache related data
'alias' => 'teamToGroups',
]
);
$this->hasOne(
['id_sport'],
Sport::class,
['id'],
[
'reusable' => true, // cache related data
'alias' => 'sport',
]
);
}
}
This is the class is related to:
class TeamToGroups extends Model
{
public $id;
public $id_team;
public $id_groups;
/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSource('teamToGroups');
$this->belongsTo('id_team', 'Team', 'id', NULL);
$this->belongsTo('id_groups', 'Groups', 'id', NULL);
$this->hasOne(
['id_groups'],
Groups::class,
['id'],
[
'reusable' => true, // cache related data
'alias' => 'groups',
]
);
}
And finally the third class:
use Phalcon\Mvc\Model;
class Groups extends Model
{
public $id;
public $id_phase;
public $district;
public $id_category;
public $id_sport;
public $sex;
public $id_ext;
public $name_ext;
private $types = ["id" => "int", "id_phase" =>"int", "district" => "string", "id_category" => "int", "id_sport" => "int", "sex" => "string", "id_ext" => "int"];
/**
* Initialize method for model.
*/
public function initialize()
{
$this->setSource('groups');
$this->belongsTo('id_phase', 'Phase', 'id', NULL);
$this->belongsTo('id_category', 'Category', 'id', NULL);
$this->belongsTo('id_sport', 'Sport', 'id', NULL);
$this->hasMany(
['id'],
TeamToGroups::class,
['id_groups'],
[
'reusable' => true, // cache related data
'alias' => 'teamToGroups',
]
);
}
I've seen other post on it but they dont seem to fix it, also it seems its a bug related to phalcon2
Thanks.