diff --git a/composer.json b/composer.json index a69b5905..270da115 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "zendframework/zend-expressive-aurarouter": "^1.0", "zendframework/zend-servicemanager": "^3.0", "zendframework/zend-expressive-twigrenderer": "^1.0", - "acelaya/expressive-slim-router": "^2.0" + "doctrine/orm": "^2.5" }, "require-dev": { "phpunit/phpunit": "^4.8", diff --git a/config/autoload/cli-routes.global.php b/config/autoload/cli-routes.global.php new file mode 100644 index 00000000..9a900a7d --- /dev/null +++ b/config/autoload/cli-routes.global.php @@ -0,0 +1,15 @@ + [ + [ + 'name' => 'cli', + 'path' => '/command-name', + 'middleware' => function ($req, $resp) { + + }, + 'allowed_methods' => ['CLI'], + ], + ], + +]; diff --git a/config/autoload/routes.global.php b/config/autoload/routes.global.php index 992f5656..314cbd98 100644 --- a/config/autoload/routes.global.php +++ b/config/autoload/routes.global.php @@ -7,20 +7,10 @@ return [ 'name' => 'home', 'path' => '/', 'middleware' => function ($req, $resp) { - $resp->getBody()->write('Hello world'); - return $resp; + }, 'allowed_methods' => ['GET'], ], - [ - 'name' => 'cli', - 'path' => '/command-name', - 'middleware' => function ($req, $resp) { - $resp->getBody()->write('Hello world from cli'); - return $resp; - }, - 'allowed_methods' => ['CLI'], - ], ], ]; diff --git a/src/Entity/AbstractEntity.php b/src/Entity/AbstractEntity.php new file mode 100644 index 00000000..0fc810ef --- /dev/null +++ b/src/Entity/AbstractEntity.php @@ -0,0 +1,33 @@ +id; + } + + /** + * @param int $id + * @return $this + */ + public function setId($id) + { + $this->id = $id; + return $this; + } +} diff --git a/src/Entity/ShortUrl.php b/src/Entity/ShortUrl.php new file mode 100644 index 00000000..f6091b2b --- /dev/null +++ b/src/Entity/ShortUrl.php @@ -0,0 +1,118 @@ +visits = new ArrayCollection(); + } + + /** + * @return string + */ + public function getOriginalUrl() + { + return $this->originalUrl; + } + + /** + * @param string $originalUrl + * @return $this + */ + public function setOriginalUrl($originalUrl) + { + $this->originalUrl = $originalUrl; + return $this; + } + + /** + * @return string + */ + public function getShortCode() + { + return $this->shortCode; + } + + /** + * @param string $shortCode + * @return $this + */ + public function setShortCode($shortCode) + { + $this->shortCode = $shortCode; + return $this; + } + + /** + * @return \DateTime + */ + public function getDateCreated() + { + return $this->dateCreated; + } + + /** + * @param \DateTime $dateCreated + * @return $this + */ + public function setDateCreated($dateCreated) + { + $this->dateCreated = $dateCreated; + return $this; + } + + /** + * @return Visit[]|Collection + */ + public function getVisits() + { + return $this->visits; + } + + /** + * @param Visit[]|Collection $visits + * @return $this + */ + public function setVisits($visits) + { + $this->visits = $visits; + return $this; + } +} diff --git a/src/Entity/Visit.php b/src/Entity/Visit.php new file mode 100644 index 00000000..01c3ab84 --- /dev/null +++ b/src/Entity/Visit.php @@ -0,0 +1,155 @@ +referer; + } + + /** + * @param string $referer + * @return $this + */ + public function setReferer($referer) + { + $this->referer = $referer; + return $this; + } + + /** + * @return \DateTime + */ + public function getDate() + { + return $this->date; + } + + /** + * @param \DateTime $date + * @return $this + */ + public function setDate($date) + { + $this->date = $date; + return $this; + } + + /** + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * @param string $country + * @return $this + */ + public function setCountry($country) + { + $this->country = $country; + return $this; + } + + /** + * @return string + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * @param string $platform + * @return $this + */ + public function setPlatform($platform) + { + $this->platform = $platform; + return $this; + } + + /** + * @return string + */ + public function getBrowser() + { + return $this->browser; + } + + /** + * @param string $browser + * @return $this + */ + public function setBrowser($browser) + { + $this->browser = $browser; + return $this; + } + + /** + * @return ShortUrl + */ + public function getShortUrl() + { + return $this->shortUrl; + } + + /** + * @param ShortUrl $shortUrl + * @return $this + */ + public function setShortUrl($shortUrl) + { + $this->shortUrl = $shortUrl; + return $this; + } +}