Recently converted App to Plugin, Trouble with Associations

This morning I decided to convert my app to a plugin, however, I am having trouble with my Table Associations now…

Is there some dot notation or something like that I am missing when creating the belongsTo and hasMany table associations?

I am putting a die(‘1’); statement in the

 public function initialize(array $config)

of the associated tables, but it is not firing…

Make sure you have used plugin prefix when setting up associations. E.g. If you have model Posts and Comments in your Blog plugin then in your Posts::initialize() you need to use $this->hasMany('Blog.Comments').

1 Like