-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Goal is to be able to access SQL Server from a LAMP environment. The only issue is that when I do a Find on the EpiArticle, it does not pull the hasMany items from the same SQL Datasource. However the hasOne item does link up fine from the Mysql Datasource
Description of Relationships and the datasource
EpiArticles are stored in SQL Server
EpiArticleField are stored in SQL Server
EpiArticleMeta are stored in Mysql Server
EpiArticle hasMany EpiArticleField
EpiArticle hasOne EpiArticleMeta
Code for these models/relationships
DB CONFIG:
default = Mysql Server
epi_server = SQL Server
class EpiArticle extends AppModel {
public $useDbConfig = 'epi_server';
public $useTable = 'tblPage';
public $primaryKey = 'pkID';
var $hasMany = [
'EpiArticleField' => [
'foreignKey' => 'fkPageID',
],
];
var $hasOne = [
'EpiArticleMeta' => [
'foreignKey' => 'rbuid2'
],
];
}
class EpiArticleField extends AppModel {
public $useDbConfig = 'epi_server';
public $useTable = 'tblProperty';
public $primaryKey = 'fkPageDefinitionID';
public $belongsTo = [
'EpiArticle' => [
'foreignKey' => 'fkPageID',
],
'EpiField' => [
'foreignKey' => 'fkPageDefinitionID',
]
];
}
class EpiArticleMeta extends AppModel {
var $belongsTo = [
'EpiArticle' => [
'foreignKey' => 'rbuid2',
],
];
}
RESULTS OF THE QUERY
array(
(int) 0 => array(
'EpiArticle' => array(
'pkID' => '27386',
'fkPageTypeID' => '49',
'fkParentID' => '27310',
'ArchivePageGUID' => '',
'CreatorName' => 'webservice',
'PageGUID' => '6BA38741-D64B-4F9C-A1DD-B53EC5182753',
'VisibleInMenu' => '0',
'Deleted' => '0',
'PendingPublish' => '0',
'ChildOrderRule' => '1',
'PeerOrder' => '1300',
'ExternalFolderID' => '27585',
'PublishedVersion' => '',
'fkMasterLanguageBranchID' => '1',
'PagePath' => '.1.3.13.15.26166.27310.'
),
'EpiArticleMeta' => array(
'id' => '191504',
'rbpubdate' => '2015-09-17 19:45:00',
'rbpubid' => 'zod_nl_dcn_prd',
'rbuid1' => 'zod_nl_dcn_prd-27386',
'rbuid2' => '27386',
'rbuid' => 'http://www.dailycommercialnews.com/Economic/News/2015/9/A-Bang-on-Prescription-for-What-Ails-Canada-But-1010224W/',
'statictitle' => 'A Bang-on Prescription for What Ails Canada, But…',
'rbimguris1' => '/PageFiles/27585/001_RBI-image-1010225.jpeg',
'rbimguris2' => ''
),
'EpiArticleField' => array() <------------ MISSING THIS DATA
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels