protected function objectToString($object)
    {
        $r = new \ReflectionClass(get_class($object));

        if ($r->hasMethod('__toString')) {
            return (string)$object;
        }

        foreach (['getName', 'getTitle'] as $getter) {
            if ($r->hasMethod($getter)) {
                try {
                    return $object->{$getter}();
                } catch (\Exception $e) {
                }
            }
        }

        return '';
    }