/**
  * Gibt den Text mit den ersetzten Links zurück
  * @return string
  */
 public function getText()
 {
     $this->text = html_entity_decode($this->text);
     $matches = [];
     // Suchen nach allem, dass in [[ ]] eingeschlossen ist
     preg_match_all('/\\[\\[([\\w\\.\\säöüÄÖÜß]+)\\]\\]/', $this->text, $matches);
     Logging::debug(print_r($matches, true));
     foreach ($matches[1] as $match) {
         $artikel = CmsArtikel::loadByBezeichnung($match, $this->kategorieId);
         if ($artikel == null) {
             Logging::info('Lege Artikel neu an: ' . $match);
             $artikel = new CmsArtikel();
             $artikel->ca_kategorie = $this->kategorieId;
             $artikel->ca_bezeichnung = $match;
             $artikel->ca_aktiv = 1;
             $artikel->ca_autor = Security::getUserId();
             $artikel->save();
             $titel = Text::get($artikel->getElementId() . '.titel');
             $titel->te_text = $match;
             $titel->save();
         }
         $link = EntityLinks::show($artikel);
         $tag = "<a href=\"{$link}\">{$match}</a>";
         $this->text = str_replace('[[' . $match . ']]', $tag, $this->text);
     }
     return $this->text;
 }
 public function setText($schluessel)
 {
     $this->artikel = CmsArtikel::loadByBezeichnung($schluessel);
     return $this;
 }