/** * @param $url_id * @return Url | null */ public function loadUrl($url_id) { $user_id = $this->userSession->getUserId(); $dataObject = $this->urlQuery->getUrlByIdAndUserId($url_id, $user_id); if ($dataObject == null) { return null; } return $this->urlDataObjectMapper->mapFromDataObject($dataObject); }
public function testEmptyTrash() { $user_id = 1; // Not in trash $url = $this->createExampleUrlDataObject(null, $user_id); $this->urlQuery->createUrl($url); // In trash $url = $this->createExampleUrlDataObject(null, $user_id); $created = $this->urlQuery->createUrl($url); $this->urlQuery->trashUrlByIdAndUserId($created->id, $user_id); // In trash $url = $this->createExampleUrlDataObject(null, $user_id); $created = $this->urlQuery->createUrl($url); $this->urlQuery->trashUrlByIdAndUserId($created->id, $user_id); $this->assertCount(2, $this->urlQuery->getTrashedUrlsByUserId($user_id)); $this->urlQuery->emptyTrashByUserId($user_id); $this->assertCount(0, $this->urlQuery->getTrashedUrlsByUserId($user_id)); $this->assertCount(1, $this->urlQuery->getUrlsByUserId($user_id)); }