Skip to content
Permalink
Browse files

Fix issue where plugin prefixes would be included in generated view.

Fix issue with `cake bake view Plugin.Model` style view creation.
Fixes #2095
  • Loading branch information...
markstory committed Oct 13, 2011
1 parent 3c611ee commit 7f3c5662ba4b3db4710ea5a72c42b8136e0f4145
@@ -449,10 +449,11 @@ protected function _associations($model) {
foreach ($keys as $key => $type) {
foreach ($model->{$type} as $assocKey => $assocData) {
list($plugin, $modelClass) = pluginSplit($assocData['className']);
$associations[$type][$assocKey]['primaryKey'] = $model->{$assocKey}->primaryKey;
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
$associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey'];
$associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className']));
$associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($modelClass));
$associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true));
}
}
@@ -60,7 +60,7 @@ class ViewTaskComment extends Model {
*/
public $belongsTo = array(
'Article' => array(
'className' => 'ViewTaskArticle',
'className' => 'TestTest.ViewTaskArticle',
'foreignKey' => 'article_id'
)
);
@@ -385,7 +385,12 @@ public function testBakeWithPlugin() {
//fake plugin path
CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
$path = APP . 'Plugin' . DS . 'TestTest' . DS . 'View' . DS . 'ViewTaskComments' . DS . 'view.ctp';
$this->Task->expects($this->once())->method('createFile')
$result = $this->Task->getContent('index');
$this->assertNotContains('List Test Test.view Task Articles', $result);
$this->Task->expects($this->once())
->method('createFile')
->with($path, $this->anything());
$this->Task->bake('view', true);

0 comments on commit 7f3c566

Please sign in to comment.
You can’t perform that action at this time.