Call to undefined method app\\models\\User::findIdentityByAccessToken()
app\models\User
должна была заимплементировать IdentityInterface и реализовать метод findIdentityByAccessToken()
. Yii::$app->get('client')->identity
'modules' => [
'api1' => [
'class' => 'api\modules\Api1',
'components' => [
'user' => [
'class' => 'yii\web\User', // <---
'identityClass' => 'common\models\Api1User',
'loginUrl' => '/site/login',
'identityCookie' => [
'name' => '_identity-api1',
],
],
]
],
]
'components' => [
'user' => [
'class' => 'yii\web\User',
// ...
[
0 => [
'id' => 'c8dc5058-41af-11ea-a51e-02555e854149',
'name' => 'Item 1',
'children' => [
0 => [
'id' => 'eadf1b2e-41af-11ea-a51e-02555e854149',
'name' => 'Item 11',
'children' => []
],
1 => [
'id' => '5a776825-41b0-11ea-a51e-02555e854149',
'name' => 'Item 31',
'children' => [
0 => [
'id' => '7067e355-41b0-11ea-a51e-02555e854149',
'name' => 'Item 171',
'children' => []
]
]
]
],
]
]
try {
$this->mObj->checkOperation();
$this->mObj->checkMission();
} catch (OperationDomainException $e) {
$this->alertRedirect('danger', $e->getMessage(), '/operations');
} catch (MissionDomainException $e) {
$this->alertRedirect('danger', $e->getMessage(), "/operation-{$this->mObj->oid}/missions");
}
class MyObj {
public function checkOperation() {
throw new ADomainException;
}
public function checkMission() {
throw new BDomainException;
}
}
try {
$this->mObj->checkOperation();
$this->mObj->checkMission();
} catch (ADomainException $e) {
$this->alertRedirect('danger', $e->getMessage(), '/operations');
} catch (BDomainException $e) {
$this->alertRedirect('danger', $e->getMessage(), "/operation-{$this->mObj->oid}/missions");
}
<?php
namespace My\Deep\Space;
class A {
/**
* @return \carono\exchange1c\interfaces\ProductInterface
*/
protected function getProductClass()
{
return $this->exModule->productClass;
}
}
<?php
namespace My\Deep\Space;
use \carono\exchange1c\interfaces\ProductInterface;
class A {
/**
* @return ProductInterface
*/
protected function getProductClass()
{
return $this->exModule->productClass;
}
}
<?php
namespace My\Deep\Space;
use \carono\exchange1c\interfaces\ProductInterface as Apple;
class A {
/**
* @return Apple
*/
protected function getProductClass()
{
return $this->exModule->productClass;
}
}