I'm trying to get the 'cake bake' console command to generate 2 Models with a belongsTo/hasOne relationship (from the database schema) and it keeps generating a belongsTo/hasMany two-way relationship.
I am following the this guide on these definitions for the column name conventions ('user_id' in Profile, 'profile_id' in User) but, like I said, 'cake bake' keeps getting it wrong. Is 'cake bake' capable of determining the difference between hasOne and hasMany? Does anyone have a simple MySQL schema example where this is working? I'm using CakePHP 1.3.6
hasOne and hasMany relationships are identical from an SQL schema perspective, the difference is simply that there's an artificial restriction on the number of related records (1). bake
can't tell the difference. If you're using the interactive process, it should suggest the more common hasMany relationship first, and the hasOne alternative second.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With