I'm not sure what's happening here, but it seems like flourish looks for the class name without taking pluralisation into account if it's given an array with only one member. For instance, if i do $groups->associateGroupFields($fields) but $fields is an array with a count of 1, it will cause a fatal "class GroupFields not found" error, however if the array count is > 1, it recognises the pluralisation correctly and calls the GroupField class.
for example, check out this trace:
Fatal error: Class 'GroupFields' not found in /application/libraries/flourish/fORMRelated.php on line 107
Call Stack
# Time Memory Function Location
1 0.0007 84544 {main}( ) ../index.php:0
2 0.0016 94380 require( '/application/bootstrap.php' ) ../index.php:49
3 0.1916 8140364 Router::run( ) ../bootstrap.php:86
4 0.1917 8140660 Router::matchURLToRoute( ) ../Router.php:175
5 0.1924 8143624 Router::dispatch( ) ../Router.php:142
6 0.3036 8292800 SurveyController->processEditSurvey( ) ../Router.php:104
7 0.3449 8463332 SurveyGroup->associateGroupFields( ) ../SurveyController.php:192
8 0.3449 8463712 fActiveRecord->__call( ) ../fActiveRecord.php:0
9 0.3454 8466104 fORMRelated::associateRecord( ) ../fActiveRecord.php:811
and here's the creates for the tables...
CREATE TABLE IF NOT EXISTS `surveys` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`creator` bigint(20) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`date_created` timestamp NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `creator` (`creator`),
KEY `theme` (`theme`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='surveys' AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `survey_groups` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`survey_id` bigint(20) unsigned DEFAULT NULL,
`display_order` int(10) unsigned DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
`type` varchar(150) NOT NULL DEFAULT '',
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`date_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `display_order` (`survey_id`,`display_order`),
KEY `survey_id` (`survey_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='survey groups' AUTO_INCREMENT=7 ;
ALTER TABLE `survey_groups`
ADD CONSTRAINT `survey_groups_ibfk_1` FOREIGN KEY (`survey_id`) REFERENCES `surveys` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `survey_group_fields` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`group_id` bigint(20) unsigned DEFAULT NULL,
`display_order` int(10) unsigned DEFAULT NULL,
`type` varchar(150) NOT NULL,
`label` varchar(255) DEFAULT NULL,
`default_value` varchar(250) DEFAULT NULL,
`selected` tinyint(1) DEFAULT '0',
`max_length` int(3) unsigned DEFAULT NULL,
`validation_regexp` varchar(255) DEFAULT NULL,
`required` tinyint(1) DEFAULT '0',
`date_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`date_created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `display order` (`group_id`,`display_order`),
KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='survey group fields' AUTO_INCREMENT=1 ;
ALTER TABLE `survey_group_fields`
ADD CONSTRAINT `survey_group_fields_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `survey_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
For reference, this is from code gleened from this previous thread re: deep relations.
Any ideas here? It's got me stuck pretty bad.