Reputation: 30906
Should I specify the object id in the 'object' key when adding activities. How is this key used by stream exactly, is uniqueness required in this field? For me it's not so important since with the foreign_id I can get back all the information from the actor verb, object, target etc.. during the enrichment process.
If I only specify "$objectType" instead of "$objectType:$objectId" could this cause problems?
$data = [
'actor' => '1',
'verb' => "$verb",
// This
'object' => "$objectType",
// Or This
'object' => "$objectType:$objectId",
'target' => "$targetObjectType:$targetObjectId",
'time' => "$time",
'foreign_id' => "$foreignId",
// Custom field
'object_type' => $objectType
];
Upvotes: 1
Views: 108
Reputation: 3155
Object doesn't have to be unique. Foreign id should be unique though. (as it's used for determining uniqueness and we allow you to delete activities by foreign id)
I would recommend using objectType:objectId as this will make it easier for you to enrich the data (query any missing information from your DB) if that's necessary.
Upvotes: 2