// If a return param has been set then fetch the appropriate fk objects
// This is a helper because api chaining does not work with a key like 'email_2'
if (!empty($options['return'])) {
+ unset($params['return']);
$values = array();
$items = array('address', 'email', 'phone', 'im');
$returnAll = !empty($options['return']['all']);
*/
function loc_block_create_example(){
-$params = array(
+$params = array(
'version' => 3,
'address_id' => 2,
'phone_id' => 2,
*/
function loc_block_create_expectedresult(){
- $expectedResult = array(
+ $expectedResult = array(
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 2,
- 'values' => array(
- '2' => array(
+ 'values' => array(
+ '2' => array(
'id' => '2',
'address_id' => '2',
'email_id' => '3',
Create entities and location block in 1 api call
*/
function loc_block_createentities_example(){
-$params = array(
+$params = array(
'version' => 3,
- 'email' => array(
+ 'email' => array(
'location_type_id' => 1,
'email' => 'test2@loc.block',
),
- 'phone' => array(
+ 'phone' => array(
'location_type_id' => 1,
'phone' => '987654321',
),
- 'phone_2' => array(
+ 'phone_2' => array(
'location_type_id' => 1,
'phone' => '456-7890',
),
- 'address' => array(
+ 'address' => array(
'location_type_id' => 1,
'street_address' => '987654321',
),
*/
function loc_block_createentities_expectedresult(){
- $expectedResult = array(
+ $expectedResult = array(
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 3,
- 'values' => array(
- '3' => array(
- 'address' => array(
+ 'values' => array(
+ '3' => array(
+ 'address' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'street_address' => '987654321',
'manual_geo_code' => 0,
),
- 'email' => array(
+ 'email' => array(
'id' => '4',
'contact_id' => 'null',
'location_type_id' => '1',
'signature_text' => '',
'signature_html' => '',
),
- 'phone' => array(
+ 'phone' => array(
'id' => '3',
'contact_id' => 'null',
'location_type_id' => '1',
'phone_numeric' => '',
'phone_type_id' => '',
),
- 'phone_2' => array(
+ 'phone_2' => array(
'id' => '4',
'contact_id' => 'null',
'location_type_id' => '1',
Get entities and location block in 1 api call
*/
function loc_block_get_example(){
-$params = array(
+$params = array(
'version' => 3,
'id' => 3,
'return' => 'all',
*/
function loc_block_get_expectedresult(){
- $expectedResult = array(
+ $expectedResult = array(
'id' => '3',
'address_id' => '3',
'email_id' => '4',
'phone_id' => '3',
'phone_2_id' => '4',
- 'address' => array(
+ 'address' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'street_address' => '987654321',
'manual_geo_code' => 0,
),
- 'email' => array(
+ 'email' => array(
'id' => '4',
'location_type_id' => '1',
'email' => 'test2@loc.block',
'on_hold' => 0,
'is_bulkmail' => 0,
),
- 'phone' => array(
+ 'phone' => array(
'id' => '3',
'location_type_id' => '1',
'is_primary' => 0,
'phone' => '987654321',
'phone_numeric' => '987654321',
),
- 'phone_2' => array(
+ 'phone_2' => array(
'id' => '4',
'location_type_id' => '1',
'is_primary' => 0,
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
// Now check our results using the return param 'all'
- $getParams = array('version' => $this->_apiversion, 'id' => $id, 'return' => 'all');
+ $getParams = array(
+ 'version' => $this->_apiversion,
+ 'id' => $id,
+ 'return' => 'all'
+ );
$result = civicrm_api($this->_entity, 'getsingle', $getParams);
$this->documentMe($getParams, $result, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', NULL, 'get');
$this->assertNotNull($result['email_id'], 'In line ' . __LINE__);