mirror of
https://github.com/Karaka-Management/oms-News.git
synced 2026-02-10 13:58:41 +00:00
update
This commit is contained in:
parent
3f44d1a522
commit
a8f4009521
|
|
@ -111,7 +111,7 @@ final class ApiController extends Controller
|
|||
*/
|
||||
private function updateNewsFromRequest(RequestAbstract $request, NewsArticle $new) : NewsArticle
|
||||
{
|
||||
$new->publish = new \DateTime((string) ($request->getData('publish') ?? $new->publish->format('Y-m-d H:i:s')));
|
||||
$new->publish = $request->hasData('publish') ? new \DateTime($request->getDataString('publish') ?? 'now') : $new->publish;
|
||||
$new->title = $request->getDataString('title') ?? $new->title;
|
||||
$new->plain = $request->getDataString('plain') ?? $new->plain;
|
||||
$new->content = Markdown::parse($request->getDataString('plain') ?? $new->plain);
|
||||
|
|
@ -322,7 +322,7 @@ final class ApiController extends Controller
|
|||
{
|
||||
$newsArticle = new NewsArticle();
|
||||
$newsArticle->createdBy = new NullAccount($request->header->account);
|
||||
$newsArticle->publish = new \DateTime((string) ($request->getData('publish') ?? 'now'));
|
||||
$newsArticle->publish = new \DateTime($request->getDataString('publish') ?? 'now');
|
||||
$newsArticle->title = $request->getDataString('title') ?? '';
|
||||
$newsArticle->plain = $request->getDataString('plain') ?? '';
|
||||
$newsArticle->content = Markdown::parse($request->getDataString('plain') ?? '');
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ class NewsArticle implements \JsonSerializable
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidEnumValue
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
|
|
@ -222,6 +224,8 @@ class NewsArticle implements \JsonSerializable
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidEnumValue
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setType(int $type) : void
|
||||
|
|
|
|||
|
|
@ -71,14 +71,12 @@ final class Autoloader
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AutoloadException Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function defaultAutoloader(string $class) : void
|
||||
{
|
||||
$class = \ltrim($class, '\\');
|
||||
$class = \str_replace(['_', '\\'], '/', $class);
|
||||
$class = \strtr($class, '_\\', '//');
|
||||
|
||||
foreach (self::$paths as $path) {
|
||||
$file = $path . $class . '.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user