mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Bug fix changes
This commit is contained in:
parent
160eebdc21
commit
61d1353023
|
|
@ -1498,8 +1498,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
|
||||
foreach ($primaryKey as $key => $value) {
|
||||
if(self::isInitialized(static::class, $value)) {
|
||||
$obj[$value] = self::getInitialized(static::class, $value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1708,12 +1706,7 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
public static function getRaw($primaryKey) : array
|
||||
{
|
||||
$query = self::getQuery();
|
||||
|
||||
if(is_array($primaryKey)) {
|
||||
$query->where(static::$table . '.' . static::$primaryField, 'in', $primaryKey);
|
||||
} else {
|
||||
$query->where(static::$table . '.' . static::$primaryField, '=', $primaryKey);
|
||||
}
|
||||
$query->where(static::$table . '.' . static::$primaryField, '=', $primaryKey);
|
||||
|
||||
$sth = self::$db->con->prepare($query->toSql());
|
||||
$sth->execute();
|
||||
|
|
@ -1918,21 +1911,6 @@ class DataMapperAbstract implements DataMapperInterface
|
|||
{
|
||||
return isset(self::$initObjects[$mapper]) && isset(self::$initObjects[$mapper][$id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get initialized object
|
||||
*
|
||||
* @param string $mapper Mapper name
|
||||
* @param mixed $id Object id
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function getInitialized($mapper, $id)
|
||||
{
|
||||
return self::$initObjects[$mapper][$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the highest mapper of this request
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace phpOMS\Message;
|
||||
|
||||
use phpOMS\Localization\Localization;
|
||||
|
||||
/**
|
||||
* Response class.
|
||||
*
|
||||
|
|
@ -57,9 +59,23 @@ abstract class HeaderAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->l11n = new Localization();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Get Localization
|
||||
*
|
||||
* @return Localization
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getL11n() : Localization
|
||||
{
|
||||
|
|
@ -67,7 +83,13 @@ abstract class HeaderAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Set localization
|
||||
*
|
||||
* @param int $localization Localization
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setL11n(Localization $l11n) /* : void */
|
||||
{
|
||||
|
|
@ -75,7 +97,11 @@ abstract class HeaderAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Get account id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getAccount() : int
|
||||
{
|
||||
|
|
@ -83,7 +109,13 @@ abstract class HeaderAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Set account id
|
||||
*
|
||||
* @param int $account Account id
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setAccount(int $account) /* : void */
|
||||
{
|
||||
|
|
@ -92,8 +124,13 @@ abstract class HeaderAbstract
|
|||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* todo: shouldn't this only be available in the header?!
|
||||
* Set status code
|
||||
*
|
||||
* @param int $status Status code
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStatusCode(int $status) /* : void */
|
||||
{
|
||||
|
|
@ -102,8 +139,11 @@ abstract class HeaderAbstract
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* todo: shouldn't this only be available in the header?!
|
||||
* Get status code
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStatusCode() : int
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class Header extends HeaderAbstract
|
|||
public function __construct()
|
||||
{
|
||||
$this->set('Content-Type', 'text/html; charset=utf-8');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -123,7 +124,7 @@ class Header extends HeaderAbstract
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getStatusCode() : int
|
||||
public function getStatusCode() : int
|
||||
{
|
||||
if($this->status === 0) {
|
||||
$this->status = \http_response_code();
|
||||
|
|
|
|||
|
|
@ -236,10 +236,12 @@ class Request extends RequestAbstract
|
|||
public function createRequestHashs(int $start = 0) /* : void */
|
||||
{
|
||||
$this->hash = [];
|
||||
foreach ($this->path as $key => $path) {
|
||||
$pathArray = $this->uri->getPathElements();
|
||||
|
||||
foreach ($pathArray as $key => $path) {
|
||||
$paths = [];
|
||||
for ($i = $start; $i < $key + 1; $i++) {
|
||||
$paths[] = $this->path[$i];
|
||||
$paths[] = $pathArray[$i];
|
||||
}
|
||||
|
||||
$this->hash[] = sha1(implode('', $paths));
|
||||
|
|
|
|||
14
Uri/Http.php
14
Uri/Http.php
|
|
@ -257,6 +257,13 @@ class Http implements UriInterface
|
|||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get path offset.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getPathOffset() : int
|
||||
{
|
||||
return substr_count($this->rootPath, '/') - 1;
|
||||
|
|
@ -274,11 +281,16 @@ class Http implements UriInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPathElement(int $pos) : string
|
||||
public function getPathElement(int $pos = null) : string
|
||||
{
|
||||
return explode('/', $this->path)[$pos];
|
||||
}
|
||||
|
||||
public function getPathElements() : array
|
||||
{
|
||||
return explode('/', $this->path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class View extends ViewAbstract
|
|||
$this->app = $app;
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
$this->l11n = $response->getL11n();
|
||||
$this->l11n = $response->getHeader()->getL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user