Commit 0ed23128 authored by Jonathan.Wage's avatar Jonathan.Wage

Removed from trunk. Outdated/not used.

parent 09e77de2
<?php
require_once('lib/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', 'dc34');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/**
$dbh->query('TRUNCATE TABLE user');
$dbh->query('TRUNCATE TABLE club');
$dbh->query('TRUNCATE TABLE clubuser');
*/
$dbh->query('DROP TABLE IF EXISTS clubuser CASCADE');
$dbh->query('DROP TABLE IF EXISTS club');
$dbh->query('DROP TABLE IF EXISTS user');
$dbh->query('DROP TRIGGER IF EXISTS trg1');
$dbh->query('DROP TRIGGER IF EXISTS trg2');
$dbh->query('CREATE TABLE IF NOT EXISTS user (id INT, parent_id INT, name VARCHAR(200), PRIMARY KEY(id), INDEX (id))');
$dbh->query('CREATE TABLE IF NOT EXISTS club (id INT, name VARCHAR(200), PRIMARY KEY(id), INDEX (id))');
$dbh->query('CREATE TABLE IF NOT EXISTS clubuser (user_id INT, club_id INT, INDEX (user_id), INDEX (club_id), PRIMARY KEY(user_id, club_id))');
$dbh->query('ALTER TABLE clubuser ADD FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE');
$dbh->query('ALTER TABLE clubuser ADD FOREIGN KEY (club_id) REFERENCES club(id) ON DELETE CASCADE');
$dbh->query('ALTER TABLE user ADD FOREIGN KEY (parent_id) REFERENCES user(id) ON DELETE CASCADE');
/**
$dbh->query('CREATE TRIGGER trg5 AFTER DELETE ON user
FOR EACH ROW BEGIN
DELETE FROM user WHERE user.parent_id = OLD.id;
END;');
$dbh->query('CREATE TRIGGER trg2 BEFORE DELETE ON user
FOR EACH ROW BEGIN
DELETE FROM clubuser WHERE clubuser.user_id = OLD.id;
END;');
*/
/**
$dbh->query('CREATE TRIGGER trg1 BEFORE DELETE ON club
FOR EACH ROW BEGIN
@param := SELECT user_id FROM clubuser WHERE clubuser.club_id = OLD.id;
DELETE FROM clubuser WHERE clubuser.user_id = OLD.id;
DELETE FROM clubuser WHERE clubuser.club_id = OLD.id;
END;');
IN (SELECT user_id FROM clubuser WHERE clubuser.club_id = OLD.id);
$dbh->query('CREATE TRIGGER trg3 AFTER DELETE ON clubuser
FOR EACH ROW BEGIN
UPDATE user SET user.name = "deleted" WHERE user.id = OLD.user_id;
END;');
$dbh->query('CREATE TRIGGER trg4 AFTER UPDATE ON user
FOR EACH ROW BEGIN
DELETE FROM clubuser WHERE clubuser.user_id = NEW.id;
DELETE FROM user WHERE user.name = "deleted";
END;');
*/
$dbh->query('INSERT INTO user (id, parent_id) VALUES (1, 1)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (2, 1)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (3, 1)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (4, 3)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (5, 2)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (6, NULL)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (7, 6)');
$dbh->query('INSERT INTO user (id, parent_id) VALUES (8, 6)');
$dbh->query('INSERT INTO club (id) VALUES (1)');
$dbh->query('INSERT INTO club (id) VALUES (2)');
$dbh->query('INSERT INTO club (id) VALUES (3)');
$dbh->query('INSERT INTO club (id) VALUES (4)');
$dbh->query('INSERT INTO clubuser (user_id, club_id) VALUES (1, 1)');
$dbh->query('INSERT INTO clubuser (user_id, club_id) VALUES (2, 1)');
$dbh->query('INSERT INTO clubuser (user_id, club_id) VALUES (2, 2)');
print "<pre>";
//$dbh->query('DELETE FROM club WHERE id = 1');
$dbh->query('DELETE FROM user WHERE id = 1');
// should have deleted the first two users
var_dump($dbh->query('SELECT * FROM user')->fetchAll());
?>
// Sqlite cascading deletes
CREATE TRIGGER %s DELETE ON %s
BEGIN
DELETE FROM %s WHERE %s = %s;
END;
// Sqlite AuditLog
CREATE TRIGGER %s UPDATE OF %s ON %s
BEGIN
INSERT INTO %s (%s) VALUES (%s) WHERE %s = %s;
END;
CREATE TRIGGER %s DELETE ON %s
BEGIN
INSERT INTO %s (%s) VALUES (%s) WHERE %s = %s;
END;
# Doxyfile 1.4.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = Doctrine
PROJECT_NUMBER =
OUTPUT_DIRECTORY = ../../build/tobuild/docs/API/doxygen
CREATE_SUBDIRS = YES
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" "The $name widget" "The $name file" is provides specifies contains represents a an the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_BY_SCOPE_NAME = YES
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST = YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = "../../lib"
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = YES
CHM_FILE = chm.chm
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = YES
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = YES
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
<?xml version="1.0"?>
<!--
Builds API documentation and PEAR compliant packages.
Phing 2.2.0 (http://phing.info) or newer recommended.
@version $Id$
@author Jukka Hassinen <jukka.hassinen@brainalliance.com>
-->
<project name="Doctrine" basedir="." default="main">
<property name="base.name" value="Doctrine"/>
<property name="project.base.dir" value="../.."/>
<property name="build.base.dir" value="${project.base.dir}/build"/>
<property name="build.dest.dir" value="${build.base.dir}/tobuild"/>
<fileset dir="${project.base.dir}/lib" id="classes">
<include name="**/**"/>
<exclude name="**/.svn**"/>
</fileset>
<fileset dir="${project.base.dir}/manual" id="docs">
<include name="**/**"/>
<exclude name="**/.svn**"/>
</fileset>
<fileset dir="${project.base.dir}/tests" id="test">
<include name="**/**"/>
<exclude name="**/.svn**"/>
<exclude name="**/.svn*/*.txt"/>
<exclude name=".svn/**"/>
<exclude name=".svn**"/>
</fileset>
<target name="main">
<phingcall target="build"/>
<phingcall target="generate-docs"/>
<!-- <phingcall target="pear-package"/> -->
<!-- <phingcall target="compress"/> -->
</target>
<target name="build">
<echo>-----------------------------</echo>
<echo>| Creating directory layout |</echo>
<echo>-----------------------------</echo>
<delete dir="${build.base.dir}"/>
<copy todir="${build.dest.dir}/lib">
<fileset refid="classes"/>
</copy>
<copy todir="${build.dest.dir}/docs">
<fileset refid="docs"/>
</copy>
<copy todir="${build.dest.dir}/test">
<fileset refid="test"/>
</copy>
<svnlastrevision svnpath="svn" workingcopy="${project.base.dir}" propertyname="svn.lastrevision"/>
<property name="version" value="0.0.${svn.lastrevision}"/>
<fileset dir="${build.dest.dir}" id="php-files">
<include name="**/**.php"/>
<exclude name="**/.svn**"/>
</fileset>
<reflexive>
<fileset refid="php-files" />
<filterchain>
<replaceregexp>
<regexp pattern="@version \$(.*)\$" replace="@version \$$1\$ Package ver: ${version}"/>
</replaceregexp>
</filterchain>
<filterchain>
<tabtospaces tablength="4" />
</filterchain>
</reflexive>
</target>
<target name="generate-docs">
<!--
Generates the API documentation using Doxygen and PHPDoc
Doxygen is required in the path.
-->
<mkdir dir="${build.dest.dir}/docs/API/doxygen" />
<exec command="doxygen" dir="."/>
<!-- <exec command="make pdf" dir="${build.src.dir}/docs/latex"/> -->
<mkdir dir="${build.dest.dir}/docs/API/phpdoc" />
<phpdoc title="Doctrine Documentation" destdir="${build.dest.dir}/docs/API/phpdoc/html"
sourcepath="${project.base.dir}/lib" output="HTML:Smarty:PHP"/>
</target>
<target name="pear-package">
<echo>-----------------------------</echo>
<echo>| Creating PEAR package.xml |</echo>
<echo>-----------------------------</echo>
<echo></echo>
<svnlastrevision svnpath="svn" workingcopy="${project.base.dir}" propertyname="svn.lastrevision"/>
<property name="version" value="0.0.${svn.lastrevision}"/>
<pearpkg name="${base.name}" dir="${build.dest.dir}" destFile="${build.dest.dir}/package.xml">
<fileset refid="classes"/>
<fileset refid="docs"/>
<fileset refid="test"/>
<option name="notes">*</option>
<option name="description">ORM</option>
<option name="summary">ORM</option>
<option name="version" value="${version}"/>
<option name="state" value="stable"/>
<option name="license" value="LGPL"/>
<mapping name="maintainers">
<element>
<element key="handle" value="jhassine"/>
<element key="name" value="Jukka Hassinen"/>
<element key="email" value="Jukka.Hassinen@BrainAlliance.com"/>
<element key="role" value="lead"/>
</element>
</mapping>
<mapping name="deps">
<element>
<element key="type" value="php"/>
<element key="version" value="5.1.0"/>
<element key="rel" value="ge"/>
</element>
</mapping>
</pearpkg>
</target>
<target name="compress">
<echo>-----------------------------</echo>
<echo>| Creating tar.gz package |</echo>
<echo>-----------------------------</echo>
<svnlastrevision svnpath="svn" workingcopy="." propertyname="svn.lastrevision"/>
<property name="version" value="0.0.${svn.lastrevision}"/>
<property name="gztarfile" value="${build.base.dir}/${base.name}-${version}-pear.tar.gz"/>
<property name="bz2tarfile" value="${build.base.dir}/${base.name}-${version}-pear.tar.bz2"/>
<property name="zipfile" value="${build.base.dir}/${base.name}-${version}-pear.zip"/>
<delete file="${gztarfile}"/>
<delete file="${bz2tarfile}"/>
<delete file="${zipfile}"/>
<tar destFile="${gztarfile}" basedir="${build.dest.dir}" compression="gzip"/>
<tar destFile="${bz2tarfile}" basedir="${build.dest.dir}" compression="bzip2"/>
<zip destfile="${zipfile}" basedir="${build.dest.dir}"/>
</target>
</project>
Note for compiling the phpdocumentor help using the (current) revision 810 of
build.xml:
Use phing 2.2.0 tu build it. Version phing 2.3.0beta1 will not work.
UPDATE: If you edit the build.xml file and change the taskname from phpdoc to
phpdocext it will work with phing 2.3.0beta1.
If you used pear to install phing, then make sure, that the pear subfolder
pear/data is also in your php include_path. Otherwise you will get an error
'BUILD FAILED Can't load default task list'.
Note that there is a bug in phing 2.2.0 under windows. To fix it replace
in bin\phing.bat the line
set PHP_CLASSPATH="%PHING_HOME%\classes"
by
set PHP_CLASSPATH=%PHING_HOME%\classes
If you use phing 2.2.0 and fixed the bug calling tools\build>phing generate-docs
should compile the the help to build/tobuild/docs/API/phpdoc/html
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*
* Small command line script to bundle Doctrine classes in a single file.
*
* @author Nicolas Bérard-Nault <nicobn@php.net>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @package Doctrine
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
*/
if (count($argv) < 2) {
echo "Usage: bundle.php [Target file] <Library directory>\n\n".
"Note: If the library directory is ommited, the path will be deducted if possible\n";
exit(1);
} else if (count($argv) == 3) {
$doctrineBaseDir = $argv[2];
} else {
$pathInfos = pathinfo($_SERVER['PHP_SELF']);
$Cnt = 0;
if ($_SERVER['PHP_SELF'][0] == '/') {
$doctrineBaseDir = str_replace('tools/cli/' . $pathInfos['basename'],
'lib', $_SERVER['SCRIPT_NAME'], &$Cnt);
} else {
$doctrineBaseDir = str_replace('tools/cli/'. $pathInfos['basename'],
'lib', getcwd() .'/'. $_SERVER['SCRIPT_NAME'], &$Cnt);
}
if ($Cnt != 1) {
echo "Can't find library directory, please specify it as an argument\n";
exit(1);
}
}
$targetFile = $argv[1];
echo "Target file: $targetFile" . PHP_EOL;
echo "Base directory: $doctrineBaseDir" . PHP_EOL;
echo PHP_EOL;
set_include_path(get_include_path() . PATH_SEPARATOR . $doctrineBaseDir);
require_once 'Doctrine.php';
require_once 'Doctrine/Compiler.php';
spl_autoload_register(array('Doctrine', 'autoload'));
echo "Bundling classes and interfaces..." . PHP_EOL;
Doctrine_Compiler::compile($targetFile);
echo PHP_EOL . "Bundle complete." . PHP_EOL;
echo "File: $targetFile (size: ". number_format(filesize($targetFile) / 1024, 2, '.', '') ." kb)." . PHP_EOL;
exit(0);
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment