Removed need for strict typing
This commit is contained in:
parent
70a4b46cf1
commit
8cd457848c
3 changed files with 4 additions and 4 deletions
|
@ -564,10 +564,10 @@ class PostController
|
||||||
if (!$this->context->loggedIn)
|
if (!$this->context->loggedIn)
|
||||||
throw new SimpleException('Not logged in');
|
throw new SimpleException('Not logged in');
|
||||||
|
|
||||||
$p = R::findOne('post_score', 'post_id = ? AND user_id = ?', [$id, $this->context->user->id]);
|
$p = R::findOne('postscore', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]);
|
||||||
if (!$p)
|
if (!$p)
|
||||||
{
|
{
|
||||||
$p = R::dispense('post_score');
|
$p = R::dispense('postscore');
|
||||||
$p->post = $post;
|
$p->post = $post;
|
||||||
$p->user = $this->context->user;
|
$p->user = $this->context->user;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +648,7 @@ class PostController
|
||||||
if ($fav->user->id == $this->context->user->id)
|
if ($fav->user->id == $this->context->user->id)
|
||||||
$favorite = true;
|
$favorite = true;
|
||||||
|
|
||||||
$s = R::findOne('post_score', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]);
|
$s = R::findOne('postscore', 'post_id = ? AND user_id = ?', [$post->id, $this->context->user->id]);
|
||||||
if ($s)
|
if ($s)
|
||||||
$score = intval($s->score);
|
$score = intval($s->score);
|
||||||
}
|
}
|
||||||
|
|
1
src/Upgrades/Upgrade5.sql
Normal file
1
src/Upgrades/Upgrade5.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE post_score RENAME TO postscore
|
|
@ -48,7 +48,6 @@ $config = configFactory();
|
||||||
R::setup('sqlite:' . $config->main->dbPath);
|
R::setup('sqlite:' . $config->main->dbPath);
|
||||||
R::freeze(true);
|
R::freeze(true);
|
||||||
R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user'], 'comment' => ['post', 'user']]);
|
R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user'], 'comment' => ['post', 'user']]);
|
||||||
R::setStrictTyping(false);
|
|
||||||
|
|
||||||
//wire models
|
//wire models
|
||||||
\Chibi\AutoLoader::init([__DIR__ . '/../' . $config->chibi->userCodeDir, __DIR__]);
|
\Chibi\AutoLoader::init([__DIR__ . '/../' . $config->chibi->userCodeDir, __DIR__]);
|
||||||
|
|
Loading…
Reference in a new issue