For <linkname>Link() and <linkname>Unlink() methods in my application resource I would like to know the resource that is being linked or unlinked.


You can get a link object (APS\ResourceProxy) as an argument to your link and unlink methods. Suppose I have a resource with a relation to an array of DNS records called arecords. This function will write to log the ID of the DNS record that is being unlinked:

public function arecordsUnlink($record) {
        APS\Logger::get()->debug("Record unlinked: " . print_r($record->aps->id, true));

Result in /var/log/httpd/error_log will look like this:

[2014-07-03 06:04:52.554716 UTC] DEBUG Record unlinked: dbc28c5f-9605-4c0c-b5ef-3e48ba1ff1f0

Internal content