[ENTITY] Refactor RemoteURL entities to Link

RemoteURL was being an awfully confusing term.
This commit is contained in:
2021-08-13 20:09:20 +01:00
committed by Hugo Sales
parent fb28a3656a
commit 9e4cac0123
8 changed files with 129 additions and 119 deletions

View File

@@ -31,9 +31,9 @@ use App\Core\Modules\Component;
use App\Entity\Attachment;
use App\Entity\AttachmentToNote;
use App\Entity\GSActorToAttachment;
use App\Entity\Link;
use App\Entity\Note;
use App\Entity\RemoteURL;
use App\Entity\RemoteURLToNote;
use App\Entity\NoteToLink;
use App\Util\Common;
use App\Util\Exception\InvalidFormException;
use App\Util\Exception\RedirectException;
@@ -142,8 +142,8 @@ END;
preg_match_all(self::URL_REGEX, $content, $matched_urls, PREG_SET_ORDER);
foreach ($matched_urls as $match) {
try {
$remoteurl_id = RemoteURL::getOrCreate($match[0])->getId();
DB::persist(RemoteURLToNote::create(['remoteurl_id' => $remoteurl_id, 'note_id' => $note->getId()]));
$link_id = Link::getOrCreate($match[0])->getId();
DB::persist(NoteToLink::create(['link_id' => $link_id, 'note_id' => $note->getId()]));
$processed_urls = true;
} catch (InvalidArgumentException) {
continue;