Update Post\Model
There is a need to think about how to unbind id =1 from the guest :(
This commit is contained in:
parent
d41f4d1501
commit
2af02b0286
1 changed files with 9 additions and 2 deletions
|
@ -60,9 +60,16 @@ class Model extends DataModel
|
|||
{
|
||||
$user = $this->c->users->load($this->poster_id);
|
||||
|
||||
if (
|
||||
! $user instanceof User
|
||||
&& 1 !== $this->poster_id // ???? может сменить id гостя?
|
||||
) {
|
||||
$user = $this->c->users->load(1);
|
||||
}
|
||||
|
||||
if (! $user instanceof User) {
|
||||
throw new RuntimeException('No user data in post number ' . $this->id);
|
||||
} elseif (1 === $this->poster_id) {
|
||||
throw new RuntimeException("No user data in post number {$this->id}");
|
||||
} elseif ($user->isGuest) {
|
||||
$user = clone $user;
|
||||
|
||||
$user->__email = $this->poster_email;
|
||||
|
|
Loading…
Add table
Reference in a new issue