首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cakephp:有没有办法从$this->Session->read('Auth');获取关系?

cakephp:有没有办法从$this->Session->read('Auth');获取关系?
EN

Stack Overflow用户
提问于 2012-10-12 09:13:28
回答 1查看 93关注 0票数 0
代码语言:javascript
复制
$user = $this->Session->read('Auth'); 

生成以下数组:

代码语言:javascript
复制
array(
    'User' => array(
        'id' => '2',
        'email' => 'info@trinoweb.com',
        'username' => 'trino',
        'created' => '2012-10-11 12:41:52',
        'modified' => '2012-10-11 12:41:52',
        'last_online' => null,
        'main_image' => null,
        'address' => null
    )
)

我希望它能产生相同的东西,但是有所有的连接/关系...像这样..。

代码语言:javascript
复制
array(
    'User' => array(
        'password' => '*****',
        'id' => '128',
        'email' => '12312@asdas.com',
        'username' => 'teresa',
        'created' => '2012-10-11 12:41:52',
        'modified' => '2012-10-11 12:41:52',
        'last_online' => null,
        'main_image' => null,
        'address' => null
    ),
    'Inbox' => array(),
    'Sender' => array(),
    'Upload' => array()
)

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-12 09:46:55

不,除非您在填充Auth密钥时将其写入其中。这是一个会话变量,而不是模型上的动态查找。

您基本上需要修改登录方法来查找这些关系,然后填充会话数据。

请记住,这将是静态数据。如果您更改了关系,则不会在此数组中反映出来。当发生这种情况时,您将需要更新此数组,然后它将变得混乱。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12850910

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档