moving website out of trunk. it has external dependencies on symfonys SVN server - which sometimes is unstable. It is causing problems preventing peopel checking out trunk at the moment
This commit is contained in:
parent
b908e2f95b
commit
5ee24d9303
@ -1,2 +0,0 @@
|
||||
# default values
|
||||
#all:
|
@ -1,4 +0,0 @@
|
||||
default:
|
||||
enabled: off
|
||||
with_layout: false
|
||||
lifetime: 86400
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
// include project configuration
|
||||
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
|
||||
|
||||
// symfony bootstraping
|
||||
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
|
||||
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);
|
@ -1,35 +0,0 @@
|
||||
cli:
|
||||
controller:
|
||||
class: sfConsoleController
|
||||
request:
|
||||
class: sfConsoleRequest
|
||||
response:
|
||||
class: sfConsoleResponse
|
||||
|
||||
test:
|
||||
storage:
|
||||
class: sfSessionTestStorage
|
||||
|
||||
#all:
|
||||
# controller:
|
||||
# class: sfFrontWebController
|
||||
#
|
||||
# request:
|
||||
# class: sfWebRequest
|
||||
#
|
||||
# response:
|
||||
# class: sfWebResponse
|
||||
#
|
||||
# user:
|
||||
# class: myUser
|
||||
#
|
||||
# storage:
|
||||
# class: sfSessionStorage
|
||||
# param:
|
||||
# session_name: symfony
|
||||
#
|
||||
# view_cache:
|
||||
# class: sfFileCache
|
||||
# param:
|
||||
# automaticCleaningFactor: 0
|
||||
# cacheDir: %SF_TEMPLATE_CACHE_DIR%
|
@ -1,10 +0,0 @@
|
||||
rendering: ~
|
||||
web_debug: ~
|
||||
security: ~
|
||||
|
||||
# generally, you will want to insert your own filters here
|
||||
|
||||
cache: ~
|
||||
common: ~
|
||||
flash: ~
|
||||
execution: ~
|
@ -1,7 +0,0 @@
|
||||
#all:
|
||||
# default_culture: en
|
||||
# source: XLIFF
|
||||
# debug: off
|
||||
# cache: on
|
||||
# untranslated_prefix: "[T]"
|
||||
# untranslated_suffix: "[/T]"
|
@ -1,22 +0,0 @@
|
||||
prod:
|
||||
enabled: off
|
||||
level: err
|
||||
rotate: on
|
||||
purge: off
|
||||
|
||||
#all:
|
||||
# enabled: on
|
||||
# level: debug
|
||||
# rotate: off
|
||||
# period: 7
|
||||
# history: 10
|
||||
# purge: on
|
||||
# loggers:
|
||||
# sf_web_debug:
|
||||
# class: sfWebDebugLogger
|
||||
# param:
|
||||
# condition: %SF_WEB_DEBUG%
|
||||
# sf_file_debug:
|
||||
# class: sfFileLogger
|
||||
# param:
|
||||
# file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
|
@ -1,15 +0,0 @@
|
||||
# default rules
|
||||
homepage:
|
||||
url: /
|
||||
param: { module: blog_posts, action: index }
|
||||
|
||||
default_symfony:
|
||||
url: /symfony/:action/*
|
||||
param: { module: default }
|
||||
|
||||
default_index:
|
||||
url: /:module
|
||||
param: { action: index }
|
||||
|
||||
default:
|
||||
url: /:module/:action/*
|
@ -1,2 +0,0 @@
|
||||
default:
|
||||
is_secure: on
|
@ -1,103 +0,0 @@
|
||||
prod:
|
||||
.settings:
|
||||
no_script_name: off
|
||||
|
||||
dev:
|
||||
.settings:
|
||||
# E_ALL | E_STRICT = 4095
|
||||
error_reporting: 4095
|
||||
web_debug: on
|
||||
cache: off
|
||||
no_script_name: off
|
||||
etag: off
|
||||
|
||||
test:
|
||||
.settings:
|
||||
# E_ALL | E_STRICT & ~E_NOTICE = 2047
|
||||
error_reporting: 2047
|
||||
cache: off
|
||||
web_debug: off
|
||||
no_script_name: off
|
||||
etag: off
|
||||
|
||||
all:
|
||||
.actions:
|
||||
default_module: default # Default module and action to be called when
|
||||
default_action: index # A routing rule doesn't set it
|
||||
|
||||
error_404_module: default # To be called when a 404 error is raised
|
||||
error_404_action: error404 # Or when the requested URL doesn't match any route
|
||||
|
||||
login_module: sfGuardAuth # To be called when a non-authenticated user
|
||||
login_action: signin # Tries to access a secure page
|
||||
|
||||
secure_module: sfGuardAuth # To be called when a user doesn't have
|
||||
secure_action: secure # The credentials required for an action
|
||||
|
||||
module_disabled_module: default # To be called when a user requests
|
||||
module_disabled_action: disabled # A module disabled in the module.yml
|
||||
|
||||
unavailable_module: default # To be called when a user requests a page
|
||||
unavailable_action: unavailable # From an application disabled via the available setting below
|
||||
|
||||
.settings:
|
||||
available: on # Enable the whole application. Switch to off to redirect all requests to the unavailable module and action.
|
||||
|
||||
# Optional features. Deactivating unused features boots performance a bit.
|
||||
use_database: on # Enable database manager. Set to off if you don't use a database.
|
||||
use_security: on # Enable security features (login and credentials). Set to off for public applications.
|
||||
use_flash: on # Enable flash parameter feature. Set to off if you never use the set_flash() method in actions.
|
||||
i18n: off # Enable interface translation. Set to off if your application should not be translated.
|
||||
check_symfony_version: off # Enable check of symfony version for every request. Set to on to have symfony clear the cache automatically when the framework is upgraded. Set to off if you always clear the cache after an upgrade.
|
||||
use_process_cache: on # Enable symfony optimizations based on PHP accelerators. Set to off for tests or when you have enabled a PHP accelerator in your server but don't want symfony to use it internally.
|
||||
compressed: off # Enable PHP response compression. Set to on to compress the outgoing HTML via the PHP handler.
|
||||
check_lock: off # Enable the application lock system triggered by the clear-cache and disable tasks. Set to on to have all requests to disabled applications redirected to the $sf_symfony_data_dir/web/arrors/unavailable.php page.
|
||||
|
||||
# Output escaping settings
|
||||
escaping_strategy: bc # Determines how variables are made available to templates. Accepted values: bc, both, on, off. The value off deactivates escaping completely and gives a slight boost.
|
||||
escaping_method: ESC_ENTITIES # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES.
|
||||
|
||||
# Routing settings
|
||||
suffix: . # Default suffix for generated URLs. If set to a single dot (.), no suffix is added. Possible values: .html, .php, and so on.
|
||||
no_script_name: off # Enable the front controller name in generated URLs
|
||||
|
||||
# Validation settings, used for error generation by the Validation helper
|
||||
validation_error_prefix: ' ↓ '
|
||||
validation_error_suffix: ' ↓'
|
||||
validation_error_class: form_error
|
||||
validation_error_id_prefix: error_for_
|
||||
|
||||
# Cache settings
|
||||
cache: off # Enable the template cache
|
||||
etag: on # Enable etag handling
|
||||
|
||||
# Logging and debugging settings
|
||||
web_debug: off # Enable the web debug toolbar
|
||||
error_reporting: 341 # Determines which events are logged. The default value is E_PARSE | E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_USER_ERROR = 341
|
||||
|
||||
# Assets paths
|
||||
rich_text_js_dir: js/tiny_mce
|
||||
prototype_web_dir: /sf/prototype
|
||||
admin_web_dir: /sf/sf_admin
|
||||
web_debug_web_dir: /sf/sf_web_debug
|
||||
|
||||
# Helpers included in all templates by default
|
||||
standard_helpers: [Partial, Cache, Form]
|
||||
|
||||
# Activated modules from plugins or from the symfony core
|
||||
enabled_modules: [default, sfGuardAuth, sfGuardUser, sfGuardGroup, sfGuardPermission]
|
||||
|
||||
# Charset used for the response
|
||||
charset: utf-8
|
||||
|
||||
# Miscellaneous
|
||||
strip_comments: on # Remove comments in core framework classes as defined in the core_compile.yml
|
||||
autoloading_functions: ~ # Functions called when a class is requested and this it is not already loaded. Expects an array of callables. Used by the framework bridges.
|
||||
timeout: 1800 # Session timeout, in seconds
|
||||
max_forwards: 5
|
||||
path_info_array: SERVER
|
||||
path_info_key: PATH_INFO
|
||||
url_format: PATH
|
||||
|
||||
# ORM
|
||||
orm: propel
|
@ -1,17 +0,0 @@
|
||||
default:
|
||||
http_metas:
|
||||
content-type: text/html
|
||||
|
||||
metas:
|
||||
title: symfony project
|
||||
robots: index, follow
|
||||
description: symfony project
|
||||
keywords: symfony, project
|
||||
language: en
|
||||
|
||||
stylesheets: [main]
|
||||
|
||||
javascripts: []
|
||||
|
||||
has_layout: on
|
||||
layout: layout
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class myUser extends sfGuardSecurityUser
|
||||
{
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* blog_posts actions.
|
||||
*
|
||||
* @package doctrine_website
|
||||
* @subpackage blog_posts
|
||||
* @author Your name here
|
||||
* @version SVN: $Id: actions.class.php 1415 2006-06-11 08:33:51Z fabien $
|
||||
*/
|
||||
class blog_postsActions extends autoblog_postsActions
|
||||
{
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
generator:
|
||||
class: sfDoctrineAdminGenerator
|
||||
param:
|
||||
model_class: BlogPost
|
||||
theme: default
|
||||
edit:
|
||||
display: [name, body]
|
||||
fields:
|
||||
body:
|
||||
type: textarea_tag
|
||||
params: size=60x15
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<?php include_http_metas() ?>
|
||||
<?php include_metas() ?>
|
||||
|
||||
<?php include_title() ?>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php echo $sf_data->getRaw('sf_content') ?>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,2 +0,0 @@
|
||||
# default values
|
||||
#all:
|
@ -1,4 +0,0 @@
|
||||
default:
|
||||
enabled: off
|
||||
with_layout: false
|
||||
lifetime: 86400
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
// include project configuration
|
||||
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
|
||||
|
||||
// symfony bootstraping
|
||||
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
|
||||
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);
|
@ -1,35 +0,0 @@
|
||||
cli:
|
||||
controller:
|
||||
class: sfConsoleController
|
||||
request:
|
||||
class: sfConsoleRequest
|
||||
response:
|
||||
class: sfConsoleResponse
|
||||
|
||||
test:
|
||||
storage:
|
||||
class: sfSessionTestStorage
|
||||
|
||||
#all:
|
||||
# controller:
|
||||
# class: sfFrontWebController
|
||||
#
|
||||
# request:
|
||||
# class: sfWebRequest
|
||||
#
|
||||
# response:
|
||||
# class: sfWebResponse
|
||||
#
|
||||
# user:
|
||||
# class: myUser
|
||||
#
|
||||
# storage:
|
||||
# class: sfSessionStorage
|
||||
# param:
|
||||
# session_name: symfony
|
||||
#
|
||||
# view_cache:
|
||||
# class: sfFileCache
|
||||
# param:
|
||||
# automaticCleaningFactor: 0
|
||||
# cacheDir: %SF_TEMPLATE_CACHE_DIR%
|
@ -1,10 +0,0 @@
|
||||
rendering: ~
|
||||
web_debug: ~
|
||||
security: ~
|
||||
|
||||
# generally, you will want to insert your own filters here
|
||||
|
||||
cache: ~
|
||||
common: ~
|
||||
flash: ~
|
||||
execution: ~
|
@ -1,7 +0,0 @@
|
||||
#all:
|
||||
# default_culture: en
|
||||
# source: XLIFF
|
||||
# debug: off
|
||||
# cache: on
|
||||
# untranslated_prefix: "[T]"
|
||||
# untranslated_suffix: "[/T]"
|
@ -1,22 +0,0 @@
|
||||
prod:
|
||||
enabled: off
|
||||
level: err
|
||||
rotate: on
|
||||
purge: off
|
||||
|
||||
#all:
|
||||
# enabled: on
|
||||
# level: debug
|
||||
# rotate: off
|
||||
# period: 7
|
||||
# history: 10
|
||||
# purge: on
|
||||
# loggers:
|
||||
# sf_web_debug:
|
||||
# class: sfWebDebugLogger
|
||||
# param:
|
||||
# condition: %SF_WEB_DEBUG%
|
||||
# sf_file_debug:
|
||||
# class: sfFileLogger
|
||||
# param:
|
||||
# file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
|
@ -1,55 +0,0 @@
|
||||
# default rules
|
||||
homepage:
|
||||
url: /
|
||||
param: { module: main, action: index }
|
||||
|
||||
trac_register:
|
||||
url: /trac/register
|
||||
param: { module: main, action: trac_register }
|
||||
|
||||
blog:
|
||||
url: /blog
|
||||
param: { module: blog, action: index }
|
||||
|
||||
blog_post:
|
||||
url: /blog/:slug
|
||||
param: { module: blog, action: view }
|
||||
|
||||
api_documentation_page:
|
||||
url: /documentation/api/:q
|
||||
param: { module: api_documentation, action: index }
|
||||
|
||||
about:
|
||||
url: /about
|
||||
param: { module: main, action: about }
|
||||
|
||||
download:
|
||||
url: /download
|
||||
param: { module: main, action: download }
|
||||
|
||||
manual_chapter:
|
||||
url: /documentation/manual/:chapter
|
||||
param: { module: manual, action: index }
|
||||
|
||||
manual:
|
||||
url: /documentation/manual/*
|
||||
param: { module: manual, action: index }
|
||||
|
||||
api_documentation:
|
||||
url: /documentation/api
|
||||
param: { module: api_documentation, action: index }
|
||||
|
||||
trac:
|
||||
url: /trac
|
||||
param: { module: main, action: trac }
|
||||
|
||||
default_symfony:
|
||||
url: /symfony/:action/*
|
||||
param: { module: default }
|
||||
|
||||
default_index:
|
||||
url: /:module
|
||||
param: { action: index }
|
||||
|
||||
default:
|
||||
url: /:module/:action/*
|
@ -1,2 +0,0 @@
|
||||
default:
|
||||
is_secure: off
|
@ -1,102 +0,0 @@
|
||||
prod:
|
||||
.settings:
|
||||
no_script_name: on
|
||||
|
||||
dev:
|
||||
.settings:
|
||||
# E_ALL | E_STRICT = 4095
|
||||
error_reporting: 4095
|
||||
web_debug: on
|
||||
cache: off
|
||||
no_script_name: off
|
||||
etag: off
|
||||
|
||||
test:
|
||||
.settings:
|
||||
# E_ALL | E_STRICT & ~E_NOTICE = 2047
|
||||
error_reporting: 2047
|
||||
cache: off
|
||||
web_debug: off
|
||||
no_script_name: off
|
||||
etag: off
|
||||
all:
|
||||
.actions:
|
||||
default_module: default # Default module and action to be called when
|
||||
default_action: index # A routing rule doesn't set it
|
||||
|
||||
error_404_module: default # To be called when a 404 error is raised
|
||||
error_404_action: error404 # Or when the requested URL doesn't match any route
|
||||
|
||||
login_module: sfGuardAuth # To be called when a non-authenticated user
|
||||
login_action: signin # Tries to access a secure page
|
||||
|
||||
secure_module: sfGuardAuth # To be called when a user doesn't have
|
||||
secure_action: secure # The credentials required for an action
|
||||
|
||||
module_disabled_module: default # To be called when a user requests
|
||||
module_disabled_action: disabled # A module disabled in the module.yml
|
||||
|
||||
unavailable_module: default # To be called when a user requests a page
|
||||
unavailable_action: unavailable # From an application disabled via the available setting below
|
||||
|
||||
.settings:
|
||||
available: on # Enable the whole application. Switch to off to redirect all requests to the unavailable module and action.
|
||||
|
||||
# Optional features. Deactivating unused features boots performance a bit.
|
||||
use_database: on # Enable database manager. Set to off if you don't use a database.
|
||||
use_security: on # Enable security features (login and credentials). Set to off for public applications.
|
||||
use_flash: on # Enable flash parameter feature. Set to off if you never use the set_flash() method in actions.
|
||||
i18n: off # Enable interface translation. Set to off if your application should not be translated.
|
||||
check_symfony_version: off # Enable check of symfony version for every request. Set to on to have symfony clear the cache automatically when the framework is upgraded. Set to off if you always clear the cache after an upgrade.
|
||||
use_process_cache: on # Enable symfony optimizations based on PHP accelerators. Set to off for tests or when you have enabled a PHP accelerator in your server but don't want symfony to use it internally.
|
||||
compressed: off # Enable PHP response compression. Set to on to compress the outgoing HTML via the PHP handler.
|
||||
check_lock: off # Enable the application lock system triggered by the clear-cache and disable tasks. Set to on to have all requests to disabled applications redirected to the $sf_symfony_data_dir/web/arrors/unavailable.php page.
|
||||
|
||||
# Output escaping settings
|
||||
escaping_strategy: bc # Determines how variables are made available to templates. Accepted values: bc, both, on, off. The value off deactivates escaping completely and gives a slight boost.
|
||||
escaping_method: ESC_ENTITIES # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES.
|
||||
|
||||
# Routing settings
|
||||
suffix: . # Default suffix for generated URLs. If set to a single dot (.), no suffix is added. Possible values: .html, .php, and so on.
|
||||
no_script_name: off # Enable the front controller name in generated URLs
|
||||
|
||||
# Validation settings, used for error generation by the Validation helper
|
||||
validation_error_prefix: ' ↓ '
|
||||
validation_error_suffix: ' ↓'
|
||||
validation_error_class: form_error
|
||||
validation_error_id_prefix: error_for_
|
||||
|
||||
# Cache settings
|
||||
cache: off # Enable the template cache
|
||||
etag: on # Enable etag handling
|
||||
|
||||
# Logging and debugging settings
|
||||
web_debug: off # Enable the web debug toolbar
|
||||
error_reporting: 341 # Determines which events are logged. The default value is E_PARSE | E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_USER_ERROR = 341
|
||||
|
||||
# Assets paths
|
||||
rich_text_js_dir: js/tiny_mce
|
||||
prototype_web_dir: /sf/prototype
|
||||
admin_web_dir: /sf/sf_admin
|
||||
web_debug_web_dir: /sf/sf_web_debug
|
||||
|
||||
# Helpers included in all templates by default
|
||||
standard_helpers: [Partial, Cache, Form]
|
||||
|
||||
# Activated modules from plugins or from the symfony core
|
||||
enabled_modules: [default, sfGuardAuth, sfGuardRegister, sfGuardForgotPassword]
|
||||
|
||||
# Charset used for the response
|
||||
charset: utf-8
|
||||
|
||||
# Miscellaneous
|
||||
strip_comments: on # Remove comments in core framework classes as defined in the core_compile.yml
|
||||
autoloading_functions: ~ # Functions called when a class is requested and this it is not already loaded. Expects an array of callables. Used by the framework bridges.
|
||||
timeout: 1800 # Session timeout, in seconds
|
||||
max_forwards: 5
|
||||
path_info_array: SERVER
|
||||
path_info_key: PATH_INFO
|
||||
url_format: PATH
|
||||
|
||||
# ORM
|
||||
orm: propel
|
@ -1,17 +0,0 @@
|
||||
default:
|
||||
http_metas:
|
||||
content-type: text/html
|
||||
|
||||
metas:
|
||||
title: Doctrine - Open Source PHP 5 ORM
|
||||
robots: index, follow
|
||||
description: Doctrine is a Open Source OO PHP 5 ORM
|
||||
keywords: doctrine, php, database, orm
|
||||
language: en
|
||||
|
||||
stylesheets: [main, layout]
|
||||
|
||||
javascripts: []
|
||||
|
||||
has_layout: on
|
||||
layout: layout
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
class myUser extends sfGuardSecurityUser
|
||||
{
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* api_documentation actions.
|
||||
*
|
||||
* @package doctrine_website
|
||||
* @subpackage api_documentation
|
||||
* @author Your name here
|
||||
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
|
||||
*/
|
||||
class api_documentationActions extends sfActions
|
||||
{
|
||||
/**
|
||||
* Executes index action
|
||||
*
|
||||
*/
|
||||
public function executeIndex()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
default:
|
||||
stylesheets: [main, layout, api_documentation]
|
||||
layout: api_documentation_layout
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
function get_documentation($q)
|
||||
{
|
||||
$docPath = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))).DIRECTORY_SEPARATOR.'api_documentation'.DIRECTORY_SEPARATOR.'trunk';
|
||||
|
||||
if( $q )
|
||||
{
|
||||
$q = str_replace('-sep-', '/', $q);
|
||||
return get_documentation_html($docPath.'/'.$q, $q);
|
||||
} else {
|
||||
return get_documentation_html($docPath.'/index.html', $q);
|
||||
}
|
||||
}
|
||||
|
||||
function process_documentation($html, $q)
|
||||
{
|
||||
//preg_match_all('/a href="(.*)"/', $html, $matches);
|
||||
preg_match_all('/<a\s[^>]*href=\"([^\"]*)\"[^>]*>/siU', $html, $matches);
|
||||
|
||||
$matchValues = $matches[1];
|
||||
$matches = $matches[0];
|
||||
|
||||
foreach($matches AS $key => $match)
|
||||
{
|
||||
$value = $matchValues[$key];
|
||||
|
||||
if( $value[0] != '#' )
|
||||
{
|
||||
$urlQ = str_replace('../', '/', $value);
|
||||
$urlQ = str_replace('/', '-sep-', $urlQ);
|
||||
|
||||
$html = str_replace($match, '<a href="'.url_for('@api_documentation_page?q='.$urlQ).'">', $html);
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function get_documentation_html($path)
|
||||
{
|
||||
ob_start();
|
||||
if( file_exists($path) )
|
||||
{
|
||||
include($path);
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return process_documentation($html, $path);
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
use_helper('ApiDocumentation');
|
||||
|
||||
$documentation = get_documentation($sf_request->getParameter('q'));
|
||||
|
||||
echo $documentation;
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* blog actions.
|
||||
*
|
||||
* @package doctrine_website
|
||||
* @subpackage blog
|
||||
* @author Your name here
|
||||
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
|
||||
*/
|
||||
class blogActions extends sfActions
|
||||
{
|
||||
/**
|
||||
* Executes index action
|
||||
*
|
||||
*/
|
||||
public function executeIndex()
|
||||
{
|
||||
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
|
||||
|
||||
$this->latestBlogPosts = $blogPostTable->retrieveLatest(5);
|
||||
}
|
||||
|
||||
public function executeView()
|
||||
{
|
||||
$slug = $this->getRequestParameter('slug');
|
||||
|
||||
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
|
||||
|
||||
$this->blogPost = $blogPostTable->retrieveBySlug($slug);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
class blogComponents extends sfComponents
|
||||
{
|
||||
public function executeLatest_blog_posts()
|
||||
{
|
||||
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
|
||||
|
||||
$this->latestBlogPosts = $blogPostTable->retrieveLatest(5);
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php use_helper('Date'); ?>
|
||||
|
||||
<div id="latest_blog_posts">
|
||||
<h3>Latest Blog Posts</h3>
|
||||
<ul>
|
||||
<?php foreach($latestBlogPosts AS $blogPost): ?>
|
||||
<li><?php echo link_to($blogPost->getName(), '@blog_post?slug='.$blogPost->getSlug()); ?> - <?php echo distance_of_time_in_words(strtotime($blogPost->getCreatedAt())); ?> ago.</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
@ -1,18 +0,0 @@
|
||||
<?php use_helper('Date'); ?>
|
||||
|
||||
<div class="content" id="blog">
|
||||
<h1>Doctrine Blog</h2>
|
||||
|
||||
<?php foreach($latestBlogPosts AS $blogPost): ?>
|
||||
<div class="blog_post">
|
||||
<h2><?php echo link_to($blogPost->getName(), '@blog_post?slug='.$blogPost->getSlug()); ?></h2>
|
||||
<h3>Posted <?php echo distance_of_time_in_words(strtotime($blogPost->getCreatedAt())); ?> ago.</h3>
|
||||
|
||||
<p><?php echo $blogPost->getBody(); ?></p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php slot('right'); ?>
|
||||
<?php echo get_partial('latest_blog_posts', array('latestBlogPosts' => $latestBlogPosts)); ?>
|
||||
<?php end_slot(); ?>
|
@ -1,16 +0,0 @@
|
||||
<?php use_helper('Date'); ?>
|
||||
|
||||
<div class="content" id="blog_post">
|
||||
<h1><?php echo $blogPost->getName(); ?></h1>
|
||||
<h3>Posted <?php echo distance_of_time_in_words(strtotime($blogPost->getCreatedAt())); ?> ago.</h3>
|
||||
|
||||
<p><?php echo $blogPost->getBody(); ?></p>
|
||||
</div>
|
||||
|
||||
<?php slot('right'); ?>
|
||||
<input type="button" name="back_to_blog" value="Back to Blog" onClick="javascript: location.href = '<?php echo url_for('@blog'); ?>';" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<?php echo get_component('blog', 'latest_blog_posts'); ?>
|
||||
<?php end_slot(); ?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* main actions.
|
||||
*
|
||||
* @package doctrine_website
|
||||
* @subpackage main
|
||||
* @author Your name here
|
||||
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
|
||||
*/
|
||||
class mainActions extends sfActions
|
||||
{
|
||||
/**
|
||||
* Executes index action
|
||||
*
|
||||
*/
|
||||
public function executeIndex()
|
||||
{
|
||||
}
|
||||
|
||||
public function executeAbout()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function executeDownload()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function executeTrac()
|
||||
{
|
||||
$this->redirect('http://phpdoctrine.net/trac');
|
||||
}
|
||||
|
||||
public function executeTrac_register()
|
||||
{
|
||||
$this->redirect('http://phpdoctrine.net/trac/register');
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
Doctrine is an ORM (object relational mapper) for PHP 5.2.x+ that sits on top of a powerful DBAL (database abstraction layer).
|
||||
One of its key features is the ability to optionally write database queries in an OO (object oriented)
|
||||
SQL-dialect called DQL inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL
|
||||
that maintains a maximum of flexibility without requiring needless code duplication.
|
@ -1,10 +0,0 @@
|
||||
<ul>
|
||||
<li><?php echo link_to('DQL (Doctrine Query Language)', '@manual_chapter?chapter=dql-doctrine-query-language'); ?></li>
|
||||
<li><?php echo link_to('Native SQL', '@manual_chapter?chapter=native-sql'); ?></li>
|
||||
<li><?php echo link_to('Class Templates', '@manual_chapter?chapter=class-templates'); ?></li>
|
||||
<li><?php echo link_to('Hierarchical Data', '@manual_chapter?chapter=hierarchical-data'); ?></li>
|
||||
<li><?php echo link_to('Transactions', '@manual_chapter?chapter=transactions'); ?></li>
|
||||
<li><?php echo link_to('Caching', '@manual_chapter?chapter=caching'); ?></li>
|
||||
<li><?php echo link_to('Searching', '@manual_chapter?chapter=searching'); ?></li>
|
||||
<li><?php echo link_to('Plugins', '@manual_chapter?chapter=Plugins'); ?></li>
|
||||
</ul>
|
@ -1,50 +0,0 @@
|
||||
<div class="content" id="about">
|
||||
<h1>About Doctrine</h1>
|
||||
|
||||
<a name="what"></a>
|
||||
<div id="what_is">
|
||||
<h2>What is Doctrine?</h2>
|
||||
|
||||
<?php echo get_partial('main/about_paragraph'); ?>
|
||||
</div>
|
||||
|
||||
<a name="who"></a>
|
||||
<div id="who">
|
||||
<h2>Who is behind Doctrine?</h2>
|
||||
|
||||
<p>Here is a list of the people mainly responsible for Doctrine. Many other people not on this list contribute, they can be found
|
||||
<?php echo link_to('here', 'http://phpdoctrine.net/trac/wiki/developers'); ?>.</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>Konsta Vesterinen(zYne-)</strong> - Konsta is the project founder and lead developer of Doctrine.</li>
|
||||
<li><strong>Roman S. Borschel(romanb)</strong> - Assists in the development of Doctrine through suggestions and small code contributions.</li>
|
||||
<li><strong>Ian P. Christian(pookey)</strong> - Hosts trac and SVN. Helps with testing and occasionally writes a line of code.</li>
|
||||
<li><strong>Janne Vanhala(jepso)</strong> - The lead developer of the official Doctrine subproject Sensei. Creator of the documentation tool Doctrine uses.</li>
|
||||
<li><strong><?php echo mail_to('jonwage@gmail.com', 'Jonathan H. Wage'); ?></strong>(jwage) - Website, Documentation, Packaging Releases, Bug Fixes, etc</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a name="involved"></a>
|
||||
<div id="get_involved">
|
||||
<h2>Want to get involved?</h2>
|
||||
|
||||
You can contribute to the Doctrine development in many different ways. First start by <?php echo link_to('registering for trac', '@trac_register'); ?>
|
||||
access. Once you done that you can begin submitting tickets for issues/bugs you discover while working with Doctrine. If you wish to contribute directly to the code,
|
||||
you must request svn commit access in IRC from either pookey or <?php echo mail_to('jonwage@gmail.com', 'jwage'); ?>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php slot('right'); ?>
|
||||
|
||||
<h3>Quickjump</h3>
|
||||
<ul>
|
||||
<li><?php echo link_to('What?', '@about#what'); ?></li>
|
||||
<li><?php echo link_to('Who?', '@about#who'); ?></li>
|
||||
<li><?php echo link_to('Get Involved!', '@about#involved'); ?></li>
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
|
||||
<h3>Key Features</h3>
|
||||
<?php echo get_partial('main/key_features_list'); ?>
|
||||
<?php end_slot(); ?>
|
@ -1,14 +0,0 @@
|
||||
<div class="content" id="download">
|
||||
<h1>Download Doctrine</h1>
|
||||
|
||||
<div id="package">
|
||||
<h3>Latest Package</h3>
|
||||
|
||||
<p><a href="http://doctrine.pengus.net/trac/attachment/wiki/packages/Doctrine-1.0.0RC1.tgz?format=raw">Doctrine-1.0.0RC1.tgz</a></p>
|
||||
</div>
|
||||
|
||||
<div id="svn">
|
||||
<h3>SVN</h3>
|
||||
<p>svn co http://doctrine.pengus.net/svn/trunk .</p>
|
||||
</div>
|
||||
</div>
|
@ -1,21 +0,0 @@
|
||||
<div class="content" id="homepage">
|
||||
<h1>Doctrine - Open Source PHP 5 ORM</h1>
|
||||
|
||||
<p><?php echo get_partial('main/about_paragraph'); ?></p>
|
||||
|
||||
<div id="key_features">
|
||||
<h3>Key Features</h3>
|
||||
<?php echo get_partial('main/key_features_list'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php slot('right'); ?>
|
||||
<div id="download_latest_release">
|
||||
<h3>Download Latest Release</h3>
|
||||
<ul>
|
||||
<li><a href="http://doctrine.pengus.net/trac/attachment/wiki/packages/Doctrine-1.0.0RC1.tgz?format=raw">Doctrine-1.0.0RC1.tgz</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php echo get_component('blog', 'latest_blog_posts'); ?>
|
||||
<?php end_slot(); ?>
|
@ -1,306 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Returns the revision of a SVN controlled file.
|
||||
*
|
||||
* The revision is acquired by executing the 'svn info' command for the file and
|
||||
* parsing the last changed revision from the output.
|
||||
*
|
||||
* @param $file string filename
|
||||
* @return int|false revision of the file, or false on failure
|
||||
*/
|
||||
function getSvnRevision($file)
|
||||
{
|
||||
$cmd = 'HOME=/tmp /usr/bin/svn info ' . escapeshellarg($file);
|
||||
exec($cmd, $output);
|
||||
foreach ($output as $line) {
|
||||
if (preg_match('/^Last Changed Rev: ([0-9]+)$/', $line, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a Doctrine_Cache_Db and suppresses all exceptions thrown by caching
|
||||
* operations. Uses Sqlite as database backend.
|
||||
*/
|
||||
class Cache
|
||||
{
|
||||
protected $_cache = null;
|
||||
|
||||
/**
|
||||
* Constructs a cache object.
|
||||
*
|
||||
* If cache table does not exist, creates one.
|
||||
*
|
||||
* @param $cacheFile string filename of the sqlite database
|
||||
*/
|
||||
public function __construct($cacheFile)
|
||||
{
|
||||
try {
|
||||
$dsn = 'sqlite:' . $cacheFile;
|
||||
$dbh = new PDO($dsn);
|
||||
$conn = Doctrine_Manager::connection($dbh);
|
||||
|
||||
$options = array(
|
||||
'connection' => $conn,
|
||||
'tableName' => 'cache'
|
||||
);
|
||||
|
||||
$this->_cache = new Doctrine_Cache_Db($options);
|
||||
|
||||
try {
|
||||
$this->_cache->createTable();
|
||||
} catch (Doctrine_Connection_Exception $e) {
|
||||
if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
|
||||
$this->_cache = null;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->_cache = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a cache record from cache.
|
||||
*
|
||||
* @param $id string the id of the cache record
|
||||
* @return string fetched cache record, or false on failure
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
if ($this->_cache !== null) {
|
||||
try {
|
||||
return $this->_cache->fetch($id);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a cache record to cache.
|
||||
*
|
||||
* @param $data mixed the data to be saved to cache
|
||||
* @param $id string the id of the cache record
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function save($data, $id)
|
||||
{
|
||||
if ($this->_cache !== null) {
|
||||
try {
|
||||
return $this->_cache->save($data, $id);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all cached records from cache.
|
||||
*
|
||||
* @return True on success, false on failure
|
||||
*/
|
||||
public function deleteAll()
|
||||
{
|
||||
if ($this->_cache !== null) {
|
||||
try {
|
||||
return $this->_cache->deleteAll();
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* manual actions.
|
||||
*
|
||||
* @package doctrine_website
|
||||
* @subpackage manual
|
||||
* @author Your name here
|
||||
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
|
||||
*/
|
||||
class manualActions extends sfActions
|
||||
{
|
||||
/**
|
||||
* Executes index action
|
||||
*
|
||||
*/
|
||||
public function executeIndex()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$trunk = dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
|
||||
$vendorPath = $trunk.DIRECTORY_SEPARATOR.'vendor';
|
||||
$manualPath = $trunk.DIRECTORY_SEPARATOR.'manual';
|
||||
$doctrinePath = $trunk.DIRECTORY_SEPARATOR.'lib';
|
||||
|
||||
$includePath = $doctrinePath.PATH_SEPARATOR.$vendorPath.PATH_SEPARATOR.$manualPath.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.'lib';
|
||||
|
||||
set_include_path($includePath);
|
||||
|
||||
require_once('Sensei/Sensei.php');
|
||||
require_once('Text/Wiki.php');
|
||||
|
||||
spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
spl_autoload_register(array('Sensei', 'autoload'));
|
||||
|
||||
// Temporary directory used by cache and LaTeX to Pdf conversion
|
||||
$tempDir = $manualPath.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.'tmp';
|
||||
|
||||
// The file where cached data is saved
|
||||
$cacheFile = $tempDir.DIRECTORY_SEPARATOR.'cache.sq3';
|
||||
|
||||
$cache = new Cache($cacheFile);
|
||||
|
||||
// Fetch the revision of cached data
|
||||
$cacheRev = $cache->fetch('revision');
|
||||
|
||||
// Check the revision of documentation files
|
||||
$revision = getSvnRevision('.');
|
||||
|
||||
// Is current SVN revision greater than the revision of cached data?
|
||||
if ($revision > $cacheRev) {
|
||||
$cache->deleteAll(); // cached data is not valid anymore
|
||||
$cache->save($revision, 'revision');
|
||||
}
|
||||
|
||||
// Load table of contents from cache
|
||||
$this->toc = $cache->fetch('toc');
|
||||
|
||||
// If table of contents was not cached, parse it from documentation files
|
||||
if ( ! $this->toc instanceof Sensei_Doc_Toc) {
|
||||
$this->toc = new Sensei_Doc_Toc($manualPath.'/new/docs/en.txt');
|
||||
$cache->save($this->toc, 'toc');
|
||||
}
|
||||
|
||||
$format = $this->getRequestParameter('format');
|
||||
|
||||
// Which format to output docs
|
||||
if ($format) {
|
||||
$format = ucfirst(strtolower($format));
|
||||
|
||||
switch ($format) {
|
||||
case 'Xhtml':
|
||||
case 'Latex':
|
||||
case 'Pdf':
|
||||
break;
|
||||
default:
|
||||
$format = 'Xhtml'; // default if invalid format is specified
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
$format = 'Xhtml'; // default if no format is specified
|
||||
}
|
||||
|
||||
$this->rendererClass = 'Sensei_Doc_Renderer_' . $format;
|
||||
$this->renderer = new $this->rendererClass($this->toc);
|
||||
|
||||
$this->renderer->setOptions(array(
|
||||
'title' => 'Doctrine Manual',
|
||||
'author' => 'Konsta Vesterinen',
|
||||
'version' => 'Rev. ' . $revision,
|
||||
'subject' => 'Object relational mapping',
|
||||
'keywords' => 'PHP, ORM, object relational mapping, Doctrine, database'
|
||||
));
|
||||
|
||||
$cacheId = $format;
|
||||
|
||||
switch ($format) {
|
||||
case 'Latex':
|
||||
$this->renderer->setOption('template', file_get_contents($manualPath.'/new/templates/latex.tpl.php'));
|
||||
|
||||
$headers = array(
|
||||
'Content-Type: application/latex',
|
||||
'Content-Disposition: attachment; filename=doctrine-manual.tex'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Pdf':
|
||||
$this->renderer->setOption('template', file_get_contents($manualPath.'/new/templates/latex.tpl.php'));
|
||||
|
||||
$this->renderer->setOptions(array(
|
||||
'temp_dir' => $tempDir,
|
||||
'pdflatex_path' => '/usr/bin/pdflatex',
|
||||
'lock' => true
|
||||
));
|
||||
|
||||
$headers = array(
|
||||
'Content-Type: application/pdf',
|
||||
'Content-Disposition: attachment; filename=doctrine-manual.pdf'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Xhtml':
|
||||
default:
|
||||
$this->renderer->setOption('template', file_get_contents(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'templates/xhtml.tpl.php'));
|
||||
|
||||
$viewIndex = true;
|
||||
|
||||
if ($this->getRequest()->hasParameter('one-page')) {
|
||||
$viewIndex = false;
|
||||
}
|
||||
|
||||
if ($this->getRequest()->hasParameter('chapter')) {
|
||||
$section = $this->toc->findByPath($this->getRequestParameter('chapter'));
|
||||
|
||||
if ($section && $section->getLevel() === 1) {
|
||||
$title = $this->renderer->getOption('title') . ' - Chapter '
|
||||
. $section->getIndex() . ' ' . $section->getName();
|
||||
|
||||
$this->renderer->setOptions(array(
|
||||
'section' => $section,
|
||||
'url_prefix' => '?chapter=',
|
||||
'title' => $title
|
||||
));
|
||||
|
||||
$cacheId .= '-' . $section->getPath();
|
||||
$viewIndex = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (isset($viewIndex) && $viewIndex) {
|
||||
|
||||
$title = $this->renderer->getOption('title');
|
||||
$this->title = $title;
|
||||
|
||||
$this->renderer->setOption('url_prefix', '?one-page');
|
||||
} else {
|
||||
$this->output = $cache->fetch($cacheId);
|
||||
|
||||
if ($this->output === false) {
|
||||
try {
|
||||
$this->output = $this->renderer->render();
|
||||
} catch (Exception $e) {
|
||||
die($e->getMessage());
|
||||
}
|
||||
$cache->save($this->output, $cacheId);
|
||||
}
|
||||
|
||||
if (isset($headers)) {
|
||||
foreach ($headers as $header) {
|
||||
header($header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( $format == 'Latex' OR $format == 'Pdf' )
|
||||
{
|
||||
echo $this->output;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
default:
|
||||
stylesheets: [main, layout, manual]
|
||||
javascripts: [mootools.v1.11.js, manual_tree]
|
||||
layout: manual_layout
|
@ -1,22 +0,0 @@
|
||||
<div class="content">
|
||||
<h1><?php echo link_to('Doctrine Manual', '@manual'); ?></h1>
|
||||
</div>
|
||||
|
||||
<div class="content" id="manual">
|
||||
<?php if( isset($output) ): ?>
|
||||
<?php echo $output; ?>
|
||||
<?php else: ?>
|
||||
<p>There are several different versions of this manual available online:
|
||||
<ul>
|
||||
<li>View as <a href="?one-page">all chapters in one page</a>.</li>
|
||||
<li>View as <a href="?chapter=<?php echo $toc->findByIndex('1.')->getPath(); ?>">one chapter per page</a>.</li>
|
||||
<li>Download the <a href="?format=pdf">PDF version</a>.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php slot('right'); ?>
|
||||
<h2>Table of Contents</h2>
|
||||
<?php echo $renderer->renderToc(); ?>
|
||||
<?php end_slot(); ?>
|
@ -1 +0,0 @@
|
||||
%CONTENT%
|
@ -1 +0,0 @@
|
||||
<h1>Copyright Doctrine 2006-2007 - Powered by <?php echo link_to('symfony', 'http://www.symfony-project.com', 'target=_BLANK'); ?> and sponsored by <?php echo link_to('CentreSource', 'http://www.centresource.com', 'target=_BLANK'); ?></h1>
|
@ -1,2 +0,0 @@
|
||||
<h1><?php echo link_to('Doctrine', '@homepage'); ?></h1>
|
||||
<h2>$follow->the('doctrine');</h2>
|
@ -1,9 +0,0 @@
|
||||
<ul>
|
||||
<li id="first"><?php echo link_to('home', '@homepage'); ?></li>
|
||||
<li><?php echo link_to('about', '@about'); ?></li>
|
||||
<li><?php echo link_to('download', '@download'); ?></li>
|
||||
<li><?php echo link_to('manual', '@manual'); ?></li>
|
||||
<li><?php echo link_to('api docs', '@api_documentation'); ?></li>
|
||||
<li><?php echo link_to('blog', '@blog'); ?></li>
|
||||
<li id="last"><?php echo link_to('trac', '@trac'); ?></li>
|
||||
</ul>
|
@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<?php include_http_metas() ?>
|
||||
<?php include_metas() ?>
|
||||
|
||||
<?php include_title() ?>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<?php echo get_partial('global/header'); ?>
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
<?php echo get_partial('global/menu'); ?>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
|
||||
</div>
|
||||
|
||||
<?php echo $sf_data->getRaw('sf_content') ?>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo get_partial('global/footer'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,44 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<?php include_http_metas() ?>
|
||||
<?php include_metas() ?>
|
||||
|
||||
<?php include_title() ?>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<?php echo get_partial('global/header'); ?>
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
<?php echo get_partial('global/menu'); ?>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
|
||||
</div>
|
||||
|
||||
<?php if( has_slot('right') ): ?>
|
||||
<div id="right">
|
||||
<?php echo get_slot('right'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="content">
|
||||
<?php echo $sf_data->getRaw('sf_content') ?>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo get_partial('global/footer'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<?php include_http_metas() ?>
|
||||
<?php include_metas() ?>
|
||||
|
||||
<?php include_title() ?>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
<?php include_stylesheets() ?>
|
||||
|
||||
<!--[if gte IE 5.5]>
|
||||
<![if lt IE 7]>
|
||||
<?php echo stylesheet_tag('manual_iefix') ?>
|
||||
<![endif]>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="header">
|
||||
<?php echo get_partial('global/header'); ?>
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
<?php echo get_partial('global/menu'); ?>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
|
||||
</div>
|
||||
|
||||
<?php if( has_slot('right') ): ?>
|
||||
<div id="right">
|
||||
<?php echo get_slot('right'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="content">
|
||||
<?php echo $sf_data->getRaw('sf_content') ?>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<?php echo get_partial('global/footer'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
// symfony directories
|
||||
$sf_symfony_lib_dir = '/usr/local/php5/lib/php/symfony';
|
||||
$sf_symfony_data_dir = '/usr/local/php5/lib/php/data/symfony';
|
@ -1,5 +0,0 @@
|
||||
#all:
|
||||
# doctrine:
|
||||
# class: sfDoctrineDatabase
|
||||
# param:
|
||||
# dsn: mysql://user:pass@localhost/doctrine
|
@ -1,22 +0,0 @@
|
||||
---
|
||||
BlogPost:
|
||||
tableName: blog_post
|
||||
columns:
|
||||
id:
|
||||
type: integer
|
||||
size: 4
|
||||
primary: true
|
||||
autoincrement: true
|
||||
created_at:
|
||||
type: timestamp
|
||||
updated_at:
|
||||
type: timestamp
|
||||
name:
|
||||
type: string
|
||||
size: 255
|
||||
slug:
|
||||
type: string
|
||||
size: 255
|
||||
unique: true
|
||||
body:
|
||||
type: clob
|
@ -1,2 +0,0 @@
|
||||
[symfony]
|
||||
name=doctrine_website
|
@ -1,4 +0,0 @@
|
||||
.svn
|
||||
/web/uploads/*
|
||||
/cache/*
|
||||
/log/*
|
@ -1,5 +0,0 @@
|
||||
INSERT INTO `blog_post` (`id`, `created_at`, `updated_at`, `name`, `slug`, `body`) VALUES
|
||||
(1, '2007-09-06 11:37:00', '2007-09-06 11:41:06', 'Test Blog Post', 'test-blog-post', 'This is a test blog post!!');
|
||||
|
||||
INSERT INTO `sf_guard_user` (`id`, `created_at`, `updated_at`, `username`, `algorithm`, `salt`, `password`, `last_login`, `is_active`, `is_super_admin`) VALUES
|
||||
(1, '2007-09-06 11:25:14', '2007-09-06 11:25:36', 'admin', 'sha1', '9dc8c66967e1bfb0e25884958a209796', '9861d585ef106d4eef607a86ad451696a926b5d3', '2007-09-06 11:25:36', 1, 1);
|
@ -1,63 +0,0 @@
|
||||
CREATE TABLE sf_guard_user_permission(
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
user_id INTEGER,
|
||||
permission_id INTEGER,
|
||||
PRIMARY KEY(user_id,
|
||||
permission_id));
|
||||
|
||||
CREATE TABLE sf_guard_user_group(
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
group_id INTEGER,
|
||||
user_id INTEGER,
|
||||
PRIMARY KEY(group_id,
|
||||
user_id));
|
||||
|
||||
CREATE TABLE sf_guard_user(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
username VARCHAR(128)
|
||||
NOT NULL,
|
||||
algorithm VARCHAR(128)
|
||||
DEFAULT 'sha1' NOT NULL,
|
||||
salt VARCHAR(128)
|
||||
NOT NULL,
|
||||
password VARCHAR(128)
|
||||
NOT NULL,
|
||||
last_login DATETIME,
|
||||
is_active INTEGER DEFAULT 1 NOT NULL,
|
||||
is_super_admin INTEGER DEFAULT 0 NOT NULL);
|
||||
|
||||
CREATE TABLE sf_guard_remember_key(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
user_id INTEGER,
|
||||
remember_key VARCHAR(32),
|
||||
ip_address VARCHAR(15));
|
||||
|
||||
CREATE TABLE sf_guard_permission(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
name VARCHAR(255)
|
||||
NOT NULL,
|
||||
description VARCHAR(4000));
|
||||
|
||||
CREATE TABLE sf_guard_group_permission(
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
group_id INTEGER,
|
||||
permission_id INTEGER NOT NULL,
|
||||
PRIMARY KEY(group_id,
|
||||
permission_id));
|
||||
|
||||
CREATE TABLE sf_guard_group(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
created_at DATETIME,
|
||||
updated_at DATETIME,
|
||||
name VARCHAR(255)
|
||||
NOT NULL,
|
||||
description VARCHAR(4000));
|
@ -1 +0,0 @@
|
||||
;
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
class Common
|
||||
{
|
||||
public static function createSlug($text)
|
||||
{
|
||||
$text = strtolower($text);
|
||||
|
||||
// strip all non word chars
|
||||
$text = preg_replace('/\W/', ' ', $text);
|
||||
|
||||
// replace all white space sections with a dash
|
||||
$text = preg_replace('/\ +/', '-', $text);
|
||||
|
||||
// trim dashes
|
||||
$text = preg_replace('/\-$/', '', $text);
|
||||
$text = preg_replace('/^\-/', '', $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BlogPost extends BaseBlogPost
|
||||
{
|
||||
public function filterSetName($name)
|
||||
{
|
||||
$this->setSlug(Common::createSlug($name));
|
||||
|
||||
return $name;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BlogPostTable extends Doctrine_Table
|
||||
{
|
||||
public function retrieveLatest($num)
|
||||
{
|
||||
$query = new Doctrine_Query();
|
||||
$query->from('BlogPost p');
|
||||
$query->limit($num);
|
||||
$query->orderby('p.created_at DESC');
|
||||
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
public function retrieveBySlug($slug)
|
||||
{
|
||||
$query = new Doctrine_Query();
|
||||
$query->from('BlogPost p');
|
||||
$query->where('p.slug = ?', $slug);
|
||||
$query->limit(1);
|
||||
|
||||
return $query->execute()->getFirst();
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BaseBlogPost extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('blog_post');
|
||||
|
||||
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('name', 'string', 255, array ());
|
||||
$this->hasColumn('slug', 'string', 255, array ( 'unique' => true,));
|
||||
$this->hasColumn('body', 'clob', null, array ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardGroup extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_group');
|
||||
|
||||
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('name', 'string', 255, array ( 'notnull' => true,));
|
||||
$this->hasColumn('description', 'string', 4000, array ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasMany('sfGuardUser as users', array('refClass' => 'sfGuardUserGroup', 'local' => 'group_id', 'foreign' => 'user_id'));
|
||||
$this->hasMany('sfGuardPermission as permissions', array('refClass' => 'sfGuardGroupPermission', 'local' => 'group_id', 'foreign' => 'permission_id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardGroupPermission extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_group_permission');
|
||||
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('group_id', 'integer', 4, array ( 'primary' => true,));
|
||||
$this->hasColumn('permission_id', 'integer', 4, array ( 'notnull' => true, 'primary' => true,));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('sfGuardGroup as sfGuardGroup', array('local' => 'group_id', 'foreign' => 'id'));
|
||||
$this->hasOne('sfGuardPermission as sfGuardPermission', array('local' => 'permission_id', 'foreign' => 'id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardPermission extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_permission');
|
||||
|
||||
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('name', 'string', 255, array ( 'notnull' => true,));
|
||||
$this->hasColumn('description', 'string', 4000, array ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasMany('sfGuardUser as users', array('refClass' => 'sfGuardUserPermission', 'local' => 'permission_id', 'foreign' => 'user_id'));
|
||||
$this->hasMany('sfGuardGroup as groups', array('refClass' => 'sfGuardGroupPermission', 'local' => 'permission_id', 'foreign' => 'group_id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardRememberKey extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_remember_key');
|
||||
|
||||
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
||||
$this->hasColumn('remember_key', 'string', 32, array ());
|
||||
$this->hasColumn('ip_address', 'string', 15, array ( 'primary' => true,));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('sfGuardUser as user', array('local' => 'user_id', 'foreign' => 'id', 'onDelete' => 'CASCADE'));
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardUser extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_user');
|
||||
|
||||
$this->hasColumn('id', 'integer', 4, array ( 'primary' => true, 'autoincrement' => true,));
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('username', 'string', 128, array ( 'notnull' => true,));
|
||||
$this->hasColumn('algorithm', 'string', 128, array ( 'default' => 'sha1', 'notnull' => true,));
|
||||
$this->hasColumn('salt', 'string', 128, array ( 'notnull' => true,));
|
||||
$this->hasColumn('password', 'string', 128, array ( 'notnull' => true,));
|
||||
$this->hasColumn('last_login', 'timestamp', null, array ());
|
||||
$this->hasColumn('is_active', 'boolean', null, array ( 'default' => 1, 'notnull' => true,));
|
||||
$this->hasColumn('is_super_admin', 'boolean', null, array ( 'default' => 0, 'notnull' => true,));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasMany('sfGuardGroup as groups', array('refClass' => 'sfGuardUserGroup', 'local' => 'user_id', 'foreign' => 'group_id'));
|
||||
$this->hasMany('sfGuardPermission as permissions', array('refClass' => 'sfGuardUserPermission', 'local' => 'user_id', 'foreign' => 'permission_id'));
|
||||
$this->hasMany('sfGuardRememberKey as remember_key', array('local' => 'id', 'foreign' => 'user_id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardUserGroup extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_user_group');
|
||||
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('group_id', 'integer', 4, array ( 'primary' => true,));
|
||||
$this->hasColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('sfGuardGroup as sfGuardGroup', array('local' => 'group_id', 'foreign' => 'id'));
|
||||
$this->hasOne('sfGuardUser as sfGuardUser', array('local' => 'user_id', 'foreign' => 'id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Base class; DO NOT EDIT
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class BasesfGuardUserPermission extends sfDoctrineRecord
|
||||
{
|
||||
|
||||
|
||||
public function setTableDefinition()
|
||||
{
|
||||
$this->setTableName('sf_guard_user_permission');
|
||||
|
||||
$this->hasColumn('created_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('updated_at', 'timestamp', null, array ());
|
||||
$this->hasColumn('user_id', 'integer', 4, array ( 'primary' => true,));
|
||||
$this->hasColumn('permission_id', 'integer', 4, array ( 'primary' => true,));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('sfGuardUser as sfGuardUser', array('local' => 'user_id', 'foreign' => 'id'));
|
||||
$this->hasOne('sfGuardPermission as sfGuardPermission', array('local' => 'permission_id', 'foreign' => 'id'));
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardGroup extends PluginsfGuardGroup
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardGroupPermission extends PluginsfGuardGroupPermission
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardGroupPermissionTable extends PluginsfGuardGroupPermissionTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardGroupTable extends PluginsfGuardGroupTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardPermission extends PluginsfGuardPermission
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardPermissionTable extends PluginsfGuardPermissionTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardRememberKey extends PluginsfGuardRememberKey
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardRememberKeyTable extends PluginsfGuardRememberKeyTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUser extends PluginsfGuardUser
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUserGroup extends PluginsfGuardUserGroup
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUserGroupTable extends PluginsfGuardUserGroupTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model class
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUserPermission extends PluginsfGuardUserPermission
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUserPermissionTable extends PluginsfGuardUserPermissionTable
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Edit this file to customise your model table
|
||||
*
|
||||
* auto-generated by the sfDoctrine plugin
|
||||
*/
|
||||
class sfGuardUserTable extends PluginsfGuardUserTable
|
||||
{
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
Copyright (c) 2004-2006 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,25 +0,0 @@
|
||||
sfDoctrine symfony plugin
|
||||
=========================
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
The sfDoctrine plugin allows you to totally replace propel with doctrine (http://www.phpdoctrine.com/) which is a powerful and easy-to-use ORM.
|
||||
|
||||
|
||||
Contents
|
||||
--------
|
||||
|
||||
This plugin contains:
|
||||
- necessary tools to use doctrine: the main tool is sfDoctrine::getTable() which will allow you to send queries
|
||||
- pake tasks that convert between doctrine and propel schema formats and build doctrine model classes automatically
|
||||
- an admin generator: to use it just specify sfDoctrineAdmin as the main class in your generator.yml config
|
||||
|
||||
You will find more information in the wiki page dedicated to sfDoctrine: http://www.symfony-project.com/trac/wiki/sfDoctrine.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
@ -1,502 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineClassSchema.class.php 4696 2007-07-20 17:04:44Z gnat $
|
||||
*/
|
||||
|
||||
class sfDoctrineClassSchema
|
||||
{
|
||||
// the table associated to this class
|
||||
protected $table;
|
||||
|
||||
// class name
|
||||
protected $phpName;
|
||||
|
||||
// list of columns
|
||||
protected $columns = array();
|
||||
|
||||
// list of relations (foreign keys) linking to this class
|
||||
protected $many = array();
|
||||
|
||||
// inheritance description
|
||||
protected $inheritance = array();
|
||||
|
||||
// i18n description
|
||||
protected $i18n = array();
|
||||
|
||||
// indexes
|
||||
protected $indexes = array();
|
||||
|
||||
// Uniques
|
||||
protected $uniques = array();
|
||||
|
||||
// options
|
||||
protected $options = array();
|
||||
|
||||
public function __construct($name, array $cd = array())
|
||||
{
|
||||
$this->setPhpName($name);
|
||||
|
||||
// elementary key verification
|
||||
$illegalKeys = array_diff_key($cd, array_flip(array('columns', 'tableName', 'inheritance', 'i18n', 'indexes', 'uniques', 'options')));
|
||||
|
||||
if ($illegalKeys)
|
||||
throw new sfDoctrineSchemaException(sprintf('Invalid key "%s" in description of class "%s"', array_shift(array_keys($illegalKeys)), $name));
|
||||
|
||||
if (isset($cd['inheritance']))
|
||||
{
|
||||
$this->setInheritance($cd['inheritance']);
|
||||
}
|
||||
|
||||
// set i18n
|
||||
if (isset($cd['i18n']))
|
||||
$this->setI18n($cd['i18n']);
|
||||
|
||||
// add indexes
|
||||
if (isset($cd['indexes']))
|
||||
$this->addIndexes($cd['indexes']);
|
||||
|
||||
// add uniques
|
||||
if (isset($cd['uniques']))
|
||||
$this->addUniques($cd['uniques']);
|
||||
|
||||
// add options
|
||||
if (isset($cd['options']))
|
||||
$this->addOptions($cd['options']);
|
||||
|
||||
// add columns
|
||||
if (isset($cd['columns']))
|
||||
foreach ($cd['columns'] as $colName => $column)
|
||||
{
|
||||
$docCol = new sfDoctrineColumnSchema($colName, $column);
|
||||
$this->addColumn($docCol);
|
||||
}
|
||||
}
|
||||
|
||||
// add a column if none with the same name is already there
|
||||
public function addColumn($docCol)
|
||||
{
|
||||
if (isset($this->columns[$docCol->getName()]))
|
||||
return;
|
||||
|
||||
// sets up the possible relation for that column
|
||||
$docCol->setUpForeignRelation($this->getPhpName());
|
||||
|
||||
$this->columns[$docCol->getName()] = $docCol;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
// for testing only
|
||||
public function getColumn($colName)
|
||||
{
|
||||
if (!isset($this->columns[$colName]))
|
||||
throw new sfDoctrineSchemaException(sprintf('Column "%s" is not defined', $colName));
|
||||
return $this->columns[$colName];
|
||||
}
|
||||
|
||||
public function addToMany($relation)
|
||||
{
|
||||
$this->many[] = $relation;
|
||||
}
|
||||
|
||||
public function getPhpName()
|
||||
{
|
||||
return $this->phpName;
|
||||
}
|
||||
|
||||
public function setPhpName($newName)
|
||||
{
|
||||
$this->phpName = $newName;
|
||||
}
|
||||
|
||||
public function setTable($table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
public function getTable()
|
||||
{
|
||||
if (!$this->hasTable())
|
||||
throw new sfDoctrineSchemaException(sprintf('Table not defined for class "%s"', $this->getPhpName()));
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->getTable()->getName();
|
||||
}
|
||||
|
||||
public function hasTable()
|
||||
{
|
||||
return isset($this->table);
|
||||
}
|
||||
|
||||
public function setI18n($i18n)
|
||||
{
|
||||
$check = array('class', 'cultureField');
|
||||
foreach ($check as $key)
|
||||
if (!isset($i18n[$key]))
|
||||
throw new sfDoctrineSchemaException(sprintf('The key "%s" is missing from the i18n information for class "%s".', $key, $this->getPhpName()));
|
||||
$this->i18n = $i18n;
|
||||
}
|
||||
|
||||
public function hasI18n()
|
||||
{
|
||||
return !empty($this->i18n);
|
||||
}
|
||||
|
||||
public function getI18n($key)
|
||||
{
|
||||
return $this->i18n[$key];
|
||||
}
|
||||
|
||||
public function setInheritance($inh)
|
||||
{
|
||||
$check = array('extends');
|
||||
if (isset($inh['keyField']) || isset($inh['keyValue']))
|
||||
$check = array_merge($check, array('keyField', 'keyValue'));
|
||||
elseif (isset($inh['keyFields']))
|
||||
$check = array_merge($check, array('keyFields'));
|
||||
|
||||
foreach ($check as $key)
|
||||
if (!isset($inh[$key]))
|
||||
throw new sfDoctrineSchemaException(sprintf('The key "%s" is missing from the inheritance information for class "%s".', $key, $this->getPhpName()));
|
||||
$this->inheritance = $inh;
|
||||
}
|
||||
|
||||
public function getInheritance()
|
||||
{
|
||||
return $this->inheritance;
|
||||
}
|
||||
|
||||
public function hasOneTableInheritance()
|
||||
{
|
||||
if ($inh = $this->inheritance)
|
||||
if (isset($inh['keyValue']) || isset($inh['keyFields']))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function addOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function hasOptions()
|
||||
{
|
||||
return count($this->options) ? true : false;
|
||||
}
|
||||
|
||||
public function getIndexes()
|
||||
{
|
||||
return $this->indexes;
|
||||
}
|
||||
|
||||
public function addIndexes($indexes)
|
||||
{
|
||||
$this->indexes = $indexes;
|
||||
}
|
||||
|
||||
public function hasIndexes()
|
||||
{
|
||||
return count($this->indexes) ? true : false;
|
||||
}
|
||||
|
||||
public function addUniques($uniques)
|
||||
{
|
||||
$this->uniques = $uniques;
|
||||
}
|
||||
|
||||
public function hasUniques()
|
||||
{
|
||||
return count($this->uniques) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getParentClassName()
|
||||
{
|
||||
return $this->inheritance['extends'];
|
||||
}
|
||||
|
||||
// generates the name of the generated class
|
||||
public function basePhpName($name = null)
|
||||
{
|
||||
if (!$name)
|
||||
$name = $this->getPhpName();
|
||||
return 'Base'.$name;
|
||||
}
|
||||
|
||||
// outputs a function in php
|
||||
public static function outputFunction($functionName, $contents, $phpdoc = '')
|
||||
{
|
||||
if (is_array($contents))
|
||||
$contents = implode("\n ", $contents);
|
||||
return "
|
||||
$phpdoc
|
||||
public function $functionName()
|
||||
{
|
||||
$contents
|
||||
}
|
||||
";
|
||||
}
|
||||
|
||||
// output a class in php
|
||||
public static function outputClass($className, $extends, $contents, $phpdoc = '')
|
||||
{
|
||||
$signature = sprintf("auto-generated by the sfDoctrine plugin");
|
||||
return "<?php
|
||||
/*
|
||||
* $phpdoc
|
||||
*
|
||||
* $signature
|
||||
*/
|
||||
class $className extends $extends
|
||||
{
|
||||
$contents
|
||||
}
|
||||
";
|
||||
}
|
||||
|
||||
public function getRelation($columnName)
|
||||
{
|
||||
return $this->columns[$columnName]->getRelation();
|
||||
}
|
||||
|
||||
// this function returns an array ('className'=><class name>, 'source'=><class file contents>, 'base'=>true/false) of PHP classes
|
||||
// corresponding to this class
|
||||
public function asPHP()
|
||||
{
|
||||
$classes = array();
|
||||
|
||||
// main base class
|
||||
$out = array();
|
||||
|
||||
$tableDef = array();
|
||||
$setup = array();
|
||||
|
||||
// if that class inherits from another we call the parent methods
|
||||
if ($this->inheritance)
|
||||
{
|
||||
$tableDef[] = "parent::setTableDefinition();\n";
|
||||
$setup[] = "parent::setUp();\n";
|
||||
}
|
||||
|
||||
// if it is a table we define the table name
|
||||
if ($this->hasTable())
|
||||
{
|
||||
$tableDef[] = "\$this->setTableName('{$this->getTableName()}');\n";
|
||||
}
|
||||
|
||||
foreach ($this->columns as $column)
|
||||
{
|
||||
$args = array();
|
||||
|
||||
$tableDef[] = $column->asPhp();
|
||||
}
|
||||
|
||||
// declare indexes if any
|
||||
foreach ($this->indexes as $name => $value)
|
||||
{
|
||||
// only write option if value is set
|
||||
if(!empty($value))
|
||||
{
|
||||
$valueExport = is_array($value) ? var_export($value, true) : "'$value'";
|
||||
$tableDef[] = "\$this->index('$name', $valueExport);";
|
||||
}
|
||||
}
|
||||
|
||||
// declare uniques if any
|
||||
foreach ($this->uniques as $name => $value)
|
||||
{
|
||||
// only write option if value is set
|
||||
if(!empty($value))
|
||||
{
|
||||
$valueExport = is_array($value) ? var_export($value, true) : "'$value'";
|
||||
$tableDef[] = "\$this->unique('$name', $valueExport);";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->options as $name => $value)
|
||||
{
|
||||
// only write option if value is set
|
||||
if(!empty($value))
|
||||
{
|
||||
$valueExport = is_array($value) ? var_export($value, true) : "'$value'";
|
||||
$tableDef[] = "\$this->option('$name', $valueExport);";
|
||||
}
|
||||
}
|
||||
|
||||
$out[] = self::outputFunction('setTableDefinition', $tableDef);
|
||||
|
||||
// has/own one
|
||||
foreach($this->columns as $col)
|
||||
if ($rel = $col->getRelation())
|
||||
{
|
||||
$setup[] = $rel->asOnePhp();
|
||||
}
|
||||
|
||||
// has/own many
|
||||
foreach($this->many as $rel)
|
||||
{
|
||||
$setup[] = $rel->asManyPhp();
|
||||
}
|
||||
|
||||
// declare inheritance if needed
|
||||
if ($this->hasOneTableInheritance())
|
||||
{
|
||||
$inh = $this->getInheritance();
|
||||
if (isset($inh['keyFields']))
|
||||
{
|
||||
$keyFields = $inh['keyFields'];
|
||||
$keyFields = is_array($keyFields) ? $keyFields : array($keyFields);
|
||||
}
|
||||
else
|
||||
$keyFields = array($inh['keyField'] => $inh['keyValue']);
|
||||
|
||||
$setup[] = '$this->setInheritanceMap('.var_export($keyFields, true).');';
|
||||
}
|
||||
|
||||
// declare i18n if any
|
||||
if ($this->hasI18n())
|
||||
$setup[] = "\$this->hasI18nTable('{$this->getI18n('class')}', '{$this->getI18n('cultureField')}');";
|
||||
|
||||
$out[] = self::outputFunction('setUp', $setup);
|
||||
|
||||
// the following could also be: if ($this->inheritance)
|
||||
// FIXME: create a global class!
|
||||
if (isset($this->inheritance['extends']))
|
||||
$parentName = $this->inheritance['extends'];
|
||||
else
|
||||
$parentName = ($this->hasI18n() ? 'sfDoctrineRecordI18n' : 'sfDoctrineRecord');
|
||||
|
||||
|
||||
$class = array
|
||||
(
|
||||
'name' => $this->getPhpName(), // name of the child class; used only internally
|
||||
'className' => $this->basePHPName(),
|
||||
'source' => self::outputClass($this->basePHPName(), $parentName, implode("\n", $out), 'Base class; DO NOT EDIT'),
|
||||
'overwrite' => true, // carful! even this set to false will overwrite!!!
|
||||
);
|
||||
|
||||
$classes[] = $class;
|
||||
|
||||
$package = $this->getTable()->getPackage();
|
||||
|
||||
// generate the empty user and table classes
|
||||
foreach ($classes as $baseClass)
|
||||
{
|
||||
$name = $baseClass['name'];
|
||||
$parentClass = $baseClass['className'];
|
||||
|
||||
$tableName = $name.'Table'; // convention imposed by Doctrine
|
||||
if (isset($this->inheritance['extends']))
|
||||
$parentTable = $this->inheritance['extends'].'Table';
|
||||
else
|
||||
$parentTable = 'Doctrine_Table';
|
||||
|
||||
if ($package)
|
||||
{
|
||||
$pluginClassName = 'Plugin'.$name;
|
||||
$classes[] = array
|
||||
(
|
||||
'className'=> $pluginClassName,
|
||||
'source' => self::outputClass($pluginClassName, $parentClass, '', 'Plugin class'),
|
||||
'plugin' => true,
|
||||
);
|
||||
// we hook the plugin class name in
|
||||
$parentClass = $pluginClassName;
|
||||
|
||||
// same for tables
|
||||
$pluginTableName = 'Plugin'.$tableName;
|
||||
$classes[] = array
|
||||
(
|
||||
'className' => $pluginTableName,
|
||||
'source' => self::outputClass($pluginTableName, $parentTable, '', 'Plugin table'),
|
||||
'plugin' => true,
|
||||
);
|
||||
$parentTable = $pluginTableName;
|
||||
}
|
||||
|
||||
$classes[] = array
|
||||
(
|
||||
'className'=>$name,
|
||||
'source'=>self::outputClass($name, $parentClass, '', 'Edit this file to customise your model class'),
|
||||
);
|
||||
|
||||
$classes[] = array
|
||||
(
|
||||
'className'=>$tableName,
|
||||
'source'=>self::outputClass($tableName, $parentTable, '', 'Edit this file to customise your model table'),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
// outputs a nested array
|
||||
public function asDoctrineYml()
|
||||
{
|
||||
$output = array();
|
||||
|
||||
if ($this->inheritance)
|
||||
$output['inheritance'] = $this->inheritance;
|
||||
else
|
||||
$output['tableName'] = $this->getTableName();
|
||||
|
||||
$cols = array();
|
||||
foreach ($this->columns as $col)
|
||||
{
|
||||
$cols[$col->getName()] = $col->asDoctrineYml();
|
||||
}
|
||||
|
||||
$output['columns'] = $cols;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// outputs the columns of that class in propel xml format
|
||||
public function addPropelXmlColumns(&$table)
|
||||
{
|
||||
// we add the id column which is automatically created in doctrine
|
||||
$this->addColumn(new sfDoctrineColumnSchema('id', array('type'=>'integer', 'size'=>10, 'primary'=>true, 'autoincrement'=>true)));
|
||||
foreach($this->columns as $col)
|
||||
{
|
||||
$col->addPropelXml($table);
|
||||
}
|
||||
}
|
||||
|
||||
public function debug()
|
||||
{
|
||||
$debug = array();
|
||||
$debug['inheritance'] = $this->inheritance;
|
||||
$debug['many'] = $this->many;
|
||||
$debug['i18n'] = $this->i18n;
|
||||
foreach ($this->columns as $col)
|
||||
{
|
||||
$debug['columns'][$col->getName()] = $col->debug();
|
||||
}
|
||||
return $debug;
|
||||
}
|
||||
}
|
@ -1,368 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineColumnSchema.class.php 4084 2007-05-23 09:48:50Z chtito $
|
||||
*/
|
||||
|
||||
/*
|
||||
This class stores information about a column in two arrays:
|
||||
- properties: contains the name, type, size and constraints
|
||||
- columnInfo: contains also the foreign relation information
|
||||
*/
|
||||
class sfDoctrineColumnSchema
|
||||
{
|
||||
protected static $propel2docDictionary = array(
|
||||
'types'=> array(
|
||||
'tinyint' => 'integer',
|
||||
'smallint' => 'integer',
|
||||
'bigint' => 'integer',
|
||||
'real' => 'float',
|
||||
'decimal' => 'float',
|
||||
'char' => 'string',
|
||||
'varchar' => 'string',
|
||||
'longvarchar' => 'string',
|
||||
# 'smallint'=> 'enum', // enums are converted to smallints
|
||||
# 'blob' => 'array', // arrays will be blobs
|
||||
# 'integer' => 'integer', // to convert doc integer to integer
|
||||
/*
|
||||
'double' => 'double',
|
||||
'float' => 'float',
|
||||
'boolean' => 'boolean',
|
||||
'date' => 'date',
|
||||
'time' => 'timestamp',
|
||||
'timestamp' => 'timestamp',
|
||||
'blob' => 'blob',
|
||||
'clob' => 'clob'
|
||||
*/
|
||||
),
|
||||
'constraints' => array('autoIncrement' => 'autoincrement', 'primaryKey' => 'primary')
|
||||
);
|
||||
|
||||
//FIXME: double, float,real???
|
||||
protected static $defaultPropelSize = array(
|
||||
'tinyint' => 3,
|
||||
'smallint' => 5,
|
||||
'integer' => 11,
|
||||
'bigint' => 20,
|
||||
'longvarchar'=>4000,
|
||||
);
|
||||
|
||||
protected static $defaultDoctrineSize = array(
|
||||
'string'=> 4000,
|
||||
'integer' => 10,
|
||||
'double' => 10,
|
||||
'float' => 10,
|
||||
'enum' => 2,
|
||||
'array' => 100,
|
||||
);
|
||||
|
||||
static $allowedConstraints = array('primary', 'autoincrement', 'default', 'enum', 'unique', 'nospace', 'notblank', 'notnull', 'email', 'scale', 'zerofill');
|
||||
|
||||
// column properties: name, size, type and constraints
|
||||
protected $properties;
|
||||
|
||||
// column name
|
||||
protected $name;
|
||||
|
||||
// temporary storage of the description array; used when the class sets up the relation
|
||||
protected $columnInfo;
|
||||
|
||||
// set if the column is a foreign key
|
||||
protected $relation = null;
|
||||
|
||||
// we essentially set up the properties array
|
||||
// and translate from propel if needed
|
||||
public function __construct($colName, $columnDescription = array(), $translatePropel = false)
|
||||
{
|
||||
// sometimes we get null if the yml line is empty
|
||||
if ($columnDescription == null)
|
||||
$columnDescription = array();
|
||||
|
||||
// for the short syntax type(size)
|
||||
if (is_string($columnDescription))
|
||||
$columnDescription = array('type'=>$columnDescription);
|
||||
|
||||
$this->setName($colName);
|
||||
|
||||
$columnInfo = new sfParameterHolder();
|
||||
$columnInfo->add($columnDescription);
|
||||
|
||||
if ($translatePropel)
|
||||
{
|
||||
// we translate the propel types to doctrine ones
|
||||
$propelType = strtolower($columnInfo->get('type'));
|
||||
if (array_key_exists($propelType, self::$propel2docDictionary['types']))
|
||||
$columnInfo->set('type', self::$propel2docDictionary['types'][$propelType]);
|
||||
else
|
||||
$columnInfo->set('type', $propelType); // we store it in lowercase
|
||||
|
||||
// if there is a default propel size we set it
|
||||
if (!$columnInfo->get('size'))
|
||||
if (isset(self::$defaultPropelSize[$propelType]))
|
||||
$columnInfo->set('size', self::$defaultPropelSize[$propelType]);
|
||||
|
||||
// we translate the constraints
|
||||
foreach ($columnInfo->getAll() as $key=>$value)
|
||||
{
|
||||
if (array_key_exists($key, self::$propel2docDictionary['constraints']))
|
||||
$columnInfo->set(self::$propel2docDictionary['constraints'][$key], $columnInfo->get($key));
|
||||
}
|
||||
}
|
||||
|
||||
// we store the raw description, only used in setUpForeignRelation
|
||||
$this->columnInfo = $columnInfo;
|
||||
|
||||
|
||||
// name
|
||||
$this->setProperty('name', $colName);
|
||||
$this->setProperty('columnName', $columnInfo->get('columnName'));
|
||||
|
||||
// type
|
||||
if (!($type = $columnInfo->get('type')))
|
||||
{
|
||||
// we try to figure out the type
|
||||
// FIXME: write a method to detect relations?
|
||||
if ($columnInfo->get('foreignClass') || $columnInfo->get('foreignTable'))
|
||||
$type = 'integer'; // foreign key
|
||||
else
|
||||
$type = 'string'; // default type
|
||||
}
|
||||
elseif(is_string($type)) // we check for the short syntax type
|
||||
{
|
||||
preg_match('/([^\(\s]+)\s*\([\s]*([\d]+)[\s]*\)/', $type, $matches);
|
||||
if (!empty($matches))
|
||||
{
|
||||
$type = $matches[1];
|
||||
$columnInfo->set('size', $matches[2]);
|
||||
}
|
||||
}
|
||||
$this->setProperty('type', $type);
|
||||
|
||||
// size
|
||||
if (!($size = $columnInfo->get('size')))
|
||||
{
|
||||
if (is_string($type))
|
||||
{
|
||||
if (isset(self::$defaultDoctrineSize[$type]))
|
||||
$size = self::$defaultDoctrineSize[$type]; // we have a default size for this type
|
||||
}
|
||||
}
|
||||
if (!$size)
|
||||
$size = 'null';
|
||||
|
||||
|
||||
$this->setProperty('size', $size);
|
||||
|
||||
// constraints
|
||||
if ($constraints = array_intersect_key($columnDescription, array_flip(self::$allowedConstraints)))
|
||||
$this->properties = array_merge($this->properties, $constraints);
|
||||
}
|
||||
|
||||
|
||||
// FIXME: simplify this function
|
||||
public function setUpForeignRelation($className)
|
||||
{
|
||||
$colInfo = $this->getColumnInfo();
|
||||
$colName = $this->getName();
|
||||
|
||||
// If there is no relation info for this column
|
||||
if (!$colInfo->has('foreignTable') && !$colInfo->has('foreignClass'))
|
||||
return;
|
||||
|
||||
$foreignClass = $colInfo->get('foreignClass');
|
||||
|
||||
// if the localName (plural name) is not specified, we add an "s"
|
||||
// as propel does
|
||||
$localName = $colInfo->get('localName', $className.'s');
|
||||
$foreignTable = $colInfo->get('foreignTable');
|
||||
|
||||
$foreignName = $colInfo->get('foreignName', null);
|
||||
|
||||
$fr = $colInfo->get('foreignReference', 'id');
|
||||
|
||||
$counterpart = $colInfo->get('counterpart');
|
||||
|
||||
$relationInfo = array
|
||||
(
|
||||
'localReference'=>$colName,
|
||||
'foreignReference'=>$fr,
|
||||
'localName'=>$localName,
|
||||
'foreignName'=>$foreignName,
|
||||
'counterpart' => $counterpart,
|
||||
'foreignClass'=>$foreignClass,
|
||||
'foreignTable'=>$foreignTable, // used only for propel import
|
||||
'localClass'=>$className,
|
||||
'options'=>$colInfo, // the remaining relation options
|
||||
);
|
||||
|
||||
$this->relation = new sfDoctrineRelationSchema($relationInfo);
|
||||
}
|
||||
|
||||
public function getColumnInfo()
|
||||
{
|
||||
return $this->columnInfo;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getRelation()
|
||||
{
|
||||
return $this->relation;
|
||||
}
|
||||
|
||||
public function hasRelation()
|
||||
{
|
||||
return isset($this->relation);
|
||||
}
|
||||
|
||||
public function setProperty($name, $value)
|
||||
{
|
||||
$this->properties[$name] = $value;
|
||||
}
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
return $this->properties[$name];
|
||||
}
|
||||
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
protected function niceVarExport($array)
|
||||
{
|
||||
return str_replace(array("\n"), array(''), var_export($array, 1));
|
||||
}
|
||||
|
||||
static protected $doctrineArgs = array('name' => false, 'type' => true, 'size' => false);
|
||||
|
||||
// generates the doctrine description of a column in PHP
|
||||
public function asPhp()
|
||||
{
|
||||
$props = $this->getProperties();
|
||||
|
||||
$args = array();
|
||||
|
||||
// take care of the enum type
|
||||
// FIXME: remove this "trick" some day?
|
||||
if (is_array($props['type']))
|
||||
{
|
||||
$props['values'] = $props['type'];
|
||||
$props['type'] = 'enum';
|
||||
}
|
||||
|
||||
$output = array();
|
||||
|
||||
foreach (self::$doctrineArgs as $argName => $isString)
|
||||
{
|
||||
$arg = $props[$argName];
|
||||
unset($props[$argName]);
|
||||
if ($isString)
|
||||
$arg = sprintf("'%s'", $arg);
|
||||
$args[] = $arg;
|
||||
}
|
||||
|
||||
$columnAlias = '';
|
||||
if ($props['columnName'])
|
||||
{
|
||||
$columnAlias = $props['columnName'] . ' as ';
|
||||
}
|
||||
unset($props['columnName']);
|
||||
|
||||
$args[0] = sprintf("'%s%s'", $columnAlias, $args[0]);
|
||||
|
||||
// what remains is considered to be constraints
|
||||
$args[] = $this->niceVarExport($props);
|
||||
|
||||
$output[] = sprintf('$this->hasColumn(%s);', implode(', ', $args));
|
||||
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
// exports this column in propel xml format
|
||||
public function addPropelXml(&$node)
|
||||
{
|
||||
$c = $node->addChild('column');
|
||||
|
||||
$doc2proplDict = array_flip(self::$propel2docDictionary['types']);
|
||||
|
||||
$c->addAttribute('name', $this->getName());
|
||||
|
||||
// type
|
||||
$type = $this->properties['type'];
|
||||
if (array_key_exists($this->properties['type'], $doc2proplDict))
|
||||
$type = $doc2proplDict[$type];
|
||||
$c->addAttribute('type', $type);
|
||||
|
||||
// size
|
||||
$size = $this->properties['size'];
|
||||
if ($type == 'varchar')
|
||||
$c->addAttribute('size', $size);
|
||||
|
||||
// constraints
|
||||
$constraints = array_diff_key($this->properties, array_flip(array('name', 'type', 'size')));
|
||||
$doc2propelDict = array_flip(self::$propel2docDictionary['constraints']);
|
||||
foreach ($constraints as $constraint=>$value)
|
||||
{
|
||||
if (array_key_exists($constraint, $doc2propelDict))
|
||||
$constraint = $doc2propelDict[$constraint];
|
||||
$c->addAttribute($constraint, ($value ? 'true' : 'false'));
|
||||
}
|
||||
|
||||
if ($rel = $this->getRelation())
|
||||
{
|
||||
$r = $node->addChild('foreign-key');
|
||||
$r->addAttribute('foreignTable', $rel['foreignTable']);
|
||||
$ref = $r->addChild('reference');
|
||||
$ref->addAttribute('local', $this->getName());
|
||||
$ref->addAttribute('foreign', $rel['foreignReference']);
|
||||
}
|
||||
}
|
||||
|
||||
// exports this column in doctrine yml format
|
||||
public function asDoctrineYml()
|
||||
{
|
||||
$output = array();
|
||||
|
||||
foreach($this->getProperties() as $key=>$value)
|
||||
{
|
||||
if ($key != 'name')
|
||||
$output[$key] = $value;
|
||||
}
|
||||
|
||||
if ($relation = $this->getRelation())
|
||||
{
|
||||
$output = array_merge($output, $relation->asDoctrineYml());
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function debug()
|
||||
{
|
||||
$debug = array();
|
||||
$debug['properties'] = $this->properties;
|
||||
$debug['relation'] = $this->relation;
|
||||
$debug['columnInfo'] = $this->getColumnInfo()->getAll();
|
||||
return $debug;
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineDatabaseSchema.class.php 3455 2007-02-14 16:17:48Z chtito $
|
||||
*/
|
||||
|
||||
/*
|
||||
- class: contains a bunch of columns, toMany relationships, inheritance
|
||||
information, i18n information
|
||||
- table: a special class that is actually a table
|
||||
- column: contains the doctrine properties (name, type, size) and the toOne relation information
|
||||
|
||||
*/
|
||||
|
||||
class sfDoctrineDatabaseSchema
|
||||
{
|
||||
// the class descriptions
|
||||
protected $classes = array();
|
||||
|
||||
// a subset of the array above: classes which are also tables
|
||||
protected $tables = array();
|
||||
|
||||
public function getClasses()
|
||||
{
|
||||
return $this->classes;
|
||||
}
|
||||
|
||||
protected function getClass($className)
|
||||
{
|
||||
if (isset($this->classes[$className]))
|
||||
return $this->classes[$className];
|
||||
throw new sfDoctrineSchemaException(sprintf('The class "%s" has no description', $className));
|
||||
}
|
||||
|
||||
// retrieves a class object from its table name
|
||||
protected function findClassByTableName($tableName)
|
||||
{
|
||||
foreach ($this->tables as $table)
|
||||
if ($table->getName() == $tableName)
|
||||
{
|
||||
$tableClasses = $table->getClasses();
|
||||
if (count($tableClasses) != 1)
|
||||
throw new sfDoctrineSchemaException(sprintf('No unique class is associated to table "%s"', $tableName));
|
||||
return array_pop($tableClasses);
|
||||
}
|
||||
throw new sfDoctrineSchemaException(sprintf('Table "%s" not found', $tableName));
|
||||
}
|
||||
|
||||
// set the one to many and many to many relationships
|
||||
// finds out what are the foreign classes or foreign tables
|
||||
protected function fixRelationships()
|
||||
{
|
||||
foreach ($this->classes as $className => $class)
|
||||
{
|
||||
foreach ($class->getColumns() as $relCol)
|
||||
if ($relation = $relCol->getRelation())
|
||||
{
|
||||
// if no foreignClass was specified (import from propel) we find it out
|
||||
if (!$relation->get('foreignClass'))
|
||||
{
|
||||
$foreignClass = $this->findClassByTableName($relation->get('foreignTable'));
|
||||
$relation->set('foreignClass', $foreignClass->getPhpName());
|
||||
}
|
||||
|
||||
// if foreignTable was not set (only used for export to propel)
|
||||
// we figure it out
|
||||
if (!$relation->get('foreignTable'))
|
||||
{
|
||||
$className = $relation->get('foreignClass');
|
||||
$relation->set('foreignTable', $this->getClass($className)->getTableName());
|
||||
}
|
||||
|
||||
// the relation is a many2many
|
||||
if ($relation->get('counterpart'))
|
||||
{
|
||||
$counterpartRel = $class->getRelation($relation->get('counterpart'));
|
||||
$relation->set('otherClass', $counterpartRel->get('foreignClass'));
|
||||
}
|
||||
|
||||
// we copy all the toOne relations to the corresponding
|
||||
// foreign class
|
||||
$rel = $relCol->getRelation();
|
||||
$this->getClass($rel->get('foreignClass'))->addToMany($rel); // FIXME: don't copy here
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// exports the current schema as a propel xml file
|
||||
public function asPropelXml()
|
||||
{
|
||||
$xml = new SimpleXmlElement(sprintf('<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<database name="%s" defaultIdMethod="native"></database>', 'connection'));
|
||||
|
||||
foreach ($this->tables as $table)
|
||||
{
|
||||
$table->addPropelXmlClasses($xml);
|
||||
}
|
||||
|
||||
return array('source'=>$xml->asXml());
|
||||
}
|
||||
|
||||
// exports the current schema in a sfDoctrine yml file
|
||||
public function asDoctrineYml()
|
||||
{
|
||||
$ymlClasses = array();
|
||||
|
||||
foreach ($this->classes as $class)
|
||||
{
|
||||
$ymlClasses[$class->getPhpName()] = $class->asDoctrineYml();
|
||||
}
|
||||
return array('source'=>sfYaml::dump($ymlClasses));
|
||||
}
|
||||
|
||||
public function debug()
|
||||
{
|
||||
$debug = array();
|
||||
foreach ($this->classes as $class)
|
||||
{
|
||||
$debug[$class->getPhpName()] = $class->debug();
|
||||
}
|
||||
return $debug;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class sfDoctrineSchemaException extends sfException
|
||||
{
|
||||
public function __construct($message = null, $code = 0)
|
||||
{
|
||||
$this->setName('sfDoctrineSchemaException');
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineRelationSchema.class.php 4705 2007-07-24 20:45:46Z Jonathan.Wage $
|
||||
*/
|
||||
|
||||
class sfDoctrineRelationSchema
|
||||
{
|
||||
protected $relationInfo = array();
|
||||
|
||||
public function __construct($relationInfo)
|
||||
{
|
||||
foreach ($relationInfo as $key => $value)
|
||||
{
|
||||
$this->set($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
// we set the default foreign name
|
||||
if ($key == 'foreignClass')
|
||||
{
|
||||
if (!isset($this->relationInfo['foreignName']))
|
||||
{
|
||||
$this->relationInfo['foreignName'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->relationInfo[$key] = $value;
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
if (isset($this->relationInfo[$key]))
|
||||
{
|
||||
return $this->relationInfo[$key];
|
||||
}
|
||||
else if (isset($this->relationInfo['options']))
|
||||
{
|
||||
if ($option = $this->relationInfo['options']->get($key))
|
||||
{
|
||||
return $option;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function asDoctrineYml()
|
||||
{
|
||||
$output = array();
|
||||
foreach(array('foreignClass', 'foreignReference', 'localName', 'foreignName', 'cascadeDelete', 'unique') as $key)
|
||||
{
|
||||
if ($value = $this->get($key))
|
||||
{
|
||||
$output[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: this is clumsy: change the schema syntax?
|
||||
if ($verb == 'owns')
|
||||
{
|
||||
$output['cascadeDelete'] = true;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function asPhpArray($array)
|
||||
{
|
||||
$phpArray = 'array(';
|
||||
|
||||
if( !empty($array) )
|
||||
{
|
||||
foreach($array AS $key => $value)
|
||||
{
|
||||
$phpArray .= "'{$key}' => '{$value}', ";
|
||||
}
|
||||
|
||||
$phpArray = substr($phpArray, 0, strlen($phpArray) - 2);
|
||||
}
|
||||
|
||||
$phpArray .= ')';
|
||||
|
||||
return $phpArray;
|
||||
}
|
||||
|
||||
public function asOnePhp()
|
||||
{
|
||||
// special behaviour for xref tables with cascade delete
|
||||
$verb = ($this->get('cascadeDelete') && ($this->get('counterpart') || $this->get('unique'))) ? 'owns' : 'has';
|
||||
$options['local'] = $this->get('localReference');
|
||||
$options['foreign'] = $this->get('foreignReference');
|
||||
|
||||
//support old and new cascade declarations
|
||||
if ($verb == 'owns' || $this->get('cascadeDelete') === true)
|
||||
{
|
||||
$options['onDelete'] = 'CASCADE';
|
||||
}
|
||||
|
||||
if ($this->get('onDelete'))
|
||||
{
|
||||
$options['onDelete'] = strtoupper($this->get('onDelete'));
|
||||
}
|
||||
|
||||
$phpOptions = $this->asPhpArray($options);
|
||||
|
||||
return "\$this->$verb"."One('{$this->get('foreignClass')} as {$this->get('foreignName')}', $phpOptions);";
|
||||
}
|
||||
|
||||
public function asManyPhp()
|
||||
{
|
||||
$quantity = $this->get('unique') ? 'One':'Many';
|
||||
|
||||
// using "owns" for cascade delete except in xref table
|
||||
$verb = ($this->get('cascadeDelete') && !$this->get('counterpart')) ? 'has':'has';
|
||||
|
||||
$otherClass = $this->get('localClass');
|
||||
|
||||
if ($quantity == 'Many' && $this->get('counterpart'))
|
||||
{
|
||||
$localReference = $this->relationInfo['localReference'];
|
||||
$foreignReference = $this->relationInfo['options']->get('counterpart');
|
||||
$otherClass = $this->get('otherClass');
|
||||
} else {
|
||||
$localReference = $this->get('foreignReference');
|
||||
$foreignReference = $this->get('localReference');
|
||||
}
|
||||
|
||||
$localClass = $this->get('localClass');
|
||||
|
||||
// Set refClass to localClass if it is a Many-Many relationship
|
||||
if ($quantity == 'Many' && $this->get('counterpart'))
|
||||
{
|
||||
$refClass = $this->get('localClass');
|
||||
}
|
||||
|
||||
if (isset($refClass) && $refClass)
|
||||
{
|
||||
$options['refClass'] = $refClass;
|
||||
}
|
||||
|
||||
if ($localReference)
|
||||
{
|
||||
$options['local'] = $localReference;
|
||||
}
|
||||
|
||||
if ($foreignReference)
|
||||
{
|
||||
$options['foreign'] = $foreignReference;
|
||||
}
|
||||
|
||||
$phpOptions = $this->asPhpArray($options);
|
||||
|
||||
return "\$this->$verb$quantity('$otherClass as {$this->get('localName')}', $phpOptions);";
|
||||
}
|
||||
|
||||
public function debug()
|
||||
{
|
||||
return $this->relationInfo;
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineSchemaDoctrineLoader.class.php 3455 2007-02-14 16:17:48Z chtito $
|
||||
*/
|
||||
|
||||
class sfDoctrineSchemaDoctrineLoader extends sfDoctrineDatabaseSchema
|
||||
{
|
||||
// recursively finds out what a class table is
|
||||
// FIXME: check for infinite loop?
|
||||
protected function parentTable($class)
|
||||
{
|
||||
if ($class->hasTable())
|
||||
return $class->getTable();
|
||||
|
||||
return $this->parentTable($this->getClass($class->getParentClassName()));
|
||||
}
|
||||
|
||||
// associate a table to each class
|
||||
protected function fixTables()
|
||||
{
|
||||
foreach ($this->classes as $className => $class)
|
||||
{
|
||||
$table = $this->parentTable($class);
|
||||
$table->addClass($class);
|
||||
}
|
||||
}
|
||||
|
||||
// set up the necessary fields in the i18n table: culture, id
|
||||
protected function addI18nFields()
|
||||
{
|
||||
foreach ($this->classes as $className => $class)
|
||||
{
|
||||
if (!$class->hasI18n())
|
||||
continue;
|
||||
$i18nClass = $this->getClass($class->getI18n('class'));
|
||||
$cultureColumn = new sfDoctrineColumnSchema($class->getI18n('cultureField'), array('type'=> 'string', 'size'=> 100, 'primary'=> true));
|
||||
|
||||
$i18nClass->addColumn($cultureColumn);
|
||||
|
||||
// add the foreign key to the main table
|
||||
$idDesc = array('foreignClass'=>$className, 'localName'=>$i18nClass->getPhpName(), 'onDelete'=>'cascade', 'primary'=>true);
|
||||
$i18nClass->addColumn(new sfDoctrineColumnSchema('id', $idDesc));
|
||||
}
|
||||
}
|
||||
|
||||
// adds the class key fields
|
||||
protected function addInheritanceFields()
|
||||
{
|
||||
foreach ($this->classes as $className => $class)
|
||||
if ($class->hasOneTableInheritance())
|
||||
{
|
||||
$inh = $class->getInheritance();
|
||||
$class->getTable()->addColumn(new sfDoctrineColumnSchema($inh['keyField'], array('type'=>'integer')));
|
||||
}
|
||||
}
|
||||
|
||||
public function load($file, $package = null)
|
||||
{
|
||||
$schema = sfYaml::load($file);
|
||||
|
||||
foreach ($schema as $className => $cd)
|
||||
{
|
||||
if (!isset($cd['tableName']) && !isset($cd['inheritance']))
|
||||
throw new sfDoctrineSchemaException(sprintf('Class "%s" must have either a table or a parent', $className));
|
||||
|
||||
$class = new sfDoctrineClassSchema($className, $cd);
|
||||
|
||||
// add a table if necessary
|
||||
if (isset($cd['tableName']))
|
||||
{
|
||||
// this top class is actually a table
|
||||
$table = new sfDoctrineTableSchema($cd['tableName'], $package);
|
||||
$table->addClass($class);
|
||||
$this->tables[$cd['tableName']] = $table;
|
||||
}
|
||||
|
||||
$this->classes[$className] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$this->fixTables();
|
||||
|
||||
$this->addI18nFields();
|
||||
|
||||
$this->fixRelationships();
|
||||
|
||||
$this->addInheritanceFields();
|
||||
}
|
||||
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineSchemaPropelLoader.class.php 3455 2007-02-14 16:17:48Z chtito $
|
||||
*/
|
||||
|
||||
class sfDoctrineSchemaPropelLoader extends sfDoctrineDatabaseSchema
|
||||
{
|
||||
// get the attributes parsed by the sfPropelDatabaseSchema class
|
||||
protected function getAttribute($tag, $attribute)
|
||||
{
|
||||
return isset($tag['_attributes'][$attribute]) ? $tag['_attributes'][$attribute] : null;
|
||||
}
|
||||
|
||||
public function load($file, $package = null)
|
||||
{
|
||||
// we figure out what kind of file we are given
|
||||
$type = array_pop(explode('.', $file));
|
||||
$type2method = array('yml'=>'loadYAML', 'xml'=>'loadXML');
|
||||
if (isset($type2method[$type]))
|
||||
$method = $type2method[$type];
|
||||
else
|
||||
throw new sfDoctrineSchemaException(sprintf('Unkwnown method for extension "%s"', $type));
|
||||
|
||||
$propelDatabaseSchema = new sfPropelDatabaseSchema();
|
||||
$propelDatabaseSchema->$method($file);
|
||||
$data = $propelDatabaseSchema->asArray();
|
||||
|
||||
foreach ($propelDatabaseSchema->getTables() as $tb_name => $tableDesc)
|
||||
{
|
||||
// special table class
|
||||
// propel has only such classes (no inheritance support)
|
||||
$table = new sfDoctrineTableSchema($tb_name, $package);
|
||||
$this->tables[$tb_name] = $table;
|
||||
|
||||
if (!($className = $this->getAttribute($tableDesc, 'phpName')))
|
||||
$className = sfInflector::camelize($tb_name); // wild guess
|
||||
|
||||
$class = new sfDoctrineClassSchema($className);
|
||||
$table->addClass($class);
|
||||
|
||||
// columns
|
||||
foreach ($propelDatabaseSchema->getChildren($tableDesc) as $col_name => $columnDescription)
|
||||
{
|
||||
if (($col_name == 'id')) // id is automatically generated in doctrine
|
||||
continue;
|
||||
|
||||
$docCol = new sfDoctrineColumnSchema($col_name, $columnDescription, true);
|
||||
$class->addColumn($docCol);
|
||||
}
|
||||
|
||||
$this->classes[$class->getPhpName()] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$this->fixRelationships();
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the sfDoctrine package.
|
||||
* (c) 2006-2007 Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package symfony.plugins
|
||||
* @subpackage sfDoctrine
|
||||
* @author Olivier Verdier <Olivier.Verdier@gmail.com>
|
||||
* @version SVN: $Id: sfDoctrineTableSchema.class.php 3455 2007-02-14 16:17:48Z chtito $
|
||||
*/
|
||||
|
||||
class sfDoctrineTableSchema extends sfDoctrineClassSchema
|
||||
{
|
||||
// the classes associated to that table
|
||||
protected $classes;
|
||||
|
||||
// table name
|
||||
protected $name;
|
||||
|
||||
// package of that table (usually either a plugin name, or a propel schema name)
|
||||
protected $package;
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function __construct($tableName, $package)
|
||||
{
|
||||
$this->setName($tableName);
|
||||
$this->package = $package;
|
||||
}
|
||||
|
||||
public function addClass($class)
|
||||
{
|
||||
// we add the class and try to avoid duplication
|
||||
$this->classes[$class->getPhpName()] = $class;
|
||||
$class->setTable($this);
|
||||
}
|
||||
|
||||
public function getClasses()
|
||||
{
|
||||
return $this->classes;
|
||||
}
|
||||
|
||||
// exports this table in propel xml format
|
||||
public function addPropelXmlClasses(&$node)
|
||||
{
|
||||
$t = $node->addChild('table');
|
||||
$t->addAttribute('name', $this->getName());
|
||||
$t->addAttribute('phpName', $this->getPhpName());
|
||||
foreach($this->classes as $class)
|
||||
{
|
||||
$class->addPropelXmlColumns($t);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPackage()
|
||||
{
|
||||
return $this->package;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
autoload:
|
||||
Doctrine:
|
||||
name: Doctrine classes
|
||||
ext: .php
|
||||
path: %SF_PLUGINS_DIR%/sfDoctrinePlugin/lib/doctrine
|
||||
recursive: on
|
||||
doctrine_model_classes:
|
||||
name: Doctrine model classes
|
||||
ext: .class.php
|
||||
path: %SF_LIB_DIR%/model/doctrine
|
@ -1,5 +0,0 @@
|
||||
config/doctrine.yml:
|
||||
class: sfDoctrineConfigHandler
|
||||
|
||||
config/schemas.yml:
|
||||
class: sfDoctrineSchemasConfigHandler
|
@ -1,22 +0,0 @@
|
||||
all:
|
||||
|
||||
#doctrine attributes
|
||||
attributes:
|
||||
|
||||
#automatic table creation (none, tables, constraints, all)
|
||||
export: all
|
||||
|
||||
#default fetch mode (immediate, batch, lazy, offset, lazy_offset)
|
||||
# fetchmode: immediate
|
||||
|
||||
#collection limit (integer 1+)
|
||||
# coll_limit: 5
|
||||
|
||||
#global event listener
|
||||
# listener: sfDoctrineEventListener
|
||||
|
||||
#enable doctrine side validation (true, false)
|
||||
validate: false
|
||||
|
||||
# enable quoting
|
||||
quote_identifier: false
|
@ -1,3 +0,0 @@
|
||||
all:
|
||||
orm: doctrine
|
||||
# default_database: <your default connection here>
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ##MODULE_NAME## actions.
|
||||
*
|
||||
* @package ##PROJECT_NAME##
|
||||
* @subpackage ##MODULE_NAME##
|
||||
* @author ##AUTHOR_NAME##
|
||||
* @version SVN: $Id: actions.class.php,v 1.1 2006/12/08 18:49:35 nathanael Exp $
|
||||
*/
|
||||
class ##MODULE_NAME##Actions extends auto##MODULE_NAME##Actions
|
||||
{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
generator:
|
||||
class: sfDoctrineAdminGenerator
|
||||
param:
|
||||
model_class: ##MODEL_CLASS##
|
||||
theme: crud
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user