Create rule forward chaining AI

I want to create rule to diagnose diseases used Forward Chaining AI.
current I have create table Signs and Solutions

+--ID--+-----Gejala------+
|   1  |     Demam       |
|   2  |   Bulu rontok   |
|   3  |   Mata memerah  |
|   4  |  Kutu pada bulu |
|   5  |  Kulit memerah  |
+------+-----------------+

+------+---------------------------+
|  ID  |       Solusi              |
+------+---------------------------+
|   1  |   Berikan obat demam      |
|   2  |   Bersihkan kandang       |
|   3  |   Berikan vitamin         |
|   4  |   Berikan obat tetes mata |
+------+---------------------------+

next I create table Rules to tracking diseases use Forward Chaining AI

+-----+---------------+-------------+-------------+-------------+------------------+
|  ID |  Parent       | Question    | Answer Yes  | Answer No   | Solution         |
|     |  (FK sign_id) | (FK sign_id)| (FK sign_id)| (FK sign_id)| (FK solution_id) |
+-----+---------------+-------------+-------------+-------------+------------------+
|  1  |      null     |      1      |      2      |      1      |      1           |
|  2  |       1       |      2      |      3      |      3      |      3           |
|  3  |       2       |      3      |      4      |      2      |      2           |
|  4  |       3       |      4      |      5      |      4      |      4           |
+-----+---------------+-------------+-------------+-------------+------------------|

FK = Foreign Key
How the way or method to saving record to tables rules I’m used mass assignment
based on tutorial https://stackoverflow.com/questions/41915954/cakephp-3-saving-self-referencing-belongstomany
that’s failed to save.

I hope someone can help me, thanx