Skip to content

Commit

Permalink
Fix "Creation of dynamic property module_name is deprecated" (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 committed Aug 25, 2023
1 parent d01aceb commit 4dafae6
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 61 deletions.
5 changes: 3 additions & 2 deletions application/modules/user/controllers/admin/Providers.php
@@ -1,14 +1,15 @@
<?php
/**
* @copyright Ilch 2.0
* @copyright Ilch 2
* @package ilch
*/

namespace Modules\User\Controllers\Admin;

use Ilch\Controller\Admin;
use Modules\User\Mappers\AuthProvider;

class Providers extends \Ilch\Controller\Admin
class Providers extends Admin
{
public function init()
{
Expand Down
7 changes: 4 additions & 3 deletions application/modules/user/mappers/AuthProvider.php
@@ -1,11 +1,12 @@
<?php
/**
* @copyright Ilch 2.0
* @copyright Ilch 2
* @package ilch
*/

namespace Modules\User\Mappers;

use Ilch\Database\Mysql\Result;
use Modules\User\Models\AuthProviderUser;
use Modules\User\Models\Provider;
use Modules\User\Models\AuthProviderModule;
Expand Down Expand Up @@ -183,7 +184,7 @@ public function unlinkUser($provider, $user_id)
* the links to the auth providers of that deleted user are of no use anymore.
*
* @param $user_id
* @return \Ilch\Database\Mysql\Result|int
* @return Result|int
*/
public function deleteUser($user_id)
{
Expand All @@ -210,7 +211,7 @@ public function authProvidersModuleExistsForProvider($provider, $module)
public function deleteProvider($key)
{
$provider = $this->db()->delete('auth_providers', ['key' => $key])->execute();
$provider_users = $this->db()->delete('users_auth_providers', ['provider' => $key])->execute();
$this->db()->delete('users_auth_providers', ['provider' => $key])->execute();

return $provider === 1;
}
Expand Down
92 changes: 69 additions & 23 deletions application/modules/user/models/AuthProviderModule.php
Expand Up @@ -8,35 +8,81 @@

class AuthProviderModule extends \Ilch\Model
{
/**
* @var string
*/
protected $name;

/**
* @var string
*/
protected $provider;

/**
* @var string
*/
protected $module;

/**
* @var string
*/
protected $auth_controller;

/**
* @var string
*/
protected $auth_action;

/**
* @var string
*/
protected $unlink_controller;

/**
* @var string
*/
protected $unlink_action;

public function __construct()
{
}

/**
* @return string
*/
public function getName(): string
{
return $this->name;
}

/**
* @param string $name
* @return AuthProviderModule
*/
public function setName(string $name): AuthProviderModule
{
$this->name = $name;
return $this;
}

/**
* Gets the value of provider.
*
* @return mixed
* @return string
*/
public function getProvider()
public function getProvider(): string
{
return $this->provider;
}

/**
* Sets the value of provider.
*
* @param mixed $provider the provider
* @param string $provider the provider
*
* @return self
*/
public function setProvider($provider)
public function setProvider(string $provider): AuthProviderModule
{
$this->provider = $provider;

Expand All @@ -46,9 +92,9 @@ public function setProvider($provider)
/**
* Gets the value of module.
*
* @return mixed
* @return string
*/
public function getModule()
public function getModule(): string
{
return $this->module;
}
Expand All @@ -60,7 +106,7 @@ public function getModule()
*
* @return self
*/
public function setModule($module)
public function setModule($module): AuthProviderModule
{
$this->module = $module;

Expand All @@ -70,21 +116,21 @@ public function setModule($module)
/**
* Gets the value of auth_controller.
*
* @return mixed
* @return string
*/
public function getAuthController()
public function getAuthController(): string
{
return $this->auth_controller;
}

/**
* Sets the value of auth_controller.
*
* @param mixed $auth_controller the auth controller
* @param string $auth_controller the auth controller
*
* @return self
*/
public function setAuthController($auth_controller)
public function setAuthController(string $auth_controller): AuthProviderModule
{
$this->auth_controller = $auth_controller;

Expand All @@ -94,21 +140,21 @@ public function setAuthController($auth_controller)
/**
* Gets the value of auth_action.
*
* @return mixed
* @return string
*/
public function getAuthAction()
public function getAuthAction(): string
{
return $this->auth_action;
}

/**
* Sets the value of auth_action.
*
* @param mixed $auth_action the auth action
* @param string $auth_action the auth action
*
* @return self
*/
public function setAuthAction($auth_action)
public function setAuthAction(string $auth_action): AuthProviderModule
{
$this->auth_action = $auth_action;

Expand All @@ -118,21 +164,21 @@ public function setAuthAction($auth_action)
/**
* Gets the value of unlink_controller.
*
* @return mixed
* @return string
*/
public function getUnlinkController()
public function getUnlinkController(): string
{
return $this->unlink_controller;
}

/**
* Sets the value of unlink_controller.
*
* @param mixed $unlink_controller the unlink controller
* @param string $unlink_controller the unlink controller
*
* @return self
*/
public function setUnlinkController($unlink_controller)
public function setUnlinkController(string $unlink_controller): AuthProviderModule
{
$this->unlink_controller = $unlink_controller;

Expand All @@ -142,21 +188,21 @@ public function setUnlinkController($unlink_controller)
/**
* Gets the value of unlink_action.
*
* @return mixed
* @return string
*/
public function getUnlinkAction()
public function getUnlinkAction(): string
{
return $this->unlink_action;
}

/**
* Sets the value of unlink_action.
*
* @param mixed $unlink_action the unlink action
* @param string $unlink_action the unlink action
*
* @return self
*/
public function setUnlinkAction($unlink_action)
public function setUnlinkAction(string $unlink_action): AuthProviderModule
{
$this->unlink_action = $unlink_action;

Expand Down

0 comments on commit 4dafae6

Please sign in to comment.