Facebook 错误:在数据源默认值中找不到模型SocialProfile的表social\u配置文件

Facebook 错误:在数据源默认值中找不到模型SocialProfile的表social\u配置文件,facebook,cakephp,model,hybridauth,social-media,Facebook,Cakephp,Model,Hybridauth,Social Media,我正在尝试使用hybridauth进行社交登录 我的app/Model/SocialProfile.php看起来像 <?php App::uses('AppModel', 'Model'); App::uses('AuthComponent', 'Controller/Component'); class SocialProfile extends AppModel { public $belongsTo = 'User'; } <?php App::uses('

我正在尝试使用hybridauth进行社交登录

我的app/Model/SocialProfile.php看起来像

<?php
App::uses('AppModel', 'Model');
App::uses('AuthComponent', 'Controller/Component');

class SocialProfile extends AppModel {
        public $belongsTo = 'User';
}
<?php
App::uses('AppModel', 'Model');

class User extends AppModel {
    public $hasMany = array(
        'SocialProfile' => array(
            'className' => 'SocialProfile',
        )
    );
....

如果数据库中存在social_profiles表,则不需要
在模型中定义。但在你的情况下,它不起作用。所以你需要
CakePHP中的替代流程


我希望上面的模型能完美地为您服务。我从这篇文章中找到了您的解决方案

您的表名是否与->社交档案完全相同?非常感谢。我最终找到了在完整下载@Great..中创建表的合适脚本。祝你玩得愉快。
App::uses('AppModel', 'Model');
App::uses('AuthComponent', 'Controller/Component');

class SocialProfile  extends AppModel {
    public $useTable = 'social_profile '; 
    // This model uses a database      table 'social_profile'
    public $name = 'SocialProfile ';  
   // If you do not specify it in your model file it will be set to the 
   // class name by constructor.
}