mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-07 15:36:34 +02:00
Removed _ for protected property in data mapper
This commit is contained in:
@@ -29,11 +29,11 @@ class UserMapper
|
|||||||
/**
|
/**
|
||||||
* @var DBAL
|
* @var DBAL
|
||||||
*/
|
*/
|
||||||
protected $_adapter;
|
protected $adapter;
|
||||||
|
|
||||||
public function __construct(DBAL $dbLayer)
|
public function __construct(DBAL $dbLayer)
|
||||||
{
|
{
|
||||||
$this->_adapter = $dbLayer;
|
$this->adapter = $dbLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,10 +54,10 @@ class UserMapper
|
|||||||
/* if no ID specified create new user else update the one in the Database */
|
/* if no ID specified create new user else update the one in the Database */
|
||||||
if (null === ($id = $user->getUserId())) {
|
if (null === ($id = $user->getUserId())) {
|
||||||
unset($data['userid']);
|
unset($data['userid']);
|
||||||
$this->_adapter->insert($data);
|
$this->adapter->insert($data);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$this->_adapter->update($data, array('userid = ?' => $id));
|
$this->adapter->update($data, array('userid = ?' => $id));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ class UserMapper
|
|||||||
*/
|
*/
|
||||||
public function findById($id)
|
public function findById($id)
|
||||||
{
|
{
|
||||||
$result = $this->_adapter->find($id);
|
$result = $this->adapter->find($id);
|
||||||
if (0 == count($result)) {
|
if (0 == count($result)) {
|
||||||
throw new \InvalidArgumentException("User #$id not found");
|
throw new \InvalidArgumentException("User #$id not found");
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class UserMapper
|
|||||||
*/
|
*/
|
||||||
public function findAll()
|
public function findAll()
|
||||||
{
|
{
|
||||||
$resultSet = $this->_adapter->findAll();
|
$resultSet = $this->adapter->findAll();
|
||||||
$entries = array();
|
$entries = array();
|
||||||
|
|
||||||
foreach ($resultSet as $row) {
|
foreach ($resultSet as $row) {
|
||||||
|
Reference in New Issue
Block a user