/** * @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 testDbMapperMapsFromAndToDataObject() { $now = new DateTime(); $dataObject = $this->createExampleUrlDataObject(1, 7, $now); $url = $this->urlDataObjectMapper->mapFromDataObject($dataObject); $mappedDataObject = $this->urlDataObjectMapper->mapToDataObject($url); $this->assertInstanceOf('\\Model\\Url', $url); $this->assertEquals($dataObject, $mappedDataObject); }