mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Calling parent constructors in ModelViewer
ENHANCEMENT Checking for GraphViz dependency in ModelViewer git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81544 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a738dc2027
commit
b459d489a3
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Gives you a nice way of viewing your data model.
|
||||
* Access at dev/viewmodel
|
||||
* Access at dev/viewmodel.
|
||||
*
|
||||
* Requirements: http://graphviz.org/
|
||||
*
|
||||
* @package sapphire
|
||||
* @subpackage tools
|
||||
@ -20,6 +22,17 @@ class ModelViewer extends Controller {
|
||||
function init() {
|
||||
parent::init();
|
||||
if(!Permission::check("ADMIN")) Security::permissionFailure();
|
||||
|
||||
// check for graphviz dependencies
|
||||
$returnCode = 0;
|
||||
$output = array();
|
||||
exec("which digraph && which neato", $output, $returnCode);
|
||||
if($returnCode != 0) {
|
||||
user_error(
|
||||
'You don\'t seem to have the GraphViz library (http://graphviz.org/) or the "digraph" and "neato" command-line utility available',
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,6 +91,8 @@ class ModelViewer_Module extends ModelViewer {
|
||||
*/
|
||||
function __construct($module = null) {
|
||||
$this->module = $module;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function graph() {
|
||||
@ -158,6 +173,8 @@ class ModelViewer_Field extends ViewableData {
|
||||
$this->Model = $model;
|
||||
$this->Name = $name;
|
||||
$this->Type = $type;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,6 +186,8 @@ class ModelViewer_Relation extends ViewableData {
|
||||
$this->Name = $name;
|
||||
$this->RelatedClass = $relatedClass;
|
||||
$this->RelationType = $relationType;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user