Skip to content

Commit

Permalink
Mappings for MongoDB Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Aug 5, 2016
1 parent 97ea7c6 commit 576eb36
Show file tree
Hide file tree
Showing 20 changed files with 694 additions and 660 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
],
"require": {
"mongodb/mongodb": "^1.0",
"nilportugues/repository": "^3.0",
"nilportugues/serializer": "1.1.*",
"nilportugues/assert": "1.0.*"
"nilportugues/repository": "^3.0.2",
"nilportugues/serializer": "^1.1",
"nilportugues/assert": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
Expand Down
82 changes: 0 additions & 82 deletions example/Domain/User.php

This file was deleted.

99 changes: 0 additions & 99 deletions example/Persistence/MongoDB/UserRepository.php

This file was deleted.

24 changes: 0 additions & 24 deletions example/Service/UserAdapter.php

This file was deleted.

102 changes: 102 additions & 0 deletions example/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace NilPortugues\Example;

use DateTime;
use NilPortugues\Foundation\Domain\Model\Repository\Contracts\Identity;

/**
* Class User.
*/
class User implements Identity
{
protected $userId;
protected $username;
protected $alias;
protected $email;
protected $registeredOn;

/**
* User constructor.
*
* @param $userId
* @param $username
* @param $alias
* @param $email
* @param DateTime $registeredOn
*/
public function __construct($userId, $username, $alias, $email, DateTime $registeredOn)
{
$this->userId = $userId;
$this->username = $username;
$this->alias = $alias;
$this->email = $email;
$this->registeredOn = $registeredOn;
}

/**
* Returns value for `userId`.
*
* @return mixed
*/
public function userId()
{
return $this->userId;
}

/**
* Returns value for `username`.
*
* @return mixed
*/
public function username()
{
return $this->username;
}

/**
* Returns value for `alias`.
*
* @return mixed
*/
public function alias()
{
return $this->alias;
}

/**
* Returns value for `email`.
*
* @return mixed
*/
public function email()
{
return $this->email;
}

/**
* Returns value for `registeredOn`.
*
* @return DateTime
*/
public function registeredOn()
{
return $this->registeredOn;
}

/**
* @return mixed
*/
public function id()
{
return $this->userId;
}

/**
* @return string
*/
public function __toString()
{
return (string) $this->id();
}
}
5 changes: 4 additions & 1 deletion example/Domain/UserId.php → example/UserId.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace NilPortugues\Example\Domain;
namespace NilPortugues\Example;

use NilPortugues\Foundation\Domain\Model\Repository\Contracts\Identity;

/**
* Class UserId.
*/
class UserId implements Identity
{
private $id;
Expand Down
Loading

0 comments on commit 576eb36

Please sign in to comment.