2015-02-18 1 views
0

Я пытаюсь получить социальные логины для работы с использованием hybridauthОшибки: Таблица social_profiles для модели SocialProfile не был найден в источнике данных по умолчанию

моим приложение/модель/SocialProfile.php выглядит

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

class SocialProfile extends AppModel { 
     public $belongsTo = 'User'; 
} 

моего приложения /Model/User.php выглядит

<?php 
App::uses('AppModel', 'Model'); 

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

Я получаю эту ошибку: ошибки: Таблица social_profiles для модели SocialProfile не был найден в источнике данных по умолчанию.

Спасибо вам assitance

+0

У вас есть имя таблицы Точно так же -> social_profiles? –

ответ

0

If social_profiles table is present in your database, not require to define in model. But in your case its not working. so you need to alternative process in CakePHP.

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. 
} 

Я надеюсь, что вышеупомянутая модель будет работать для вас идеально. Я нашел ваше решение, прочитав это. Docs

+0

Большое спасибо. В конце концов я нашел правильный скрипт для создания таблицы в полной загрузке @ http://miftyisbored.com/wp-tutorials/cakephp-2_3-social-auth.zip –

+0

Отлично .. любите себя. – Supravat

Смежные вопросы