Article ID: 122238, created on Jul 3, 2014, last review on Jul 3, 2014

  • Applies to:
  • APS 2.x

Problem

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

Solution

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

70bf700e0cdb9d7211df2595ef7276ab 717db81efe94e616312b74fb03a5d474

Email subscription for changes to this article
Save as PDF