public function initialize() { $this->hasMany('id', RobotsParts::class, 'parts_id', ['foreignKey' => ['message' => 'Parts cannot be deleted because is referenced by a Robot']]); }