SOLVED: foreign_key where clause causing 'unable to locate the file' error

edited June 2013 in Bug Reports
In my model, I want to set up a Foreign Key relationship, and limit the records from the related table based on a field in that table.

When I place the "where" condition clause in my foreign_keys declaration, the 'create' action returns the error:
'Unable to locate the file: baked.php'.

Without the where clause the foreign key relationship works as expected ... it returns all the records in the table from the 'product_categories_model'. I want to limit that result set to those relevant to my current model.

My Models:
class Baked_goods_model extends Base_module_model { public $foreign_keys = array('category_id' => array('app' => 'product_categories_model'), 'where' => array('relevant' => 'Baked')); ...

and
class Product_categories_model extends Base_module_model { public $record_class = 'Product_category'; public $required = array('name','relevant','order'); ....

associated SQL files:
CREATE TABLE `w_product_categories` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `relevant` enum('Baked','Brew') NOT NULL DEFAULT 'Baked' COMMENT 'Which area is this category relvant to?', `order` int(2) NOT NULL COMMENT 'Sort Order within relevant category', PRIMARY KEY (`id`), UNIQUE KEY `sort_order` (`relevant`,`order`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE `w_baked_goods` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `description` varchar(5000) NOT NULL, `image` varchar(255) NULL DEFAULT NULL, `cat_id` int(11) NOT NULL, `featured` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;


Using FUEL 1.0; last merge from github is SHA 9dff5bd

Comments

  • edited 5:13AM
    Please ignore, discovered a syntax error in my foreign key declaration;

    (no way to delete a post?)
Sign In or Register to comment.