Skip to content

Commit

Permalink
playing with habtm relation
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jan 18, 2010
1 parent 6507de7 commit 953e1c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
3 changes: 2 additions & 1 deletion infinitas/management/controllers/modules_controller.php
Expand Up @@ -26,7 +26,8 @@ function admin_add() {

$positions = $this->Module->Position->find('list');
$groups = $this->Module->Group->find('list');
$routes = $this->Module->Route->find('all');

$routes = ClassRegistry::init('Core.Route')->find('list');
$this->set(compact('positions', 'groups', 'routes'));
}

Expand Down
6 changes: 4 additions & 2 deletions infinitas/management/models/module.php
Expand Up @@ -9,7 +9,9 @@ class Module extends ManagementAppModel{
var $tablePrefix = 'core_';

var $actsAs = array(
'Libs.Ordered'
'Libs.Ordered' => array(
'foreign_key' => 'position_id'
)
);

var $order = array(
Expand All @@ -26,7 +28,7 @@ class Module extends ManagementAppModel{
);

var $hasAndBelongsToMany = array(
'Route' => array(
'ModulesRoute' => array(
'className' => 'Core.ModulesRoute',
'joinTable' => 'modules_routes',
'foreignKey' => 'module_id',
Expand Down
10 changes: 0 additions & 10 deletions infinitas/management/models/route.php
Expand Up @@ -40,16 +40,6 @@ class Route extends ManagementAppModel {
'Management.Theme'
);

var $hasAndBelongsToMany = array(
'ModulesRoute' => array(
'className' => 'Core.ModulesRoute',
'joinTable' => 'modules_routes',
'foreignKey' => 'route_id',
'associationForeignKey' => 'module_id',
'unique' => true
)
);

function getPlugins(){
$plugins = Configure::listObjects('plugin');

Expand Down
3 changes: 2 additions & 1 deletion infinitas/management/views/modules/admin_add.ctp
Expand Up @@ -40,9 +40,10 @@
</div>
<div style="width:50%; float:left;">
<?php
echo $this->Form->input( 'Route' );
echo $this->Form->input('ModulesRoute.Route', array('multiple' => true));
?>
</div>
<div class="clr">&nbsp;</div>
<?php
echo $this->Form->end( 'Save Module' );
?>

0 comments on commit 953e1c6

Please sign in to comment.