mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +00:00
Bug fixes
This commit is contained in:
parent
f6fb7f4747
commit
baf2218980
|
|
@ -495,7 +495,10 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
var_dump($query->toSql());
|
var_dump($query->toSql());
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$db->con->lastInsertId();
|
$objId = self::$db->con->lastInsertId();
|
||||||
|
\settype($objId, static::$columns[static::$primaryField]['type']);
|
||||||
|
|
||||||
|
return $objId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ class Grammar extends GrammarAbstract
|
||||||
$expression .= '(' . \rtrim($join['table']->toSql(), ';') . ')' . (\is_string($key) ? ' as ' . $query->getPrefix() . $key : '');
|
$expression .= '(' . \rtrim($join['table']->toSql(), ';') . ')' . (\is_string($key) ? ' as ' . $query->getPrefix() . $key : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$expression .= $this->compileOn($query, $query->ons[$key]);
|
$expression .= $this->compileOn($query, $query->ons[$key]) . ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$expression = \rtrim($expression, ', ');
|
$expression = \rtrim($expression, ', ');
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Heap
|
||||||
/**
|
/**
|
||||||
* Comparison function
|
* Comparison function
|
||||||
*
|
*
|
||||||
* @var \Closure
|
* @var \Closure
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private \Closure $compare;
|
private \Closure $compare;
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,20 @@ class SmartDateTime extends \DateTime
|
||||||
return new self($this->format('Y') . '-' . $this->format('m') . '-01');
|
return new self($this->format('Y') . '-' . $this->format('m') . '-01');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get start of the week
|
||||||
|
*
|
||||||
|
* @return SmartDateTime
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getStartOfWeek() : self
|
||||||
|
{
|
||||||
|
$w = \strtotime('-' . \date('w', $this->getTimestamp()) .' days', $this->getTimestamp());
|
||||||
|
|
||||||
|
return new self(\date('Y-m-d', $w));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get days of current month
|
* Get days of current month
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ class SmartDateTimeTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertTrue(SmartDateTime::leapYear(2104));
|
self::assertTrue(SmartDateTime::leapYear(2104));
|
||||||
|
|
||||||
self::assertEquals(\date('w', $expected->getTimestamp()), SmartDateTime::getDayOfWeek((int) $expected->format('Y'), (int) $expected->format('m'), (int) $expected->format('d')));
|
self::assertEquals(\date('w', $expected->getTimestamp()), SmartDateTime::getDayOfWeek((int) $expected->format('Y'), (int) $expected->format('m'), (int) $expected->format('d')));
|
||||||
|
|
||||||
|
// todo: i think this assertion is wrong! or the function getFirstDay... doesn't do what is supposed to do
|
||||||
self::assertEquals(\date('w', $expected->getTimestamp()), $obj->getFirstDayOfWeek());
|
self::assertEquals(\date('w', $expected->getTimestamp()), $obj->getFirstDayOfWeek());
|
||||||
|
|
||||||
self::assertCount(42, $obj->getMonthCalendar());
|
self::assertCount(42, $obj->getMonthCalendar());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user