Fixing hasOne schedule bugs

This commit is contained in:
Dennis Eichhorn 2016-02-13 20:04:35 +01:00
parent a6ef9561af
commit 6179700b03
3 changed files with 10 additions and 7 deletions

View File

@ -90,8 +90,8 @@ class Installer extends InstallerAbstract
`schedule_start` datetime NOT NULL,
`schedule_duration` int(11) NOT NULL,
`schedule_end` datetime DEFAULT NULL,
`scheule_created_at` datetime NOT NULL,
`scheule_created_by` int(11) NOT NULL,
`schedule_created_at` datetime NOT NULL,
`schedule_created_by` int(11) NOT NULL,
PRIMARY KEY (`schedule_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
@ -102,6 +102,7 @@ class Installer extends InstallerAbstract
`calendar_event_name` varchar(25) NOT NULL,
`calendar_event_description` varchar(255) NOT NULL,
`calendar_event_status` tinyint(1) NOT NULL,
`calendar_event_type` tinyint(1) NOT NULL,
`calendar_event_location` varchar(511) NOT NULL,
`calendar_event_created_by` int(11) NOT NULL,
`calendar_event_created_at` datetime NOT NULL,
@ -109,6 +110,7 @@ class Installer extends InstallerAbstract
`calendar_event_calendar` int(11) NOT NULL,
PRIMARY KEY (`calendar_event_id`),
KEY `calendar_event_created_by` (`calendar_event_created_by`),
KEY `calendar_event_schedule` (`calendar_event_schedule`),
KEY `calendar_event_calendar` (`calendar_event_calendar`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
)->execute();
@ -116,7 +118,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_1` FOREIGN KEY (`calendar_event_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_schedule) REFERENCES `' . $dbPool->get('core')->prefix . 'schedule` (`schedule_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_schedule`) REFERENCES `' . $dbPool->get('core')->prefix . 'schedule` (`schedule_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_3` FOREIGN KEY (`calendar_event_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);'
)->execute();

View File

@ -46,6 +46,7 @@ class Uninstall extends UninstallAbstract
$query->prefix($dbPool->get('core')->getPrefix())->drop(
'calendar_event_participant',
'calendar_event',
'schedule',
'calendar_permission',
'calendar'
);

View File

@ -51,8 +51,8 @@ class ScheduleMapper extends DataMapperAbstract
'schedule_start' => ['name' => 'schedule_start', 'type' => 'DateTime', 'internal' => 'start'],
'schedule_duration' => ['name' => 'schedule_duration', 'type' => 'int', 'internal' => 'duration'],
'schedule_end' => ['name' => 'schedule_end', 'type' => 'DateTime', 'internal' => 'end'],
'scheule_created_at' => ['name' => 'scheule_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
'scheule_created_by' => ['name' => 'scheule_created_by', 'type' => 'int', 'internal' => 'createdBy'],
'schedule_created_at' => ['name' => 'schedule_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
'schedule_created_by' => ['name' => 'schedule_created_by', 'type' => 'int', 'internal' => 'createdBy'],
];
/**
@ -108,11 +108,11 @@ class ScheduleMapper extends DataMapperAbstract
'account_permission_p'
)
->into('account_permission')
->values($obj->getCreatedBy(), 'calendar', 'calendar', 1, $objId, 1, 1, 1, 1, 1);
->values($obj->getCreatedBy(), 'schedule', 'schedule', 1, $objId, 1, 1, 1, 1, 1);
$this->db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) {
var_dump($e);
var_dump($e->getMessage());
return false;
}