/** * Create new fuserId for user. * * @param int $userId User id. * @return Main\Entity\AddResult * @throws \Exception */ protected static function createForUserId($userId) { $fields = array('DATE_INSERT' => new Main\Type\DateTime(), 'DATE_UPDATE' => new Main\Type\DateTime(), 'USER_ID' => $userId, 'CODE' => md5(time() . randString(10))); /** @var Result $r */ return FuserTable::add($fields); }