Commit 700acb25 authored by romanb's avatar romanb

Moved undecided/unclear items into TODO

parent f556ee8c
<?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.org>.
*/
Doctrine::autoload('Doctrine_Record_Listener');
/**
* Doctrine_AuditLog_Listener
*
* @package Doctrine
* @subpackage AuditLog
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener
{
protected $_auditLog;
public function __construct(Doctrine_AuditLog $auditLog)
{
$this->_auditLog = $auditLog;
}
public function preInsert(Doctrine_Event $event)
{
$versionColumn = $this->_auditLog->getOption('versionColumn');
$event->getInvoker()->set($versionColumn, 1);
}
public function postInsert(Doctrine_Event $event)
{
$class = $this->_auditLog->getOption('className');
$record = $event->getInvoker();
$version = new $class();
$version->merge($record->toArray());
$version->save();
}
public function preDelete(Doctrine_Event $event)
{
$class = $this->_auditLog->getOption('className');
$record = $event->getInvoker();
$versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn);
$record->set($versionColumn, ++$version);
$version = new $class();
$version->merge($record->toArray());
$version->save();
}
public function preUpdate(Doctrine_Event $event)
{
$class = $this->_auditLog->getOption('className');
$record = $event->getInvoker();
$versionColumn = $this->_auditLog->getOption('versionColumn');
$version = $record->get($versionColumn);
$record->set($versionColumn, ++$version);
$version = new $class();
$version->merge($record->toArray());
$version->save();
}
}
<?php
/*
* $Id: Exception.php 3570 2008-01-22 22:52:53Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Exception');
/**
* @package Doctrine
* @subpackage Import
* @url http://www.phpdoctrine.org
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
* @version $Id: Exception.php 3570 2008-01-22 22:52:53Z jwage $
*/
/**
* Doctrine_Builder_Exception
*
* @package Doctrine
* @subpackage Builder
* @link www.phpdoctrine.org
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0
* @version $Revision: 3570 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Builder_Exception extends Doctrine_Exception
{
}
\ No newline at end of file
<?php
/*
* $Id: Builder.php 2939 2007-10-19 14:23:42Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Builder_Migration
*
* @package Doctrine
* @subpackage Builder
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2939 $
*/
class Doctrine_Builder_Migration extends Doctrine_Builder
{
/**
* migrationsPath
*
* The path to your migration classes directory
*
* @var string
*/
private $_migrationsPath = '';
/**
* suffix
*
* File suffix to use when writing class definitions
*
* @var string $suffix
*/
private $_suffix = '.class.php';
/**
* tpl
*
* Class template used for writing classes
*
* @var $_tpl
*/
private static $_tpl;
/**
* __construct
*
* @return void
*/
public function __construct($migrationsPath = null)
{
if ($migrationsPath) {
$this->setMigrationsPath($migrationsPath);
}
$this->_loadTemplate();
}
/**
* setMigrationsPath
*
* @param string path the path where migration classes are stored and being generated
* @return
*/
public function setMigrationsPath($path)
{
Doctrine_Lib::makeDirectories($path);
$this->_migrationsPath = $path;
}
/**
* getMigrationsPath
*
* @return string the path where migration classes are stored and being generated
*/
public function getMigrationsPath()
{
return $this->_migrationsPath;
}
/**
* loadTemplate
*
* Loads the class template used for generating classes
*
* @return void
*/
protected function _loadTemplate()
{
if (isset(self::$_tpl)) {
return;
}
self::$_tpl =<<<END
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class %s extends %s
{
public function up()
{
%s
}
public function down()
{
%s
}
}
END;
}
/**
* generateMigrationsFromDb
*
* @return void
*/
public function generateMigrationsFromDb()
{
$directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp_doctrine_models';
Doctrine::generateModelsFromDb($directory);
$result = $this->generateMigrationsFromModels($directory);
Doctrine_Lib::removeDirectories($directory);
return $result;
}
/**
* generateMigrationsFromModels
*
* @param string $modelsPath
* @return void
*/
public function generateMigrationsFromModels($modelsPath = null)
{
if ($modelsPath) {
$models = Doctrine::loadModels($modelsPath);
} else {
$models = Doctrine::getLoadedModels();
}
$foreignKeys = array();
foreach ($models as $model) {
$export = Doctrine::getTable($model)->getExportableFormat();
$foreignKeys[$export['tableName']] = $export['options']['foreignKeys'];
$up = $this->buildCreateTable($export);
$down = $this->buildDropTable($export);
$className = 'Add' . Doctrine::classify($export['tableName']);
$this->generateMigrationClass($className, array(), $up, $down);
}
$className = 'ApplyForeignKeyConstraints';
$up = '';
$down = '';
foreach ($foreignKeys as $tableName => $definitions) {
$tableForeignKeyNames[$tableName] = array();
foreach ($definitions as $definition) {
$definition['name'] = $tableName . '_' . $definition['foreignTable'] . '_' . $definition['local'] . '_' . $definition['foreign'];
$up .= $this->buildCreateForeignKey($tableName, $definition);
$down .= $this->buildDropForeignKey($tableName, $definition);
}
}
$this->generateMigrationClass($className, array(), $up, $down);
return true;
}
/**
* buildCreateForeignKey
*
* @param string $tableName
* @param string $definition
* @return void
*/
public function buildCreateForeignKey($tableName, $definition)
{
return "\t\t\$this->createForeignKey('" . $tableName . "', " . var_export($definition, true) . ");";
}
/**
* buildDropForeignKey
*
* @param string $tableName
* @param string $definition
* @return void
*/
public function buildDropForeignKey($tableName, $definition)
{
return "\t\t\$this->dropForeignKey('" . $tableName . "', '" . $definition['name'] . "');\n";
}
/**
* buildCreateTable
*
* @param string $tableData
* @return void
*/
public function buildCreateTable($tableData)
{
$code = "\t\t\$this->createTable('" . $tableData['tableName'] . "', ";
$code .= var_export($tableData['columns'], true) . ", ";
$code .= var_export(array('indexes' => $tableData['options']['indexes'], 'primary' => $tableData['options']['primary']), true);
$code .= ");";
return $code;
}
/**
* buildDropTable
*
* @param string $tableData
* @return string
*/
public function buildDropTable($tableData)
{
return "\t\t\$this->dropTable('" . $tableData['tableName'] . "');";
}
/**
* generateMigrationClass
*
* @return void
*/
public function generateMigrationClass($className, $options = array(), $up = null, $down = null, $return = false)
{
if ($return || !$this->getMigrationsPath()) {
return $this->buildMigrationClass($className, null, $options, $up, $down);
} else {
if ( ! $this->getMigrationsPath()) {
throw new Doctrine_Migration_Exception('You must specify the path to your migrations.');
}
$migration = new Doctrine_Migration($this->getMigrationsPath());
$next = (string) $migration->getNextVersion();
$fileName = str_repeat('0', (3 - strlen($next))) . $next . '_' . Doctrine::tableize($className) . $this->_suffix;
$class = $this->buildMigrationClass($className, $fileName, $options, $up, $down);
$path = $this->getMigrationsPath() . DIRECTORY_SEPARATOR . $fileName;
file_put_contents($path, $class);
}
}
/**
* buildMigrationClass
*
* @return string
*/
public function buildMigrationClass($className, $fileName = null, $options = array(), $up = null, $down = null)
{
$extends = isset($options['extends']) ? $options['extends']:'Doctrine_Migration';
$content = '<?php' . PHP_EOL;
$content .= sprintf(self::$_tpl, $className,
$extends,
$up,
$down);
return $content;
}
}
This diff is collapsed.
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* $Id: AnsiColorFormatter.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_AnsiColorFormatter provides methods to colorize text to be displayed on a console.
*
* @package Doctrine
* @subpackage Cli
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: sfAnsiColorFormatter.class.php 5250 2007-09-24 08:11:50Z fabien $
*/
class Doctrine_Cli_AnsiColorFormatter extends Doctrine_Cli_Formatter
{
protected
$_styles = array(
'HEADER' => array('fg' => 'black', 'bold' => true),
'ERROR' => array('bg' => 'red', 'fg' => 'white', 'bold' => true),
'INFO' => array('fg' => 'green', 'bold' => true),
'COMMENT' => array('fg' => 'yellow'),
),
$_options = array('bold' => 1, 'underscore' => 4, 'blink' => 5, 'reverse' => 7, 'conceal' => 8),
$_foreground = array('black' => 30, 'red' => 31, 'green' => 32, 'yellow' => 33, 'blue' => 34, 'magenta' => 35, 'cyan' => 36, 'white' => 37),
$_background = array('black' => 40, 'red' => 41, 'green' => 42, 'yellow' => 43, 'blue' => 44, 'magenta' => 45, 'cyan' => 46, 'white' => 47);
/**
* Sets a new style.
*
* @param string The style name
* @param array An array of options
*/
public function setStyle($name, $options = array())
{
$this->_styles[$name] = $options;
}
/**
* Formats a text according to the given style or parameters.
*
* @param string The test to style
* @param mixed An array of options or a style name
*
* @return string The styled text
*/
public function format($text = '', $parameters = array(), $stream = STDOUT)
{
if ( ! $this->supportsColors($stream)) {
return $text;
}
if ( ! is_array($parameters) && 'NONE' == $parameters) {
return $text;
}
if ( ! is_array($parameters) && isset($this->_styles[$parameters])) {
$parameters = $this->_styles[$parameters];
}
$codes = array();
if (isset($parameters['fg'])) {
$codes[] = $this->_foreground[$parameters['fg']];
}
if (isset($parameters['bg'])) {
$codes[] = $this->_background[$parameters['bg']];
}
foreach ($this->_options as $option => $value) {
if (isset($parameters[$option]) && $parameters[$option]) {
$codes[] = $value;
}
}
return "\033[".implode(';', $codes).'m'.$text."\033[0m";
}
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public function formatSection($section, $text, $size = null)
{
$width = 9 + strlen($this->format('', 'INFO'));
return sprintf(">> %-${width}s %s", $this->format($section, 'INFO'), $this->excerpt($text, $size));
}
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public function excerpt($text, $size = null)
{
if ( ! $size) {
$size = $this->size;
}
if (strlen($text) < $size) {
return $text;
}
$subsize = floor(($size - 3) / 2);
return substr($text, 0, $subsize).$this->format('...', 'INFO').substr($text, -$subsize);
}
/**
* Returns true if the stream supports colorization.
*
* Colorization is disabled if not supported by the stream:
*
* - windows
* - non tty consoles
*
* @param mixed A stream
*
* @return Boolean true if the stream supports colorization, false otherwise
*/
public function supportsColors($stream)
{
return DIRECTORY_SEPARATOR != '\\' && function_exists('posix_isatty') && @posix_isatty($stream);
}
}
\ No newline at end of file
<?php
/*
* $Id: Exception.php 2761 2007-10-07 23:42:29Z zYne $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Cli_Exception
*
* @package Doctrine
* @subpackage Cli
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2761 $
* @author Jonathan H. Wage <jwage@mac.com>
*/
class Doctrine_Cli_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* $Id: Formatter.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Cli_Formatter provides methods to format text to be displayed on a console.
*
* @package Doctrine
* @subpackage Cli
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: Doctrine_Cli_Formatter.class.php 5250 2007-09-24 08:11:50Z fabien $
*/
class Doctrine_Cli_Formatter
{
protected $_size = 65;
/**
* __construct
*
* @param string $maxLineSize
* @return void
*/
function __construct($maxLineSize = 65)
{
$this->_size = $maxLineSize;
}
/**
* Formats a text according to the given parameters.
*
* @param string The test to style
* @param mixed An array of parameters
* @param stream A stream (default to STDOUT)
*
* @return string The formatted text
*/
public function format($text = '', $parameters = array(), $stream = STDOUT)
{
return $text;
}
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public function formatSection($section, $text, $size = null)
{
return sprintf(">> %-$9s %s", $section, $this->excerpt($text, $size));
}
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public function excerpt($text, $size = null)
{
if ( ! $size) {
$size = $this->_size;
}
if (strlen($text) < $size) {
return $text;
}
$subsize = floor(($size - 3) / 2);
return substr($text, 0, $subsize).'...'.substr($text, -$subsize);
}
/**
* Sets the maximum line size.
*
* @param integer The maximum line size for a message
*/
public function setMaxLineSize($size)
{
$this->_size = $size;
}
}
\ No newline at end of file
......@@ -134,7 +134,7 @@ class Doctrine_Collection implements Countable, IteratorAggregate, Serializable,
if ($keyField !== null) {
if ( ! $this->_em->getClassMetadata($entityBaseType)->hasField($keyField)) {
throw new Doctrine_Collection_Exception("Invalid field '$keyField' can't be uses as key.");
throw new Doctrine_Exception("Invalid field '$keyField' can't be uses as key.");
}
$this->_keyField = $keyField;
}
......
<?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.org>.
*/
/**
* Doctrine_Collection_Exception
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Collection_Iterator
* iterates through Doctrine_Collection
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
abstract class Doctrine_Collection_Iterator implements Iterator
{
/**
* @var Doctrine_Collection $collection
*/
protected $collection;
/**
* @var array $keys
*/
protected $keys;
/**
* @var mixed $key
*/
protected $key;
/**
* @var integer $index
*/
protected $index;
/**
* @var integer $count
*/
protected $count;
/**
* constructor
* @var Doctrine_Collection $collection
*/
public function __construct($collection)
{
$this->collection = $collection;
$this->keys = $this->collection->getKeys();
$this->count = $this->collection->count();
}
/**
* rewinds the iterator
*
* @return void
*/
public function rewind()
{
$this->index = 0;
$i = $this->index;
if (isset($this->keys[$i])) {
$this->key = $this->keys[$i];
}
}
/**
* returns the current key
*
* @return integer
*/
public function key()
{
return $this->key;
}
/**
* returns the current record
*
* @return Doctrine_Entity
*/
public function current()
{
return $this->collection->get($this->key);
}
/**
* advances the internal pointer
*
* @return void
*/
public function next()
{
$this->index++;
$i = $this->index;
if (isset($this->keys[$i])) {
$this->key = $this->keys[$i];
}
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Collection_Iterator_Normal
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Expandable extends Doctrine_Collection_Iterator
{
public function valid()
{
if ($this->index < $this->count) {
return true;
} elseif ($this->index == $this->count) {
$coll = $this->collection->expand($this->index);
if ($coll instanceof Doctrine_Collection) {
$count = count($coll);
if ($count > 0) {
$this->keys = array_merge($this->keys, $coll->getKeys());
$this->count += $count;
return true;
}
}
return false;
}
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Collection_Iterator_Normal
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Normal extends Doctrine_Collection_Iterator
{
/**
* @return boolean whether or not the iteration will continue
*/
public function valid()
{
return ($this->index < $this->count);
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Collection_Iterator_Normal
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Offset extends Doctrine_Collection_Iterator
{
public function valid()
{ }
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Collection_Offset
* Collection of Doctrine_Entity objects.
*
* @package Doctrine
* @subpackage Collection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Offset extends Doctrine_Collection
{
/**
* @var integer $limit
*/
private $limit;
/**
* @param Doctrine_Table $table
*/
public function __construct(Doctrine_Table $table)
{
parent::__construct($table);
$this->limit = $table->getAttribute(Doctrine::ATTR_COLL_LIMIT);
}
/**
* @return integer
*/
public function getLimit()
{
return $this->limit;
}
/**
* @return Doctrine_Collection_Iterator_Expandable
*/
public function getIterator()
{
return new Doctrine_Collection_Iterator_Expandable($this);
}
}
<?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.org>.
*/
/**
* Doctrine_Compiler_Exception
*
* @package Doctrine
* @subpackage Compiler
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @deprecated
*/
class Doctrine_Compiler_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?php
/*
* $Id: Exception.php 2552 2007-09-19 19:33:00Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Data_Exception
*
* @package Doctrine
* @subpackage Data
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2552 $
*/
class Doctrine_Data_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?php
/*
* $Id: Export.php 2552 2007-09-19 19:33:00Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Data_Export
*
* @package Doctrine
* @subpackage Data
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2552 $
*/
class Doctrine_Data_Export extends Doctrine_Data
{
/**
* constructor
*
* @param string $directory
* @return void
*/
public function __construct($directory)
{
$this->setDirectory($directory);
}
/**
* doExport
*
* @return void
*/
public function doExport()
{
$models = Doctrine::getLoadedModels();
$specifiedModels = $this->getModels();
$data = array();
$outputAll = true;
// for situation when the $models array is empty, but the $specifiedModels array isn't
if (empty($models)) {
$models = $specifiedModels;
}
foreach ($models AS $name) {
if ( ! empty($specifiedModels) AND !in_array($name, $specifiedModels)) {
continue;
}
$class = new $name();
$table = $class->getTable();
$result = $table->findAll();
if ( ! empty($result)) {
$data[$name] = $result;
}
}
$data = $this->prepareData($data);
return $this->dumpData($data);
}
/**
* dumpData
*
* Dump the prepared data to the fixtures files
*
* @param string $array
* @return void
*/
public function dumpData(array $data)
{
$directory = $this->getDirectory();
$format = $this->getFormat();
if ($this->exportIndividualFiles()) {
if (is_array($directory)) {
throw new Doctrine_Data_Exception('You must specify a single path to a folder in order to export individual files.');
} else if ( ! is_dir($directory) && is_file($directory)) {
$directory = dirname($directory);
}
foreach ($data as $className => $classData) {
if ( ! empty($classData)) {
Doctrine_Parser::dump(array($className => $classData), $format, $directory.DIRECTORY_SEPARATOR.$className.'.'.$format);
}
}
} else {
if (is_dir($directory)) {
$directory .= DIRECTORY_SEPARATOR . 'data.' . $format;
}
if ( ! empty($data)) {
return Doctrine_Parser::dump($data, $format, $directory);
}
}
}
/**
* prepareData
*
* Prepare the raw data to be exported with the parser
*
* @param string $data
* @return array
*/
public function prepareData($data)
{
$preparedData = array();
foreach ($data AS $className => $classData) {
foreach ($classData as $record) {
$className = get_class($record);
$recordKey = $className . '_' . implode('_', $record->identifier());
$recordData = $record->toArray();
foreach ($recordData as $key => $value) {
if ( ! $value) {
continue;
}
// skip single primary keys, we need to maintain composite primary keys
$keys = (array)$record->getTable()->getIdentifier();
if (count($keys) <= 1 && in_array($key, $keys)) {
continue;
}
if ($relation = $this->isRelation($record, $key)) {
$relationAlias = $relation['alias'];
$relationRecord = $record->$relationAlias;
// If collection then get first so we have an instance of the related record
if ($relationRecord instanceof Doctrine_Collection) {
$relationRecord = $relationRecord->getFirst();
}
// If relation is null or does not exist then continue
if ($relationRecord instanceof Doctrine_Null || !$relationRecord) {
continue;
}
// Get class name for relation
$relationClassName = get_class($relationRecord);
$relationValue = $relationClassName . '_' . $value;
$preparedData[$className][$recordKey][$relationAlias] = $relationValue;
} else {
$preparedData[$className][$recordKey][$key] = $value;
}
}
}
}
return $preparedData;
}
}
\ No newline at end of file
This diff is collapsed.
<?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.org>.
*/
/**
* Doctrine_File_Index
*
* @package Doctrine
* @subpackage File
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
*/
class Doctrine_File_Index extends Doctrine_Entity
{
public function setTableDefinition()
{
$this->hasColumn('keyword', 'string', 255, array('notnull' => true,
'primary' => true));
$this->hasColumn('field', 'string', 50, array('notnull' => true,
'primary' => true));
$this->hasColumn('position', 'string', 255, array('notnull' => true,
'primary' => true));
$this->hasColumn('file_id', 'integer', 8, array('notnull' => true,
'primary' => true));
}
public function setUp()
{
$this->hasOne('Doctrine_File', array('local' => 'file_id',
'foreign' => 'id',
'onDelete' => 'CASCADE',
'onUpdate' => 'CASCADE'));
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_FileFinder_GlobToRegex
*
* Match globbing patterns against text.
*
* if match_glob("foo.*", "foo.bar") echo "matched\n";
*
* // prints foo.bar and foo.baz
* $regex = globToRegex("foo.*");
* for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
* {
* if (/$regex/) echo "matched: $car\n";
* }
*
* Doctrine_FileFinder_GlobToRegex implements glob(3) style matching that can be used to match
* against text, rather than fetching names from a filesystem.
*
* based on perl Text::Glob module.
*
* @package Doctrine
* @subpackage FileFinder
* @author Fabien Potencier <fabien.potencier@gmail.com> php port
* @author Richard Clamp <richardc@unixbeard.net> perl version
* @copyright 2004-2005 Fabien Potencier <fabien.potencier@gmail.com>
* @copyright 2002 Richard Clamp <richardc@unixbeard.net>
* @version SVN: $Id: Doctrine_FileFinder.class.php 5110 2007-09-15 12:07:18Z fabien $
*/
class Doctrine_FileFinder_GlobToRegex
{
protected static $strictLeadingDot = true;
protected static $strictWildcardSlash = true;
public static function setStrictLeadingDot($boolean)
{
self::$strictLeadingDot = $boolean;
}
public static function setStrictWildcardSlash($boolean)
{
self::$strictWildcardSlash = $boolean;
}
/**
* Returns a compiled regex which is the equiavlent of the globbing pattern.
*
* @param string glob pattern
* @return string regex
*/
public static function globToRegex($glob)
{
$firstByte = true;
$escaping = false;
$inCurlies = 0;
$regex = '';
for ($i = 0; $i < strlen($glob); $i++) {
$car = $glob[$i];
if ($firstByte) {
if (self::$strictLeadingDot && $car != '.') {
$regex .= '(?=[^\.])';
}
$firstByte = false;
}
if ($car == '/') {
$firstByte = true;
}
if ($car == '.' || $car == '(' || $car == ')' || $car == '|' || $car == '+' || $car == '^' || $car == '$') {
$regex .= "\\$car";
} else if ($car == '*') {
$regex .= ($escaping ? "\\*" : (self::$strictWildcardSlash ? "[^/]*" : ".*"));
} else if ($car == '?') {
$regex .= ($escaping ? "\\?" : (self::$strictWildcardSlash ? "[^/]" : "."));
} else if ($car == '{') {
$regex .= ($escaping ? "\\{" : "(");
if ( ! $escaping) {
++$inCurlies;
}
} else if ($car == '}' && $inCurlies) {
$regex .= ($escaping ? "}" : ")");
if ( ! $escaping) {
--$inCurlies;
}
} else if ($car == ',' && $inCurlies) {
$regex .= ($escaping ? "," : "|");
} else if ($car == "\\") {
if ($escaping) {
$regex .= "\\\\";
$escaping = false;
} else {
$escaping = true;
}
continue;
} else {
$regex .= $car;
$escaping = false;
}
$escaping = false;
}
return "#^$regex$#";
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_FileFinder_NumberCompare
*
* Numeric comparisons.
*
* Doctrine_FileFinder_NumberCompare compiles a simple comparison to an anonymous
* subroutine, which you can call with a value to be tested again.
*
* Now this would be very pointless, if Doctrine_FileFinder_NumberCompare didn't understand
* magnitudes.
*
* The target value may use magnitudes of kilobytes (k, ki),
* megabytes (m, mi), or gigabytes (g, gi). Those suffixed
* with an i use the appropriate 2**n version in accordance with the
* IEC standard: http://physics.nist.gov/cuu/Units/binary.html
*
* based on perl Number::Compare module.
*
* @package Doctrine
* @subpackage FileFinder
* @author Fabien Potencier <fabien.potencier@gmail.com> php port
* @author Richard Clamp <richardc@unixbeard.net> perl version
* @copyright 2004-2005 Fabien Potencier <fabien.potencier@gmail.com>
* @copyright 2002 Richard Clamp <richardc@unixbeard.net>
* @see http://physics.nist.gov/cuu/Units/binary.html
* @version SVN: $Id: Doctrine_FileFinder.class.php 5110 2007-09-15 12:07:18Z fabien $
*/
class Doctrine_FileFinder_NumberCompare
{
protected $test = '';
public function __construct($test)
{
$this->test = $test;
}
public function test($number)
{
if ( ! preg_match('{^([<>]=?)?(.*?)([kmg]i?)?$}i', $this->test, $matches)) {
throw new Doctrine_Exception(sprintf('don\'t understand "%s" as a test.', $this->test));
}
$target = array_key_exists(2, $matches) ? $matches[2] : '';
$magnitude = array_key_exists(3, $matches) ? $matches[3] : '';
if (strtolower($magnitude) == 'k') {
$target *= 1000;
}
if (strtolower($magnitude) == 'ki') {
$target *= 1024;
}
if (strtolower($magnitude) == 'm') {
$target *= 1000000;
}
if (strtolower($magnitude) == 'mi') {
$target *= 1024*1024;
}
if (strtolower($magnitude) == 'g') {
$target *= 1000000000;
}
if (strtolower($magnitude) == 'gi') {
$target *= 1024*1024*1024;
}
$comparison = array_key_exists(1, $matches) ? $matches[1] : '==';
if ($comparison == '==' || $comparison == '') {
return ($number == $target);
} else if ($comparison == '>') {
return ($number > $target);
} else if ($comparison == '>=') {
return ($number >= $target);
} else if ($comparison == '<') {
return ($number < $target);
} else if ($comparison == '<=') {
return ($number <= $target);
}
return false;
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_I18n_Exception
*
* @package Doctrine
* @subpackage I18n
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_I18n_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?php
/*
* $Id: Exception.php 3155 2007-11-14 13:13:23Z ppetermann $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @category Doctrine
* @package Log
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Exception extends Doctrine_Exception
{
}
\ No newline at end of file
<?php
/*
* $Id: Interface.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
interface Doctrine_Log_Filter_Interface
{
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event);
}
\ No newline at end of file
<?php
/*
* $Id: Message.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Filter_Message implements Doctrine_Log_Filter_Interface
{
/**
* @var string
*/
protected $_regexp;
/**
* Filter out any log messages not matching $regexp.
*
* @param string $regexp Regular expression to test the log message
* @throws Doctrine_Log_Exception
*/
public function __construct($regexp)
{
if (@preg_match($regexp, '') === false) {
throw new Doctrine_Log_Exception("Invalid regular expression '$regexp'");
}
$this->_regexp = $regexp;
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return preg_match($this->_regexp, $event['message']) > 0;
}
}
\ No newline at end of file
<?php
/*
* $Id: Priority.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Filter_Priority implements Doctrine_Log_Filter_Interface
{
/**
* @var integer
*/
protected $_priority;
/**
* @var string
*/
protected $_operator;
/**
* Filter logging by $priority. By default, it will accept any log
* event whose priority value is less than or equal to $priority.
*
* @param integer $priority Priority
* @param string $operator Comparison operator
* @throws Doctrine_Log_Exception
*/
public function __construct($priority, $operator = '<=')
{
if (! is_integer($priority)) {
throw new Doctrine_Log_Exception('Priority must be an integer');
}
$this->_priority = $priority;
$this->_operator = $operator;
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return version_compare($event['priority'], $this->_priority, $this->_operator);
}
}
\ No newline at end of file
<?php
/*
* $Id: Suppress.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Filter_Suppress implements Doctrine_Log_Filter_Interface
{
/**
* @var boolean
*/
protected $_accept = true;
/**
* This is a simple boolean filter.
*
* Call suppress(true) to suppress all log events.
* Call suppress(false) to accept all log events.
*
* @param boolean $suppress Should all log events be suppressed?
* @return void
*/
public function suppress($suppress)
{
$this->_accept = (! $suppress);
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return $this->_accept;
}
}
\ No newline at end of file
<?php
/*
* $Id: Interface.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
interface Doctrine_Log_Formatter_Interface
{
/**
* Formats data into a single line to be written by the writer.
*
* @param array $event event data
* @return string formatted line to write to the log
*/
public function format($event);
}
\ No newline at end of file
<?php
/*
* $Id: Simple.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Formatter_Simple implements Doctrine_Log_Formatter_Interface
{
/**
* @var string
*/
protected $_format;
/**
* Class constructor
*
* @param null|string $format Format specifier for log messages
* @throws Doctrine_Log_Exception
*/
public function __construct($format = null)
{
if ($format === null) {
$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;
}
if (! is_string($format)) {
throw new Doctrine_Log_Exception('Format must be a string');
}
$this->_format = $format;
}
/**
* Formats data into a single line to be written by the writer.
*
* @param array $event event data
* @return string formatted line to write to the log
*/
public function format($event)
{
$output = $this->_format;
foreach ($event as $name => $value) {
$output = str_replace("%$name%", $value, $output);
}
return $output;
}
}
\ No newline at end of file
<?php
/*
* $Id: Xml.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Formatter_Xml implements Doctrine_Log_Formatter_Interface
{
/**
* @var Relates XML elements to log data field keys.
*/
protected $_rootElement;
/**
* @var Relates XML elements to log data field keys.
*/
protected $_elementMap;
/**
* Class constructor
*
* @param array $elementMap
*/
public function __construct($rootElement = 'logEntry', $elementMap = null)
{
$this->_rootElement = $rootElement;
$this->_elementMap = $elementMap;
}
/**
* Formats data into a single line to be written by the writer.
*
* @param array $event event data
* @return string formatted line to write to the log
*/
public function format($event)
{
if ($this->_elementMap === null) {
$dataToInsert = $event;
} else {
$dataToInsert = array();
foreach ($this->_elementMap as $elementName => $fieldKey) {
$dataToInsert[$elementName] = $event[$fieldKey];
}
}
$dom = new DOMDocument();
$elt = $dom->appendChild(new DOMElement($this->_rootElement));
foreach ($dataToInsert as $key => $value) {
$elt->appendChild(new DOMElement($key, $value));
}
$xml = $dom->saveXML();
$xml = preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml);
return $xml . PHP_EOL;
}
}
\ No newline at end of file
<?php
/*
* $Id: Abstract.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
abstract class Doctrine_Log_Writer_Abstract
{
/**
* @var array of Doctrine_Log_Filter_Interface
*/
protected $_filters = array();
/**
* Formats the log message before writing.
* @var Doctrine_Log_Formatter_Interface
*/
protected $_formatter;
/**
* Add a filter specific to this writer.
*
* @param Doctrine_Log_Filter_Interface $filter
* @return void
*/
public function addFilter($filter)
{
if (is_integer($filter)) {
$filter = new Doctrine_Log_Filter_Priority($filter);
}
$this->_filters[] = $filter;
}
/**
* Log a message to this writer.
*
* @param array $event log data event
* @return void
*/
public function write($event)
{
foreach ($this->_filters as $filter) {
if (! $filter->accept($event)) {
return;
}
}
// exception occurs on error
$this->_write($event);
}
/**
* Set a new formatter for this writer
*
* @param Doctrine_Log_Formatter_Interface $formatter
* @return void
*/
public function setFormatter($formatter) {
$this->_formatter = $formatter;
}
/**
* Perform shutdown activites such as closing open resources
*
* @return void
*/
public function shutdown()
{}
/**
* Write a message to the log.
*
* @param array $event log data event
* @return void
*/
abstract protected function _write($event);
}
\ No newline at end of file
<?php
/*
* $Id: Db.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Writer_Db extends Doctrine_Log_Writer_Abstract
{
/**
* Doctrine_Table instance
*
* @var string
*/
private $_table;
/**
* Relates database columns names to log data field keys.
*
* @var null|array
*/
private $_columnMap;
/**
* Class constructor
*
* @param Doctrine_Db_Adapter $db Database adapter instance
* @param string $table Log table in database
* @param array $columnMap
*/
public function __construct($table, $columnMap = null)
{
if (!$table instanceof Doctrine_Table) {
$table = Doctrine::getTable($table);
}
$this->_table = $table;
$this->_columnMap = $columnMap;
}
/**
* Formatting is not possible on this writer
*/
public function setFormatter($formatter)
{
throw new Doctrine_Log_Exception(get_class() . ' does not support formatting');
}
/**
* Remove reference to database adapter
*
* @return void
*/
public function shutdown()
{
$this->_table = null;
}
/**
* Write a message to the log.
*
* @param array $event event data
* @return void
*/
protected function _write($event)
{
if ($this->_table === null) {
throw new Doctrine_Log_Exception('Database adapter instance has been removed by shutdown');
}
if ($this->_columnMap === null) {
$dataToInsert = $event;
} else {
$dataToInsert = array();
foreach ($this->_columnMap as $columnName => $fieldKey) {
$dataToInsert[$columnName] = $event[$fieldKey];
}
}
$record = $this->_table->create($dataToInsert);
$record->save();
}
}
\ No newline at end of file
<?php
/*
* $Id: Mock.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Writer_Mock extends Doctrine_Log_Writer_Abstract
{
/**
* array of log events
*/
public $events = array();
/**
* shutdown called?
*/
public $shutdown = false;
/**
* Write a message to the log.
*
* @param array $event event data
* @return void
*/
public function _write($event)
{
$this->events[] = $event;
}
/**
* Record shutdown
*
* @return void
*/
public function shutdown()
{
$this->shutdown = true;
}
}
\ No newline at end of file
<?php
/*
* $Id: Null.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Writer_Null extends Doctrine_Log_Writer_Abstract
{
/**
* Write a message to the log.
*
* @param array $event event data
* @return void
*/
protected function _write($event)
{
}
}
\ No newline at end of file
<?php
/*
* $Id: Stream.php 3155 2007-11-14 13:13:23Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* @package Doctrine
* @subpackage Log
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 3155 $
*/
class Doctrine_Log_Writer_Stream extends Doctrine_Log_Writer_Abstract
{
/**
* Holds the PHP stream to log to.
* @var null|stream
*/
protected $_stream = null;
/**
* Class Constructor
*
* @param streamOrUrl Stream or URL to open as a stream
* @param mode Mode, only applicable if a URL is given
*/
public function __construct($streamOrUrl, $mode = 'a')
{
if (is_resource($streamOrUrl)) {
if (get_resource_type($streamOrUrl) != 'stream') {
throw new Doctrine_Log_Exception('Resource is not a stream');
}
if ($mode != 'a') {
throw new Doctrine_Log_Exception('Mode cannot be changed on existing streams');
}
$this->_stream = $streamOrUrl;
} else {
if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) {
$msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\"";
throw new Doctrine_Log_Exception($msg);
}
}
$this->_formatter = new Doctrine_Log_Formatter_Simple();
}
/**
* Close the stream resource.
*
* @return void
*/
public function shutdown()
{
if (is_resource($this->_stream)) {
fclose($this->_stream);
}
}
/**
* Write a message to the log.
*
* @param array $event event data
* @return void
*/
protected function _write($event)
{
$line = $this->_formatter->format($event);
if (false === @fwrite($this->_stream, $line)) {
throw new Doctrine_Log_Exception("Unable to write to stream");
}
}
}
\ No newline at end of file
<?php
/*
* $Id: Diff.php 1080 2007-02-10 18:17:08Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Migration_Diff
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Migration_Diff
{
protected $_from,
$_to,
$_changes = array(),
$_migrationsPath;
public function __construct($from = null, $to = null)
{
$this->_from = $from;
$this->_to = $to;
}
protected function getUniqueId()
{
return md5($this->_from.$this->_to);
}
public function setMigrationsPath($migrationsPath)
{
$this->_migrationsPath = $migrationsPath;
}
public function generate()
{
$from = $this->_generateModels('From', $this->_from);
$to = $this->_generateModels('To', $this->_to);
$differences = $this->_diff($from, $to);
print_r($differences);
}
protected function _diff($from, $to)
{
$fromTmpPath = sys_get_temp_dir() . $this->getUniqueId() . '_from';
$toTmpPath = sys_get_temp_dir() . $this->getUniqueId() . '_to';
if ( ! file_exists($fromTmpPath)) {
$fromModels = Doctrine::loadModels($from);
$fromInfo = $this->_buildModelInformation($fromModels);
file_put_contents($fromTmpPath, serialize($fromInfo));
} else {
if ( ! file_exists($toTmpPath)) {
$toModels = Doctrine::loadModels($to);
$toInfo = $this->_buildModelInformation($toModels);
file_put_contents($toTmpPath, serialize($toInfo));
} else {
$fromInfo = unserialize(file_get_contents($fromTmpPath));
$toInfo = unserialize(file_get_contents($toTmpPath));
$this->_buildChanges($fromInfo, $toInfo);
// clean up
unlink($fromTmpPath);
unlink($toTmpPath);
Doctrine_Lib::removeDirectories(sys_get_temp_dir() . 'from_doctrine_tmp_dirs');
Doctrine_Lib::removeDirectories(sys_get_temp_dir() . 'to_doctrine_tmp_dirs');
}
}
}
protected function _buildChanges($from, $to)
{
foreach ($to as $key => $model) {
$columns = $model['columns'];
foreach ($columns as $columnKey => $column) {
//if (isset($to[$key]['columns'][$columnKey]))
}
}
}
protected function _buildModelInformation(array $models)
{
$info = array();
foreach ($models as $key => $model) {
$info[$model] = Doctrine::getTable($model)->getExportableFormat();
}
return $info;
}
protected function _generateModels($prefix, $item)
{
$path = sys_get_temp_dir() . $prefix . '_doctrine_tmp_dirs';
if ( is_dir($item)) {
$files = glob($item . DIRECTORY_SEPARATOR . '*.*');
if (isset($files[0])) {
$pathInfo = pathinfo($files[0]);
$extension = $pathInfo['extension'];
}
if ($extension === 'yml') {
Doctrine::generateModelsFromYaml($item, $path);
return $path;
} else if ($extension === 'php') {
Doctrine_Lib::copyDirectory($item, $path);
return $path;
} else {
throw new Doctrine_Migration_Exception('No php or yml files found at path: "' . $item . '"');
}
} else {
try {
$connection = Doctrine_Manager::getInstance()->getConnection($item);
Doctrine::generateModelsFromDb($path, array($item));
return $path;
} catch (Exception $e) {
throw new Doctrine_Migration_Exception('Could not generate models from connection: ' . $e->getMessage());
}
}
}
}
\ No newline at end of file
<?php
/*
* $Id: Exception.php 1080 2007-02-10 18:17:08Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Migration_Exception
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jwage@mac.com>
*/
class Doctrine_Migration_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?php
/*
* $Id: IrreversibleMigration.php 1080 2007-02-10 18:17:08Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Migration_IrreversibleMigration
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jwage@mac.com>
*/
class Doctrine_Migration_IrreversibleMigrationException extends Doctrine_Migration_Exception
{ }
\ No newline at end of file
<?php
/*
* $Id: Process.php 1080 2007-02-10 18:17:08Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Migration_Process
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jwage@mac.com>
*/
class Doctrine_Migration_Process
{
/**
* getConnection
*
* @param string $tableName
* @return void
*/
public function getConnection($tableName)
{
return Doctrine::getConnectionByTableName($tableName);
}
/**
* processCreatedTables
*
* @param string $tables
* @return void
*/
public function processCreatedTables($tables)
{
foreach ($tables as $table) {
$conn = $this->getConnection($table['tableName']);
$conn->export->createTable($table['tableName'], $table['fields'], $table['options']);
}
}
/**
* processDroppedTables
*
* @param string $tables
* @return void
*/
public function processDroppedTables($tables)
{
foreach ($tables as $table) {
$conn = $this->getConnection($table['tableName']);
$conn->export->dropTable($table['tableName']);
}
}
/**
* processRenamedTables
*
* @param string $tables
* @return void
*/
public function processRenamedTables($tables)
{
foreach ($tables as $table) {
$conn = $this->getConnection($table['newTableName']);
$conn->export->alterTable($table['oldTableName'], array('name' => $table['newTableName']));
}
}
/**
* processAddedColumns
*
* @param string $columns
* @return void
*/
public function processAddedColumns($columns)
{
foreach ($columns as $column) {
$conn = $this->getConnection($column['tableName']);
$options = array();
$options = $column['options'];
$options['type'] = $column['type'];
$conn->export->alterTable($column['tableName'], array('add' => array($column['columnName'] => $options)));
}
}
/**
* processRenamedColumns
*
* @param string $columns
* @return void
*/
public function processRenamedColumns($columns)
{
foreach ($columns as $column) {
$conn = $this->getConnection($column['tableName']);
$columnList = $conn->import->listTableColumns($column['tableName']);
if (isset($columnList[$column['oldColumnName']])) {
$conn->export->alterTable($column['tableName'],
array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName'],
'definition'=>$columnList[$column['oldColumnName']]))));
}
}
}
/**
* processChangedColumns
*
* @param string $columns
* @return void
*/
public function processChangedColumns($columns)
{
foreach ($columns as $column) {
$conn = $this->getConnection($column['tableName']);
$options = array();
$options = $column['options'];
$options['type'] = $column['type'];
$conn->export->alterTable($column['tableName'], array('change' => array($column['columnName'] => array('definition' => $options))));
}
}
/**
* processRemovedColumns
*
* @param string $columns
* @return void
*/
public function processRemovedColumns($columns)
{
foreach ($columns as $column) {
$conn = $this->getConnection($column['tableName']);
$conn->export->alterTable($column['tableName'], array('remove' => array($column['columnName'] => array())));
}
}
/**
* processAddexIndexes
*
* @param string $indexes
* @return void
*/
public function processAddedIndexes($indexes)
{
foreach ($indexes as $index) {
$conn = $this->getConnection($index['tableName']);
$conn->export->createIndex($index['tableName'], $index['indexName'], $index['definition']);
}
}
/**
* processRemovedIndexes
*
* @param string $indexes
* @return void
*/
public function processRemovedIndexes($indexes)
{
foreach ($indexes as $index) {
$conn = $this->getConnection($index['tableName']);
$conn->export->dropIndex($index['tableName'], $index['indexName']);
}
}
/**
* processCreatedConstraints
*
* @param string $constraints
* @return void
*/
public function processCreatedConstraints($constraints)
{
foreach ($constraints as $constraint) {
$conn = $this->getConnection($constraint['tableName']);
$conn->export->createConstraint($constraint['tableName'], $constraint['constraintName'],
$constraint['definition']);
}
}
/**
* processDroppedConstraints
*
* @param string $constraints
* @return void
*/
public function processDroppedConstraints($constraints)
{
foreach ($constraints as $constraint) {
$conn = $this->getConnection($constraint['tableName']);
$conn->export->dropConstraint($constraint['tableName'], $constraint['constraintName'],
$constraint['primary']);
}
}
/**
* processCreatedFks
*
* @param string $foreignKeys
* @return void
*/
public function processCreatedFks($foreignKeys)
{
foreach ($foreignKeys as $fk) {
$conn = $this->getConnection($fk['tableName']);
$conn->export->createForeignKey($fk['tableName'], $fk['definition']);
}
}
/**
* processDroppedFks
*
* @param string $foreignKeys
* @return void
*/
public function processDroppedFks($foreignKeys)
{
foreach ($foreignKeys as $fk) {
$conn = $this->getConnection($fk['tableName']);
$conn->export->dropForeignKey($fk['tableName'], $fk['fkName']);
}
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_AdjacencyList
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
abstract class Doctrine_Node_AdjacencyList extends Doctrine_Node implements Doctrine_Node_Interface
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_AdjacencyList_LevelOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
abstract class Doctrine_Node_AdjacencyList_LevelOrderIterator implements Iterator
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_AdjacencyList_PostOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
abstract class Doctrine_Node_AdjacencyList_PostOrderIterator implements Iterator
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_AdjacencyList_PreOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
abstract class Doctrine_Node_AdjacencyList_PreOrderIterator implements Iterator
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_Exception
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_Interface
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
interface Doctrine_Node_Interface {
/**
* test if node has previous sibling
*
* @return bool
*/
public function hasPrevSibling();
/**
* test if node has next sibling
*
* @return bool
*/
public function hasNextSibling();
/**
* test if node has children
*
* @return bool
*/
public function hasChildren();
/**
* test if node has parent
*
* @return bool
*/
public function hasParent();
/**
* gets record of prev sibling or empty record
*
* @return object Doctrine_Entity
*/
public function getPrevSibling();
/**
* gets record of next sibling or empty record
*
* @return object Doctrine_Entity
*/
public function getNextSibling();
/**
* gets siblings for node
*
* @return array array of sibling Doctrine_Entity objects
*/
public function getSiblings($includeNode = false);
/**
* gets record of first child or empty record
*
* @return object Doctrine_Entity
*/
public function getFirstChild();
/**
* gets record of last child or empty record
*
* @return object Doctrine_Entity
*/
public function getLastChild();
/**
* gets children for node (direct descendants only)
*
* @return array array of sibling Doctrine_Entity objects
*/
public function getChildren();
/**
* gets descendants for node (direct descendants only)
*
* @return iterator iterator to traverse descendants from node
*/
public function getDescendants();
/**
* gets record of parent or empty record
*
* @return object Doctrine_Entity
*/
public function getParent();
/**
* gets ancestors for node
*
* @return object Doctrine_Collection
*/
public function getAncestors();
/**
* gets path to node from root, uses record::toString() method to get node names
*
* @param string $seperator path seperator
* @param bool $includeNode whether or not to include node at end of path
* @return string string representation of path
*/
public function getPath($seperator = ' > ', $includeNode = false);
/**
* gets level (depth) of node in the tree
*
* @return int
*/
public function getLevel();
/**
* gets number of children (direct descendants)
*
* @return int
*/
public function getNumberChildren();
/**
* gets number of descendants (children and their children)
*
* @return int
*/
public function getNumberDescendants();
/**
* inserts node as parent of dest record
*
* @return bool
*/
public function insertAsParentOf(Doctrine_Entity $dest);
/**
* inserts node as previous sibling of dest record
*
* @return bool
*/
public function insertAsPrevSiblingOf(Doctrine_Entity $dest);
/**
* inserts node as next sibling of dest record
*
* @return bool
*/
public function insertAsNextSiblingOf(Doctrine_Entity $dest);
/**
* inserts node as first child of dest record
*
* @return bool
*/
public function insertAsFirstChildOf(Doctrine_Entity $dest);
/**
* inserts node as first child of dest record
*
* @return bool
*/
public function insertAsLastChildOf(Doctrine_Entity $dest);
/**
* moves node as prev sibling of dest record
*
*/
public function moveAsPrevSiblingOf(Doctrine_Entity $dest);
/**
* moves node as next sibling of dest record
*
*/
public function moveAsNextSiblingOf(Doctrine_Entity $dest);
/**
* moves node as first child of dest record
*
*/
public function moveAsFirstChildOf(Doctrine_Entity $dest);
/**
* moves node as last child of dest record
*
*/
public function moveAsLastChildOf(Doctrine_Entity $dest);
/**
* adds node as last child of record
*
*/
public function addChild(Doctrine_Entity $record);
/**
* determines if node is leaf
*
* @return bool
*/
public function isLeaf();
/**
* determines if node is root
*
* @return bool
*/
public function isRoot();
/**
* determines if node is equal to subject node
*
* @return bool
*/
public function isEqualTo(Doctrine_Entity $subj);
/**
* determines if node is child of subject node
*
* @return bool
*/
public function isDescendantOf(Doctrine_Entity $subj);
/**
* determines if node is child of or sibling to subject node
*
* @return bool
*/
public function isDescendantOfOrEqualTo(Doctrine_Entity $subj);
/**
* determines if node is valid
*
* @return bool
*/
public function isValidNode();
/**
* deletes node and it's descendants
*
*/
public function delete();
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_MaterializedPath
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
abstract class Doctrine_Node_MaterializedPath extends Doctrine_Node implements Doctrine_Node_Interface
{ }
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_MaterializedPath_LevelOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node_MaterializedPath_LevelOrderIterator implements Iterator
{
private $topNode = null;
private $curNode = null;
public function __construct($node, $opts)
{
throw new Doctrine_Exception('Not yet implemented');
}
public function rewind()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function valid()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function current()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function key()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function next()
{
throw new Doctrine_Exception('Not yet implemented');
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_MaterializedPath_PostOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node_MaterializedPath_PostOrderIterator implements Iterator
{
private $topNode = null;
private $curNode = null;
public function __construct($node, $opts)
{
throw new Doctrine_Exception('Not yet implemented');
}
public function rewind()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function valid()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function current()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function key()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function next()
{
throw new Doctrine_Exception('Not yet implemented');
}
}
\ No newline at end of file
<?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.org>.
*/
/**
* Doctrine_Node_MaterializedPath_PreOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node_MaterializedPath_PreOrderIterator implements Iterator
{
private $topNode = null;
private $curNode = null;
public function __construct($node, $opts)
{
throw new Doctrine_Exception('Not yet implemented');
}
public function rewind()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function valid()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function current()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function key()
{
throw new Doctrine_Exception('Not yet implemented');
}
public function next()
{
throw new Doctrine_Exception('Not yet implemented');
}
}
\ No newline at end of file
This diff is collapsed.
<?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.org>.
*/
/**
* Doctrine_Node_NestedSet_LevelOrderIterator
*
* @package Doctrine
* @subpackage Node
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Joe Simms <joe.simms@websites4.com>
*/
class Doctrine_Node_NestedSet_LevelOrderIterator
{ }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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