Skip to content

Commit

Permalink
adding base zfkit
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kimsal authored and Michael Kimsal committed Apr 27, 2010
1 parent 2359de8 commit a6859d4
Show file tree
Hide file tree
Showing 349 changed files with 66,786 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
Initial ZF starter kit import
ZFKit - Zend Framework Starter Kit
==================================
ZFKit provides a basic skeleton for bringing
together doctrine, phpunit and zend framework in one
'ready to go' set up.

Doctrine 1.2 is provided in the /library folder,
but Zend Framework will need to be provided by you directly.
You can symlink it in to /library or copy it directly.

You'll need to symlink such that /library/Zend is pointing
at your /library from the ZendFramework installation.

ln -s /path/to/zfkit/library/Zend /path/to/real/zendframework/library/Zend

or

cp -r /path/to/real/zendframework/library/Zend /path/to/zfkit/library/




39 changes: 39 additions & 0 deletions application/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function _initDoctrine() {

$this->getApplication()->getAutoloader()->pushAutoloader(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine','modelsAutoload'));
$manager = Doctrine_Manager::getInstance();

$config = $this->getOption('doctrine');
Doctrine_Core::setModelsDirectory($config['models_path']);
$connection = Doctrine_Manager::connection($config['dsn'], 'doctrine');

$profiler = new Doctrine_Connection_Profiler();

$connection->setListener($profiler);

}

/**
* if you want true zend-framework 'rest'-style URLs
* with all that entails, uncomment this method
*/

/*
public function _initRouting()
{
$this->bootstrap('frontController');
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$restRoute = new Zend_Rest_Route($front);
$front->getRouter()->addRoute('rest', $restRoute);
}
*/

}

42 changes: 42 additions & 0 deletions application/configs/application.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = ""
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

autoloaderNamespaces[] = "Doctrine"
autoloaderNamespaces[] = "Test"

; doctrine
doctrine.dsn = "mysql://user:password@server/prod_dbname"
doctrine.data_fixtures_path = APPLICATION_PATH "/configs/data/fixtures"
doctrine.sql_path = APPLICATION_PATH "/configs/data/sql"
doctrine.migations_path = APPLICATION_PATH "/configs/data/fixtures"
doctrine.yaml_schema_path= APPLICATION_PATH "/configs/schema.yml"
doctrine.models_path = APPLICATION_PATH "/models"
doctrine.generate_models_options.pearStyle = true
doctrine.generate_models_options.generateTableClasses = true
doctrine.generate_models_options.generateBaseClasses = true
doctrine.generate_models_options.generateClassPrefix = false
doctrine.generate_models_options.baseClassPrefix = Base_
doctrine.generate_models_options.baseClassesDirectory =
doctrine.generate_models_options.classPrefixFiles = false
doctrine.generate_models_options.generateAccessors = false



[testing : production]
doctrine.dsn = "mysql://user:password@server/testing_dbname"
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
doctrine.dsn = "sqlite:///" APPLICATION_PATH "/dev.db"
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
2 changes: 2 additions & 0 deletions application/configs/data/fixtures/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# put sample data to be loaded here
# use yaml for doctrine fixtures
4 changes: 4 additions & 0 deletions application/configs/messages.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; place messages to be centralized here
; and use the zend_config reader to read them out
error.message = "Standard error message here"

9 changes: 9 additions & 0 deletions application/configs/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
detect_relations: true
options:
collate: latin1_swedish_ci
charset: latin1
type: InnoDB

#put sample yaml here

47 changes: 47 additions & 0 deletions application/controllers/ErrorController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

class ErrorController extends Zend_Controller_Action
{

public function errorAction()
{

$errors = $this->_getParam('error_handler');

switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:

// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}


// conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception;
}

$this->view->request = $errors->request;
}

public function getLog()
{
$bootstrap = $this->getInvokeArg('bootstrap');
if (!$bootstrap->hasPluginResource('Log')) {
return false;
}
$log = $bootstrap->getResource('Log');
return $log;
}

}

17 changes: 17 additions & 0 deletions application/controllers/IndexController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

class IndexController extends Zend_Controller_Action
{


public function init()
{
/* Initialize action controller here */
}

public function indexAction()
{
}

}

15 changes: 15 additions & 0 deletions application/layouts/scripts/layout.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php echo $this->doctype() ?>
<html>
<head>
<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headStyle() ?>
<?php echo $this->headScript() ?>
<meta charset="utf-8">
</head>

<?php echo $this->layout()->content ?>
<?php echo $this->inlineScript() ?>

</html>
28 changes: 28 additions & 0 deletions application/views/scripts/error/error.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zend Framework Default Application</title>
</head>
<body>
<h1>An error occurred</h1>
<h2><?php echo $this->message ?></h2>

<?php if (isset($this->exception)): ?>

<h3>Exception information:</h3>
<p>
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
</p>

<h3>Stack trace:</h3>
<pre><?php echo $this->exception->getTraceAsString() ?>
</pre>

<h3>Request Parameters:</h3>
<pre><?php echo var_export($this->request->getParams(), true) ?>
</pre>
<?php endif ?>

</body>
</html>
1 change: 1 addition & 0 deletions application/views/scripts/index/index.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Index page goes here
25 changes: 25 additions & 0 deletions base.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . '/../library/Doctrine'),
get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);

38 changes: 38 additions & 0 deletions library/Doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/*
* $Id: Doctrine.php 6489 2009-10-12 20:21:01Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/

require_once 'Doctrine/Core.php';

/**
* This class only exists for backwards compatability. All code was moved to
* Doctrine_Core and this class extends Doctrine_Core
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 6489 $
*/
class Doctrine extends Doctrine_Core
{
}
38 changes: 38 additions & 0 deletions library/Doctrine/Doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/*
* $Id: Doctrine.php 7490 2010-03-29 19:53:27Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/

require_once 'Doctrine/Core.php';

/**
* This class only exists for backwards compatability. All code was moved to
* Doctrine_Core and this class extends Doctrine_Core
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 1.0
* @version $Revision: 7490 $
*/
class Doctrine extends Doctrine_Core
{
}
Loading

0 comments on commit a6859d4

Please sign in to comment.