/** * Get All Contacts for the given node that match the given role * * @param tx_caretaker_AbstractNode $node * @param tx_caretaker_ContactRole $role * @return array */ public function getContactsByNodeAndRole(tx_caretaker_AbstractNode $node, tx_caretaker_ContactRole $role) { $contacts = array(); // only Instancegroups and Instances store Contacts $nodeType = $node->getType(); if ($nodeType != tx_caretaker_Constants::nodeType_Instance && $nodeType != tx_caretaker_Constants::nodeType_Instancegroup) { return $contacts; } $storageTable = $node->getStorageTable(); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', tx_caretaker_Constants::relationTable_Node2Address, 'uid_node=' . $node->getUid() . ' AND node_table=\'' . $storageTable . '\'' . ' AND role=' . $role->getUid()); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($contact = $this->dbrow2contact($row)) { $contacts[] = $contact; } } return $contacts; }