public function toString()
    {
        $ldif = $this->addCommentsToString('');
        if (!is_null($this->version)) {
            $ldif .= $this->getLdifLine(self::DIRECTIVE_VERSION, $this->version);
        }
        foreach ($this->entries as $entry) {
            $this->setupEntry($entry);
            $ldif .= $this->lineEnding.$entry->toString();
        }

        return $ldif;
    }