Pimcore\Model\Tool\Email\Log\Dao::prepareLoggingData PHP Method

prepareLoggingData() protected method

Creates the basic logging for the treeGrid in the backend Data will be enhanced with live-data in the backend
protected prepareLoggingData ( $key, $value ) : stdClass
$key
$value
return stdClass
    protected function prepareLoggingData($key, $value)
    {
        $class = new \stdClass();
        $class->key = $key . ' ';
        //dirty hack - key has to be a string otherwise the treeGrid won't work
        if (is_string($value) || is_int($value) || is_null($value)) {
            $class->data = ['type' => 'simple', 'value' => $value];
        } elseif ($value instanceof \DateTimeInterface) {
            $class->data = ['type' => 'simple', 'value' => $value->format("Y-m-d H:i")];
        } elseif (is_object($value) && method_exists($value, 'getId')) {
            $class->data = ['type' => 'object', 'objectId' => $value->getId(), 'objectClass' => get_class($value)];
        } elseif (is_array($value)) {
            foreach ($value as $entryKey => $entryValue) {
                $class->children[] = self::prepareLoggingData($entryKey, $entryValue);
            }
        }
        return $class;
    }