Skip to content

Commit

Permalink
Ldap/Query: re-add __toString
Browse files Browse the repository at this point in the history
We stopped using __toString as it is unable to handle exceptions - and
this makes sense. However, that's IMO not a good reason to completely
drop __toString. Especially when debugging, benchmarking and similar you
often need a quick way to "dump" an object.

In that case you are often not in a mood to figure out whether that
specific class prefers create(), dump(), render() or whatever. We should
not base our view scripts on __toString - at least unless we do not catch
Exceptions in __toString methods, eventually "forwarding" them as triggered
error where needed.
  • Loading branch information
Thomas-Gelf committed Mar 13, 2015
1 parent 697d4af commit 316d926
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/Icinga/Protocol/Ldap/Query.php
Expand Up @@ -348,6 +348,11 @@ public function create()
}
}

public function __toString()
{
return $this->create();
}

/**
* Descructor
*/
Expand Down

0 comments on commit 316d926

Please sign in to comment.