From the function in question.. I do lookup the sobject first:
PHP Code:
$sql = 'SELECT ' . join( ', ', $fields ) . ' FROM Customer_Variable__c WHERE ';
$sql .= ' Account__c = ?';
$sql .= ' AND settingid__c = ?';
try {
list( $setting ) = $this->__fetchall_sforce_results
( $sql, array( $sf_account->Id, $setting_id ) );
} catch ( Exception $e ) {
throw $e;
return null;
}
So... the object does exist.. but has issues with the update once called.
I'll share the utility functions also:
PHP Code:
function __sforce_escape( $value ) {
$value = str_replace( "'", '\\\'', $value );
if ( ! is_numeric( $value ) ) {
return "'" . $value . "'";
}
return $value;
}
function __fetchall_sforce_results( $raw_query, $params = array(), $limit = 500 ) {
$query = $raw_query;
foreach ( $params as $param ) {
// echo "param : " . $param . "\n";
// echo "eparam: " . $this->__sforce_escape($param) . "\n";
$query = preg_replace( '/\?/', $this->__sforce_escape( $param ), $query, 1 );
// $query = str_replace( '?', $this->__sforce_escape($param), $query );
}
// echo "raw_query: $raw_query\n";
// print_r( $params );
// echo "query : $query\n";
// set the limit to 500 per batch
$queryOptions = new QueryOptions($limit);
try {
$response = $this->sf_client->query(($query), $queryOptions);
} catch ( Exception $e ) {
throw $e;
return null;
}
$tmp = null;
// check count to see if we are done
if ($response->size > 0) {
$tmp = array();
foreach ( $response->records as $r_obj ) {
$tmp[] = new SObject($r_obj);
}
// Cycles through additional responses if the number of records
// exceeds the batch size
while (! $response->done ) {
// set_time_limit(100);
try {
$response = $this->sf_client->queryMore($response->queryLocator);
} catch ( Exception $e ) {
throw $e;
return null;
}
foreach ( $response->records as $r_obj ) {
$tmp[] = new SObject( $r_obj );
}
}
return $tmp;
}
return null;
}