Reputation: 67
Need to know that how "create_guid
" function work and how it generate IDs
for different modules e.g. Emails
module?
Upvotes: 1
Views: 3515
Reputation: 1590
You may just call it like
$next_meeting->id = create_guid();
for example in logic hook. The function itself placed in /include/utils.php file .
Of course, you have to save newly generated bean with
$next_meeting->save();
Upvotes: 4
Reputation: 3293
You will need to call it in following manner:
$Module_Bean->new_with_id = true;
$Module_Bean->id = create_guid();
Note that if you assigned your own ID using create_guid function then "new_with_id" need to be set as well. You can find function at this path: include\utils.php
Following is the function body:
function create_guid()
{
$microTime = microtime();
list($a_dec, $a_sec) = explode(' ', $microTime);
$dec_hex = dechex($a_dec * 1000000);
$sec_hex = dechex($a_sec);
ensure_length($dec_hex, 5);
ensure_length($sec_hex, 6);
$guid = '';
$guid .= $dec_hex;
$guid .= create_guid_section(3);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= create_guid_section(4);
$guid .= '-';
$guid .= $sec_hex;
$guid .= create_guid_section(6);
return $guid;
}
Upvotes: 3