I created a Feature that contains two fieldmaps. When I upload my exported Feature to my site, I get the following error:

Fatal error: Class 'salesforce_api' not found in /live-docs/includes/common.inc on line 3596

Looking at the code in my exported feature, I see:

In myfeature.info:

features[ctools][] = "salesforce_api::"

and in myfeature.features.inc:

/**
 * Implementation of hook_ctools_plugin_api().
 */
function myfeature_ctools_plugin_api() {
  list($module, $api) = func_get_args();
  if ($module == "salesforce_api" && $api == "") {
    return array("version" => );
  }
  elseif ($module == "strongarm" && $api == "strongarm") {
    return array("version" => 1);
  }
}

Seems like the implementation of hook_ctools_plugin_api() is not right in the Salesforce API module. I'll take a look and see if I can get a patch together.

Comments

kostajh’s picture

Changing:

features[ctools][] = "salesforce_api::" to features[ctools][] = "salesforce_api:salesforce_api:1"

and

if ($module == "salesforce_api" && $api == "") {
    return array("version" => );
  }

to

if ($module == "salesforce_api" && $api == "salesforce_api") {
    return array("version" => 1);
  }

fixes the problem and the Feature works fine.

But the problem is getting this to export correctly when generating the Feature. I can't figure out how to correct this. Aaron, do you have any ideas?

aaronbauman’s picture

I have looked at Features examples, begged for help, and beat my head against the wall.
The result is the code that's in dev now.

kostajh’s picture

The documentation is a bit sparse isn't it!

Ok, I'll let you all know if I figure it out.

rmontero’s picture

Subscribing

EvanDonovan’s picture

Issue tags: +7.x-2.x, +D7 bug

Tracking for 7.x-2.x.

tayzlor’s picture

Attaching a patch that should cover the features export bug explained above.

The patch also fixes another problem, whereby reverting the feature from the features admin page does not actually revert the Salesforce fieldmap back to its original state in the database.

This patch should allow successful creation of fieldmaps via features UI, as well as the possibility to revert to default if they are overrridden.

Patch is against the 6.x-2.x branch.

kostajh’s picture

Status: Active » Needs review
kostajh’s picture

Status: Needs review » Patch (to be ported)

This is committed to 6.x-2.x-dev. Thanks @tayzlor! http://drupalcode.org/project/salesforce.git/commit/29426c7

EvanDonovan’s picture

Awesome, thanks! Will try to commit shortly.

EvanDonovan’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Forgot to bump version. Haven't committed yet since I haven't been using this module with Features export, but will try to do so soon. Probably will have to re-roll to get it to apply.

EvanDonovan’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new2.02 KB

Here's a re-rolled version of the patch for 7.x. I haven't committed it yet, since it appears that you can still delete the fieldmap from the fieldmap configuration, and then it no longer shows up, even if you disable and reenable the feature. Is that true in 6.x as well?

EvanDonovan’s picture

Status: Needs review » Needs work

From what I recall, the last time that I tested my re-rolled patch for 7.x, it didn't actually make the fieldmap show up when the feature was enabled, so something must be wrong with the patch.

Does anyone have time to look into this further?

tinefin’s picture

Status: Needs work » Needs review
StatusFileSize
new3.3 KB

I have looked over the patch in #11 made a few minor corrections and rerolled it against the 7.x-2.x git branch.

It works on our current site for exporting and reverting features / fieldmaps.

tinefin’s picture

Status: Needs review » Needs work

Nb: Features seem to not detect sf_entity as a dependency automatically when exporting fieldmaps.

Will have a look at it, but shouldn't affect the general functionality.

tinefin’s picture

Status: Needs work » Needs review
nicksanta’s picture

Rerolled to fix an error when features are rebuilt:

in_array() expects parameter 2 to be array, null given common.inc:6967

One line change on line 55 of the patch from #13:

+      $primary_key = isset($existing) ? 'name' : NULL;

to

+      $primary_key = isset($existing) ? 'name' : array();
kostajh’s picture

Component: salesforce_api » Code
Status: Needs review » Closed (won't fix)

Marking this as closed. Thanks to those who contributed. See #2124817: 7.x-2.x and 6.x-2.x branches are no longer supported for more info.

nicksanta’s picture

Any 7.x-2.x users who are still experiencing issues with reverting salesforce_fieldmap components might want to take a look here: #2129603: salesforce_fieldmap features components don't revert correctly in some circumstances