#5537: Missing parameter for specifying the datasource of a default join model
-----------------------------+----------------------------------------------
Reporter: euphrate_ylb | Type: Enhancement
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: Model
Version: RC3 | Severity: Trivial
Keywords: datasource | Php_version: n/a
Cake_version: |
-----------------------------+----------------------------------------------
As an example, I define a HABTM relation between a User model and a Group
model. If User uses a different datasource than Group, then CakePHP has no
way to know which datasource should be used to create a default join
model.
An unstatisfaying solution would be to define a useless join model that
specifies the datasource to be used. A smarter solution would be to add an
new parameter to the HABTM relation (e.g. 'associationDataSource') and use
it in the model class as listed below:
Model::674
{{{
if (!ClassRegistry::isKeySet($plugin . $joinClass) &&
!App::import('Model', $plugin . $joinClass)) {
$this->{$joinClass} = new AppModel(array(
'name' => $joinClass,
'table' => $this->{$type}[$assocKey]['joinTable'],
'ds' =>
(isset($this->{$type}[$assocKey]['associationDataSource'])?$this->{$type}[$assocKey]['associationDataSource']:$this->useDbConfig)
));
}
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5537>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---