I want to create custom field set for my custom entity.
I have Lead.xml
and there:
< class >Lead< /class >
< name >civicrm_lead< /name >
inside cg_extend_objects I put title:Lead, value:Lead
But I'm not able to create custom field set for Lead now.
I've tried to debug it.
to CRM_Core_BAO_SchemaHandler::createTable
this array is passed:
Array
(
[name] => civicrm_value_cccc1_16
[is_multiple] => 0
[attributes] => ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
[fields] => Array
(
[0] => Array
(
[name] => id
[type] => int unsigned
[primary] => 1
[required] => 1
[attributes] => AUTO_INCREMENT
[comment] => Default MySQL primary key
)
[1] => Array
(
[name] => entity_id
[type] => int unsigned
[required] => 1
[comment] => Table that this extends
[fk_table_name] => Lead
[fk_field_name] => id
[fk_attributes] => ON DELETE CASCADE
)
)
[indexes] => Array
(
[0] => Array
(
[unique] => 1
[field_name_1] => entity_id
)
)
)
and this SQL is generated:
CREATE TABLE civicrm_value_cccc4_18 ( id
int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Default MySQL primary key', entity_id
int unsigned NOT NULL COMMENT 'Table that this extends', PRIMARY KEY ( id ), UNIQUE INDEX unique_entity_id ( entity_id ), CONSTRAINT FK_civicrm_value_cccc4_18_entity_id FOREIGN KEY ( entity_id
) REFERENCES Lead ( id ) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
It doesn't take table for Lead entity. Is there any extra coding needed for this?