Explicit type cast

This commit is contained in:
Dennis Eichhorn 2017-11-17 18:46:28 +01:00
parent e6597256a0
commit f476e8eb84
2 changed files with 11 additions and 5 deletions

View File

@ -2449,8 +2449,8 @@ class DataMapperAbstract implements DataMapperInterface
public static function getByRequest(RequestAbstract $request)
{
if (!is_null($request->getData('id'))) {
$result = static::get($request->getData('id'));
} elseif (!is_null($filter = $request->getData('filter'))) {
$result = static::get((int) $request->getData('id'));
} elseif (!is_null($filter = ((string) $request->getData('filter')))) {
$filter = strtolower($filter);
if ($filter === 'all') {
@ -2460,8 +2460,8 @@ class DataMapperAbstract implements DataMapperInterface
$result = static::get(json_decode($list, true));
} else {
$limit = (int) ($request->getData('limit') ?? 1);
$from = !is_null($request->getData('from')) ? new \DateTime($request->getData('from')) : null;
$to = !is_null($request->getData('to')) ? new \DateTime($request->getData('to')) : null;
$from = !is_null($request->getData('from')) ? new \DateTime((string) $request->getData('from')) : null;
$to = !is_null($request->getData('to')) ? new \DateTime((string) $request->getData('to')) : null;
$query = static::getQuery();
$query->limit($limit);

View File

@ -200,7 +200,13 @@ abstract class RequestAbstract implements MessageInterface
}
/**
* {@inheritdoc}
* Get data.
*
* @param mixed $key Data key
*
* @return mixed
*
* @since 1.0.0
*/
public function getData($key = null)
{