/**
* Get subscription records from the database
*
* Records are an object with two vars: guid and methods with the latter
* being a comma-separated list of subscription relationship names.
*
* @param int $container_guid The GUID of the subscription target
* @return array
*/
protected function getSubscriptionRecords($container_guid)
{
$container_guid = $this->db->sanitizeInt($container_guid);
// create IN clause
$rels = $this->getMethodRelationships();
if (!$rels) {
return array();
}
array_walk($rels, array($this->db, 'sanitizeString'));
$methods_string = "'" . implode("','", $rels) . "'";
$db_prefix = $this->db->prefix;
$query = "SELECT guid_one AS guid, GROUP_CONCAT(relationship SEPARATOR ',') AS methods\n\t\t\tFROM {$db_prefix}entity_relationships\n\t\t\tWHERE guid_two = {$container_guid} AND\n\t\t\t\t\trelationship IN ({$methods_string}) GROUP BY guid_one";
return $this->db->getData($query);
}