Jump to content

Recommended Posts

I have 6 models connected with HABTM relationships, and on the edit and add pages for each one, I load a list of the other 5. For some reason whenever I try to get a list of "products" it gives me a list of "compounds". There are some glitches with the pagination pages and redirects and stuff and it seems to be the compounds model involved in all these glitches. Changing from $this->model1->Product to ClassRegistry::init('Product') doesn't change anything. Heres one of the HABTM relationships (for the compound model):

	public $hasAndBelongsToMany = array(
		'SubstancesCategory' => array(
			'className' => 'SubstancesCategory',
			'joinTable' => 'substances_cat_rels',
			'foreignKey' => 'compound_id',
			'associationForeignKey' => 'substances_category_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		),
		'Plant' => array(
			'className' => 'Plant',
			'joinTable' => 'substances_inter_rels',
			'foreignKey' => 'compound_id',
			'associationForeignKey' => 'plant_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		),
		'Preparation' => array(
			'className' => 'Preparation',
			'joinTable' => 'substances_inter_rels',
			'foreignKey' => 'compound_id',
			'associationForeignKey' => 'preparation_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		),
		'Product' => array(
			'className' => 'Compound',
			'joinTable' => 'substances_inter_rels',
			'foreignKey' => 'compound_id',
			'associationForeignKey' => 'product_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		),
		'Ailment' => array(
			'className' => 'Ailment',
			'joinTable' => 'substances_inter_rels',
			'foreignKey' => 'compound_id',
			'associationForeignKey' => 'ailment_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
		)
	);

and heres the problem:

084a7a8a7085aeddd1649ec6c3aa5344.png

I'm using the same controller for 5 of these models, and a seperate controller for categories. I can load the products page fine, its just when I try to load a list that it loads a list of compounds instead. is there anything you can recommend I try to diagnose or fix the issue?

Edited by CrimpJiggler
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.