CakePHP is not associated well.

Asked 2 years ago, Updated 2 years ago, 84 views

CakePHP's association model doesn't work

I designed a DB similar to the image, but I wrote the code for the association of the Model as follows, but I cannot access the stoc_wish and ctos_wish models from the Student model.

Please tell me how to solve it

//student.php
class Student extensions AppModel {
    public$belongsTo=array('Team');
    public$hasMany=array('Stoc_wish', 'Ctos_wish');

}

// stoc_wish.php
classStoc_wish extensions AppModel {
    public$belongsTo=array('Student','Cuser');
}

// ctos_wish.php
class Ctos_wish extensions AppModel {
    public$belongsTo=array('Student','Cuser');
}

By the way, I use CakePHP2.6src=

php cakephp

2022-09-30 21:11

1 Answers

Resolved

Invalid naming convention

The correct answer was StocWish, CtosWish


2022-09-30 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.