diff --git a/.gitmodules b/.gitmodules index be0be53cd..2dbebaaa7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,6 +2,3 @@ path = lib/vendor/swiftmailer url = https://github.com/FriendsOfSymfony1/swiftmailer.git branch = 5.x -[submodule "lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine"] - path = lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine - url = https://github.com/FriendsOfSymfony1/doctrine1.git diff --git a/lib/action/sfAction.class.php b/lib/action/sfAction.class.php index cabab27f0..255b90249 100644 --- a/lib/action/sfAction.class.php +++ b/lib/action/sfAction.class.php @@ -266,7 +266,9 @@ public function renderText($text) */ public function renderJson($data) { - $this->getResponse()->setContentType('application/json'); + $this->getResponse()->setHttpHeader('Cache-Control', 'no-cache, must-revalidate'); + $this->getResponse()->setHttpHeader('Expires', '0'); + $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); $this->getResponse()->setContent(json_encode($data)); return sfView::NONE; diff --git a/lib/command/sfFormatter.class.php b/lib/command/sfFormatter.class.php index d37829c87..c681e524d 100644 --- a/lib/command/sfFormatter.class.php +++ b/lib/command/sfFormatter.class.php @@ -65,7 +65,7 @@ public function format($text = '', $parameters = []) */ public function formatSection($section, $text, $size = null) { - if (!$size) { + if (!$size || !is_int($size)) { $size = $this->size; } diff --git a/lib/config/sfApplicationConfiguration.class.php b/lib/config/sfApplicationConfiguration.class.php index cab2df13c..bd5151c1b 100644 --- a/lib/config/sfApplicationConfiguration.class.php +++ b/lib/config/sfApplicationConfiguration.class.php @@ -231,7 +231,7 @@ public function setRootDir($rootDir) 'sf_app' => $this->getApplication(), 'sf_environment' => $this->getEnvironment(), 'sf_debug' => $this->isDebug(), - 'sf_cli' => PHP_SAPI === 'cli', + 'sf_cli' => 0 === strncasecmp(PHP_SAPI, 'cli', 3) && 'cli-server' !== PHP_SAPI, ]); $this->setAppDir(sfConfig::get('sf_apps_dir').DIRECTORY_SEPARATOR.$this->getApplication()); diff --git a/lib/exception/sfError404Exception.class.php b/lib/exception/sfError404Exception.class.php index 51528373e..49c39d5c6 100644 --- a/lib/exception/sfError404Exception.class.php +++ b/lib/exception/sfError404Exception.class.php @@ -34,11 +34,6 @@ public function printStackTrace() return parent::printStackTrace(); } - // log all exceptions in php log - if (!sfConfig::get('sf_test')) { - error_log($this->getMessage()); - } - sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); } } diff --git a/lib/plugins/sfDoctrinePlugin/LICENSE b/lib/plugins/sfDoctrinePlugin/LICENSE deleted file mode 100644 index 6a806a487..000000000 --- a/lib/plugins/sfDoctrinePlugin/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2006-2008 Jonathan H. Wage - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/config/autoload.yml b/lib/plugins/sfDoctrinePlugin/config/autoload.yml deleted file mode 100644 index 05ea1a7bc..000000000 --- a/lib/plugins/sfDoctrinePlugin/config/autoload.yml +++ /dev/null @@ -1,6 +0,0 @@ -autoload: - sfDoctrinePlugin_lib: - name: sfDoctrinePlugin lib - path: %SF_SYMFONY_LIB_DIR%/plugins/sfDoctrinePlugin/lib - recursive: true - exclude: [doctrine] diff --git a/lib/plugins/sfDoctrinePlugin/config/installer.php b/lib/plugins/sfDoctrinePlugin/config/installer.php deleted file mode 100644 index 52773c97b..000000000 --- a/lib/plugins/sfDoctrinePlugin/config/installer.php +++ /dev/null @@ -1,5 +0,0 @@ -installDir(dirname(__FILE__).'/skeleton'); -$this->enablePlugin('sfDoctrinePlugin'); -$this->reloadTasks(); diff --git a/lib/plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php b/lib/plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php deleted file mode 100755 index ebec8f629..000000000 --- a/lib/plugins/sfDoctrinePlugin/config/sfDoctrinePluginConfiguration.class.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrinePluginConfiguration Class. - * - * @author Jonathan H. Wage - */ -class sfDoctrinePluginConfiguration extends sfPluginConfiguration -{ - /** - * @see sfPluginConfiguration - */ - public function initialize() - { - sfConfig::set('sf_orm', 'doctrine'); - - if (!sfConfig::get('sf_admin_module_web_dir')) { - sfConfig::set('sf_admin_module_web_dir', '/sfDoctrinePlugin'); - } - - if (sfConfig::get('sf_web_debug')) { - require_once dirname(__FILE__).'/../lib/debug/sfWebDebugPanelDoctrine.class.php'; - - $this->dispatcher->connect('debug.web.load_panels', ['sfWebDebugPanelDoctrine', 'listenToAddPanelEvent']); - } - - if (!class_exists('Doctrine_Core')) { - require_once sfConfig::get('sf_doctrine_dir', realpath(dirname(__FILE__).'/../lib/vendor/doctrine/lib')).'/Doctrine/Core.php'; - spl_autoload_register(['Doctrine_Core', 'autoload']); - } - - $manager = Doctrine_Manager::getInstance(); - $manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL); - $manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_NONE); - $manager->setAttribute(Doctrine_Core::ATTR_RECURSIVE_MERGE_FIXTURES, true); - $manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true); - $manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true); - - // apply default attributes - $manager->setDefaultAttributes(); - - // configure doctrine through the dispatcher - $this->dispatcher->notify(new sfEvent($manager, 'doctrine.configure')); - - // make sure the culture is intercepted - $this->dispatcher->connect('user.change_culture', ['sfDoctrineRecord', 'listenToChangeCultureEvent']); - } - - /** - * Returns options for the Doctrine schema builder. - * - * @return array - */ - public function getModelBuilderOptions() - { - $options = [ - 'generateBaseClasses' => true, - 'generateTableClasses' => true, - 'packagesPrefix' => 'Plugin', - 'suffix' => '.class.php', - 'baseClassesDirectory' => 'base', - 'baseClassName' => 'sfDoctrineRecord', - ]; - - // filter options through the dispatcher - return $this->dispatcher - ->filter(new sfEvent($this, 'doctrine.filter_model_builder_options'), $options) - ->getReturnValue() - ; - } - - /** - * Returns a configuration array for the Doctrine CLI. - * - * @return array - */ - public function getCliConfig() - { - $config = [ - 'data_fixtures_path' => array_merge([sfConfig::get('sf_data_dir').'/fixtures'], $this->configuration->getPluginSubPaths('/data/fixtures')), - 'models_path' => sfConfig::get('sf_lib_dir').'/model/doctrine', - 'migrations_path' => sfConfig::get('sf_lib_dir').'/migration/doctrine', - 'sql_path' => sfConfig::get('sf_data_dir').'/sql', - 'yaml_schema_path' => sfConfig::get('sf_config_dir').'/doctrine', - ]; - - // filter config through the dispatcher - return $this->dispatcher->filter(new sfEvent($this, 'doctrine.filter_cli_config'), $config)->getReturnValue(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/config/skeleton/config/databases.yml b/lib/plugins/sfDoctrinePlugin/config/skeleton/config/databases.yml deleted file mode 100644 index 5abf6ec3b..000000000 --- a/lib/plugins/sfDoctrinePlugin/config/skeleton/config/databases.yml +++ /dev/null @@ -1,10 +0,0 @@ -# You can find more information about this file on the symfony website: -# http://www.symfony-project.org/reference/1_4/en/07-Databases - -all: - doctrine: - class: sfDoctrineDatabase - param: - dsn: mysql:host=localhost;dbname=##PROJECT_NAME## - username: root - password: diff --git a/lib/plugins/sfDoctrinePlugin/config/skeleton/config/doctrine/schema.yml b/lib/plugins/sfDoctrinePlugin/config/skeleton/config/doctrine/schema.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormBaseTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormBaseTemplate.php deleted file mode 100644 index 0db3d8a46..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormBaseTemplate.php +++ /dev/null @@ -1,15 +0,0 @@ -[?php - -/** - * Project form base class. - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -abstract class BaseFormDoctrine extends sfFormDoctrine -{ - public function setup() - { - } -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedInheritanceTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedInheritanceTemplate.php deleted file mode 100644 index 8b004cc26..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedInheritanceTemplate.php +++ /dev/null @@ -1,96 +0,0 @@ -[?php - -/** - * modelName ?> form base class. - * - * @method modelName ?> getObject() Returns the current form's model object - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -abstract class BasemodelName ?>Form extends getFormClassToExtend().PHP_EOL ?> -{ - protected function setupInheritance() - { - parent::setupInheritance(); - -getColumns() as $column): ?> - $this->widgetSchema ['getFieldName() ?>'] = new getWidgetClassForColumn($column) ?>(getWidgetOptionsForColumn($column) ?>); - $this->validatorSchema['getFieldName() ?>'] = new getValidatorClassForColumn($column) ?>(getValidatorOptionsForColumn($column) ?>); - - -getManyToManyRelations() as $relation): ?> - $this->widgetSchema ['underscore($relation['alias']) ?>_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>')); - $this->validatorSchema['underscore($relation['alias']) ?>_list'] = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>', 'required' => false)); - - - $this->widgetSchema->setNameFormat('underscore($this->modelName) ?>[%s]'); - } - - public function getModelName() - { - return 'modelName ?>'; - } - -getManyToManyRelations()): ?> - public function updateDefaultsFromObject() - { - parent::updateDefaultsFromObject(); - -getManyToManyRelations() as $relation): ?> - if (isset($this->widgetSchema['underscore($relation['alias']) ?>_list'])) - { - $this->setDefault('underscore($relation['alias']) ?>_list', $this->object->->getPrimaryKeys()); - } - - - } - - protected function doUpdateObject($values) - { -getManyToManyRelations() as $relation): ?> - $this->updateList($values); - - - parent::doUpdateObject($values); - } - -getManyToManyRelations() as $relation): ?> - public function updateList($values) - { - if (!isset($this->widgetSchema['underscore($relation['alias']) ?>_list'])) - { - // somebody has unset this widget - return; - } - - if (!array_key_exists('underscore($relation['alias']) ?>_list', $values)) - { - // no values for this widget - return; - } - - $existing = $this->object->->getPrimaryKeys(); - $values = $values['underscore($relation['alias']) ?>_list']; - if (!is_array($values)) - { - $values = array(); - } - - $unlink = array_diff($existing, $values); - if (count($unlink)) - { - $this->object->unlink('', array_values($unlink)); - } - - $link = array_diff($values, $existing); - if (count($link)) - { - $this->object->link('', array_values($link)); - } - } - - - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedTemplate.php deleted file mode 100644 index 85e0d7723..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormGeneratedTemplate.php +++ /dev/null @@ -1,122 +0,0 @@ -[?php - -/** - * modelName ?> form base class. - * - * @method modelName ?> getObject() Returns the current form's model object - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -abstract class BasemodelName ?>Form extends getFormClassToExtend().PHP_EOL ?> -{ - public function setup() - { - $this->setWidgets(array( -getColumns() as $column): ?> - 'getFieldName() ?>'getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => new getWidgetClassForColumn($column) ?>(getWidgetOptionsForColumn($column) ?>), - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list'getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>')), - - )); - - $this->setValidators(array( -getColumns() as $column): ?> - 'getFieldName() ?>'getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => new getValidatorClassForColumn($column) ?>(getValidatorOptionsForColumn($column) ?>), - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list'getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>', 'required' => false)), - - )); - -getUniqueColumnNames()): ?> - $this->validatorSchema->setPostValidator( - 1): ?> - new sfValidatorAnd(array( - - new sfValidatorDoctrineUnique(array('model' => 'table->getOption('name') ?>', 'column' => array(''))), - - )) - - new sfValidatorDoctrineUnique(array('model' => 'table->getOption('name') ?>', 'column' => array(''))) - - ); - - - $this->widgetSchema->setNameFormat('underscore($this->modelName) ?>[%s]'); - - $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); - - $this->setupInheritance(); - - parent::setup(); - } - - public function getModelName() - { - return 'modelName ?>'; - } - -getManyToManyRelations()): ?> - public function updateDefaultsFromObject() - { - parent::updateDefaultsFromObject(); - -getManyToManyRelations() as $relation): ?> - if (isset($this->widgetSchema['underscore($relation['alias']) ?>_list'])) - { - $this->setDefault('underscore($relation['alias']) ?>_list', $this->object->->getPrimaryKeys()); - } - - - } - - protected function doUpdateObject($values) - { -getManyToManyRelations() as $relation): ?> - $this->updateList($values); - - - parent::doUpdateObject($values); - } - -getManyToManyRelations() as $relation): ?> - public function updateList($values) - { - if (!isset($this->widgetSchema['underscore($relation['alias']) ?>_list'])) - { - // somebody has unset this widget - return; - } - - if (!array_key_exists('underscore($relation['alias']) ?>_list', $values)) - { - // no values for this widget - return; - } - - $existing = $this->object->->getPrimaryKeys(); - $values = $values['underscore($relation['alias']) ?>_list']; - if (!is_array($values)) - { - $values = array(); - } - - $unlink = array_diff($existing, $values); - if (count($unlink)) - { - $this->object->unlink('', array_values($unlink)); - } - - $link = array_diff($values, $existing); - if (count($link)) - { - $this->object->link('', array_values($link)); - } - } - - - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormPluginTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormPluginTemplate.php deleted file mode 100644 index 31fd27535..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormPluginTemplate.php +++ /dev/null @@ -1,12 +0,0 @@ -[?php - -/** - * Plugintable->getOption('name') ?> form. - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -abstract class Plugintable->getOption('name') ?>Form extends Basetable->getOption('name') ?>Form -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormTemplate.php deleted file mode 100644 index 2d5c0daa3..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrineFormTemplate.php +++ /dev/null @@ -1,25 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> form. - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -class table->getOption('name') ?>Form extends Basetable->getOption('name') ?>Form -{ -getParentModel()): ?> - /** - * @see Form - */ - public function configure() - { - parent::configure(); - } - - public function configure() - { - } - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrinePluginFormTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrinePluginFormTemplate.php deleted file mode 100644 index 507b4b4c2..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineForm/default/template/sfDoctrinePluginFormTemplate.php +++ /dev/null @@ -1,25 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> form. - * - * @package ##PROJECT_NAME## - * @subpackage form - * @author ##AUTHOR_NAME## - */ -class table->getOption('name') ?>Form extends Plugintable->getOption('name') ?>Form -{ -getParentModel()): ?> - /** - * @see Form - */ - public function configure() - { - parent::configure(); - } - - public function configure() - { - } - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterBaseTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterBaseTemplate.php deleted file mode 100644 index 148442da8..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterBaseTemplate.php +++ /dev/null @@ -1,15 +0,0 @@ -[?php - -/** - * Project filter form base class. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -abstract class BaseFormFilterDoctrine extends sfFormFilterDoctrine -{ - public function setup() - { - } -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedInheritanceTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedInheritanceTemplate.php deleted file mode 100644 index 0b8a58706..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedInheritanceTemplate.php +++ /dev/null @@ -1,67 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> filter form base class. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -abstract class Basetable->getOption('name') ?>FormFilter extends getFormClassToExtend().PHP_EOL ?> -{ - protected function setupInheritance() - { - parent::setupInheritance(); - -getColumns() as $column): ?> - $this->widgetSchema ['getFieldName() ?>'] = new getWidgetClassForColumn($column) ?>(getWidgetOptionsForColumn($column) ?>); - $this->validatorSchema['getFieldName() ?>'] = getValidatorForColumn($column) ?>; - - -getManyToManyRelations() as $relation): ?> - $this->widgetSchema ['underscore($relation['alias']) ?>_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>')); - $this->validatorSchema['underscore($relation['alias']) ?>_list'] = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>', 'required' => false)); - - - $this->widgetSchema->setNameFormat('underscore($this->modelName) ?>_filters[%s]'); - } - -getManyToManyRelations() as $relation): ?> - public function addListColumnQuery(Doctrine_Query $query, $field, $values) - { - if (!is_array($values)) - { - $values = array($values); - } - - if (!count($values)) - { - return; - } - - $query - ->leftJoin($query->getRootAlias().'.getOption('name') ?> getOption('name') ?>') - ->andWhereIn('getOption('name') ?>.getForeignFieldName() ?>', $values) - ; - } - - - public function getModelName() - { - return 'modelName ?>'; - } -getColumns()) || count($this->getManyToManyRelations())): ?> - - public function getFields() - { - return array_merge(parent::getFields(), array( -getColumns() as $column): ?> - 'getFieldName() ?>' => 'getType($column) ?>', - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list' => 'ManyKey', - - )); - } - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedTemplate.php deleted file mode 100644 index 9882acf26..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterGeneratedTemplate.php +++ /dev/null @@ -1,79 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> filter form base class. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -abstract class Basetable->getOption('name') ?>FormFilter extends getFormClassToExtend().PHP_EOL ?> -{ - public function setup() - { - $this->setWidgets(array( -getColumns() as $column): ?> -isPrimaryKey()) continue ?> - 'getFieldName() ?>'getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => new getWidgetClassForColumn($column) ?>(getWidgetOptionsForColumn($column) ?>), - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list'getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>')), - - )); - - $this->setValidators(array( -getColumns() as $column): ?> -isPrimaryKey()) continue ?> - 'getFieldName() ?>'getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => getValidatorForColumn($column) ?>, - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list'getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getOption('name') ?>', 'required' => false)), - - )); - - $this->widgetSchema->setNameFormat('underscore($this->modelName) ?>_filters[%s]'); - - $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); - - $this->setupInheritance(); - - parent::setup(); - } - -getManyToManyRelations() as $relation): ?> - public function addListColumnQuery(Doctrine_Query $query, $field, $values) - { - if (!is_array($values)) - { - $values = array($values); - } - - if (!count($values)) - { - return; - } - - $query - ->leftJoin($query->getRootAlias().'.getOption('name') ?> getOption('name') ?>') - ->andWhereIn('getOption('name') ?>.getForeignFieldName() ?>', $values) - ; - } - - - public function getModelName() - { - return 'modelName ?>'; - } - - public function getFields() - { - return array( -getColumns() as $column): ?> - 'getFieldName() ?>'getColumnNameMaxLength() - strlen($column->getFieldName())) ?> => 'getType($column) ?>', - -getManyToManyRelations() as $relation): ?> - 'underscore($relation['alias']) ?>_list'getColumnNameMaxLength() - strlen($this->underscore($relation['alias']).'_list')) ?> => 'ManyKey', - - ); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterPluginTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterPluginTemplate.php deleted file mode 100644 index 71a8f32a3..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterPluginTemplate.php +++ /dev/null @@ -1,12 +0,0 @@ -[?php - -/** - * Plugintable->getOption('name') ?> form. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -abstract class Plugintable->getOption('name') ?>FormFilter extends Basetable->getOption('name') ?>FormFilter -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterTemplate.php deleted file mode 100644 index 9df61dec6..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrineFormFilterTemplate.php +++ /dev/null @@ -1,25 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> filter form. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -class table->getOption('name') ?>FormFilter extends Basetable->getOption('name') ?>FormFilter -{ -getParentModel()): ?> - /** - * @see FormFilter - */ - public function configure() - { - parent::configure(); - } - - public function configure() - { - } - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrinePluginFormFilterTemplate.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrinePluginFormFilterTemplate.php deleted file mode 100644 index a0a7373fe..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineFormFilter/default/template/sfDoctrinePluginFormFilterTemplate.php +++ /dev/null @@ -1,25 +0,0 @@ -[?php - -/** - * table->getOption('name') ?> filter form. - * - * @package ##PROJECT_NAME## - * @subpackage filter - * @author ##AUTHOR_NAME## - */ -class table->getOption('name') ?>FormFilter extends Plugintable->getOption('name') ?>FormFilter -{ -getParentModel()): ?> - /** - * @see FormFilter - */ - public function configure() - { - parent::configure(); - } - - public function configure() - { - } - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php deleted file mode 100644 index cd266cb72..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php +++ /dev/null @@ -1,41 +0,0 @@ - public function getActionsDefault() - { - return asPhp(isset($this->config['actions']) ? $this->config['actions'] : array()) ?>; -config['actions']) ?> - } - - public function getFormActions() - { - return asPhp(isset($this->config['form']['actions']) ? $this->config['form']['actions'] : array('_delete' => null, '_list' => null, '_save' => null, '_save_and_add' => null)) ?>; -config['form']['actions']) ?> - } - - public function getNewActions() - { - return asPhp(isset($this->config['new']['actions']) ? $this->config['new']['actions'] : array()) ?>; -config['new']['actions']) ?> - } - - public function getEditActions() - { - return asPhp(isset($this->config['edit']['actions']) ? $this->config['edit']['actions'] : array()) ?>; -config['edit']['actions']) ?> - } - - public function getListObjectActions() - { - return asPhp(isset($this->config['list']['object_actions']) ? $this->config['list']['object_actions'] : array('_edit' => null, '_delete' => null)) ?>; -config['list']['object_actions']) ?> - } - - public function getListActions() - { - return asPhp(isset($this->config['list']['actions']) ? $this->config['list']['actions'] : array('_new' => null)) ?>; -config['list']['actions']) ?> - } - - public function getListBatchActions() - { - return asPhp(isset($this->config['list']['batch_actions']) ? $this->config['list']['batch_actions'] : array('_delete' => null)) ?>; -config['list']['batch_actions']) ?> - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php deleted file mode 100644 index e2c181298..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/batchAction.php +++ /dev/null @@ -1,64 +0,0 @@ - public function executeBatch(sfWebRequest $request) - { - $request->checkCSRFProtection(); - - if (!$ids = $request->getParameter('ids')) - { - $this->getUser()->setFlash('error', 'You must at least select one item.'); - - $this->redirect('@getUrlForAction('list') ?>'); - } - - if (!$action = $request->getParameter('batch_action')) - { - $this->getUser()->setFlash('error', 'You must select an action to execute on the selected items.'); - - $this->redirect('@getUrlForAction('list') ?>'); - } - - if (!method_exists($this, $method = 'execute'.ucfirst($action))) - { - throw new InvalidArgumentException(sprintf('You must create a "%s" method for action "%s"', $method, $action)); - } - - if (!$this->getUser()->hasCredential($this->configuration->getCredentials($action))) - { - $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); - } - - $validator = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'getModelClass() ?>')); - try - { - // validate ids - $ids = $validator->clean($ids); - - // execute batch - $this->$method($request); - } - catch (sfValidatorError $e) - { - $this->getUser()->setFlash('error', 'A problem occurs when deleting the selected items as some items do not exist anymore.'); - } - - $this->redirect('@getUrlForAction('list') ?>'); - } - - protected function executeBatchDelete(sfWebRequest $request) - { - $ids = $request->getParameter('ids'); - - $records = Doctrine_Query::create() - ->from('getModelClass() ?>') - ->whereIn('getPrimaryKeys(true) ?>', $ids) - ->execute(); - - foreach ($records as $record) - { - $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $record))); - - $record->delete(); - } - - $this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.'); - $this->redirect('@getUrlForAction('list') ?>'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php deleted file mode 100644 index f28642d8a..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php +++ /dev/null @@ -1,58 +0,0 @@ -[?php - -/** - * getModuleName() ?> module configuration. - * - * @package ##PROJECT_NAME## - * @subpackage getModuleName()."\n" ?> - * @author ##AUTHOR_NAME## - */ -abstract class BasegetModuleName()) ?>GeneratorConfiguration extends sfModelGeneratorConfiguration -{ - - - - - /** - * Gets the form class name. - * - * @return string The form class name - */ - public function getFormClass() - { - return 'config['form']['class']) ? $this->config['form']['class'] : $this->getModelClass().'Form' ?>'; -config['form']['class']) ?> - } - - public function hasFilterForm() - { - return config['filter']['class']) || false !== $this->config['filter']['class'] ? 'true' : 'false' ?>; - } - - /** - * Gets the filter form class name - * - * @return string The filter form class name associated with this generator - */ - public function getFilterFormClass() - { - return 'config['filter']['class']) && !in_array($this->config['filter']['class'], array(null, true, false), true) ? $this->config['filter']['class'] : $this->getModelClass().'FormFilter' ?>'; -config['filter']['class']) ?> - } - - - - - - public function getTableMethod() - { - return 'config['list']['table_method']) ? $this->config['list']['table_method'] : null ?>'; -config['list']['table_method']) ?> - } - - public function getTableCountMethod() - { - return 'config['list']['table_count_method']) ? $this->config['list']['table_count_method'] : null ?>'; -config['list']['table_count_method']) ?> - } -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/createAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/createAction.php deleted file mode 100644 index 6b063eb32..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/createAction.php +++ /dev/null @@ -1,9 +0,0 @@ - public function executeCreate(sfWebRequest $request) - { - $this->form = $this->configuration->getForm(); - $this->getSingularName() ?> = $this->form->getObject(); - - $this->processForm($request, $this->form); - - $this->setTemplate('new'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/deleteAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/deleteAction.php deleted file mode 100644 index 5e76a1b84..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/deleteAction.php +++ /dev/null @@ -1,13 +0,0 @@ - public function executeDelete(sfWebRequest $request) - { - $request->checkCSRFProtection(); - - $this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $this->getRoute()->getObject()))); - - if ($this->getRoute()->getObject()->delete()) - { - $this->getUser()->setFlash('notice', 'The item was deleted successfully.'); - } - - $this->redirect('@getUrlForAction('list') ?>'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/editAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/editAction.php deleted file mode 100644 index e0cfde5f4..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/editAction.php +++ /dev/null @@ -1,5 +0,0 @@ - public function executeEdit(sfWebRequest $request) - { - $this->getSingularName() ?> = $this->getRoute()->getObject(); - $this->form = $this->configuration->getForm($this->getSingularName() ?>); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php deleted file mode 100644 index dbd06c661..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php +++ /dev/null @@ -1,86 +0,0 @@ - public function getListParams() - { - return asPhp(isset($this->config['list']['params']) ? $this->config['list']['params'] : '%%'.implode('%% - %%', isset($this->config['list']['display']) ? $this->config['list']['display'] : $this->getAllFieldNames(false)).'%%') ?>; -config['list']['params']) ?> - } - - public function getListLayout() - { - return 'config['list']['layout']) ? $this->config['list']['layout'] : 'tabular' ?>'; -config['list']['layout']) ?> - } - - public function getListTitle() - { - return 'escapeString(isset($this->config['list']['title']) ? $this->config['list']['title'] : sfInflector::humanize($this->getModuleName()).' List') ?>'; -config['list']['title']) ?> - } - - public function getEditTitle() - { - return 'escapeString(isset($this->config['edit']['title']) ? $this->config['edit']['title'] : 'Edit '.sfInflector::humanize($this->getModuleName())) ?>'; -config['edit']['title']) ?> - } - - public function getNewTitle() - { - return 'escapeString(isset($this->config['new']['title']) ? $this->config['new']['title'] : 'New '.sfInflector::humanize($this->getModuleName())) ?>'; -config['new']['title']) ?> - } - - public function getFilterDisplay() - { - return asPhp(isset($this->config['filter']['display']) ? $this->config['filter']['display'] : array()) ?>; -config['filter']['display']) ?> - } - - public function getFormDisplay() - { - return asPhp(isset($this->config['form']['display']) ? $this->config['form']['display'] : array()) ?>; -config['form']['display']) ?> - } - - public function getEditDisplay() - { - return asPhp(isset($this->config['edit']['display']) ? $this->config['edit']['display'] : array()) ?>; -config['edit']['display']) ?> - } - - public function getNewDisplay() - { - return asPhp(isset($this->config['new']['display']) ? $this->config['new']['display'] : array()) ?>; -config['new']['display']) ?> - } - - public function getListDisplay() - { -config['list']['display'])): ?> - return asPhp($this->config['list']['display']) ?>; -config['list']['hide'])): ?> - return asPhp(array_diff($this->getAllFieldNames(false), $this->config['list']['hide'])) ?>; - - return asPhp($this->getAllFieldNames(false)) ?>; - -config['list']['display'], $this->config['list']['hide']) ?> - } - - public function getFieldsDefault() - { - return array( -getDefaultFieldsConfiguration() as $name => $params): ?> - '' => asPhp($params) ?>, - - ); - } - - - public function getFields() - { - return array( -getFieldsConfiguration($context) as $name => $params): ?> - '' => asPhp($params) ?>, - - ); - } - - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filterAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filterAction.php deleted file mode 100644 index 377d1e662..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filterAction.php +++ /dev/null @@ -1,26 +0,0 @@ - public function executeFilter(sfWebRequest $request) - { - $this->setPage(1); - - if ($request->hasParameter('_reset')) - { - $this->setFilters($this->configuration->getFilterDefaults()); - - $this->redirect('@getUrlForAction('list') ?>'); - } - - $this->filters = $this->configuration->getFilterForm($this->getFilters()); - - $this->filters->bind($request->getParameter($this->filters->getName())); - if ($this->filters->isValid()) - { - $this->setFilters($this->filters->getValues()); - - $this->redirect('@getUrlForAction('list') ?>'); - } - - $this->pager = $this->getPager(); - $this->sort = $this->getSort(); - - $this->setTemplate('index'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filtersAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filtersAction.php deleted file mode 100644 index f4785b630..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/filtersAction.php +++ /dev/null @@ -1,9 +0,0 @@ - protected function getFilters() - { - return $this->getUser()->getAttribute('getModuleName() ?>.filters', $this->configuration->getFilterDefaults(), 'admin_module'); - } - - protected function setFilters(array $filters) - { - return $this->getUser()->setAttribute('getModuleName() ?>.filters', $filters, 'admin_module'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/indexAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/indexAction.php deleted file mode 100644 index 1de77ebf8..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/indexAction.php +++ /dev/null @@ -1,17 +0,0 @@ - public function executeIndex(sfWebRequest $request) - { - // sorting - if ($request->getParameter('sort') && $this->isValidSortColumn($request->getParameter('sort'))) - { - $this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type'))); - } - - // pager - if ($request->getParameter('page')) - { - $this->setPage($request->getParameter('page')); - } - - $this->pager = $this->getPager(); - $this->sort = $this->getSort(); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/newAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/newAction.php deleted file mode 100644 index 24903513d..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/newAction.php +++ /dev/null @@ -1,5 +0,0 @@ - public function executeNew(sfWebRequest $request) - { - $this->form = $this->configuration->getForm(); - $this->getSingularName() ?> = $this->form->getObject(); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationAction.php deleted file mode 100644 index 75be2becb..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationAction.php +++ /dev/null @@ -1,49 +0,0 @@ - protected function getPager() - { - $pager = $this->configuration->getPager('getModelClass() ?>'); - $pager->setQuery($this->buildQuery()); - $pager->setPage($this->getPage()); - $pager->init(); - - return $pager; - } - - protected function setPage($page) - { - $this->getUser()->setAttribute('getModuleName() ?>.page', $page, 'admin_module'); - } - - protected function getPage() - { - return $this->getUser()->getAttribute('getModuleName() ?>.page', 1, 'admin_module'); - } - - protected function buildQuery() - { - $tableMethod = $this->configuration->getTableMethod(); -configuration->hasFilterForm()): ?> - if (null === $this->filters) - { - $this->filters = $this->configuration->getFilterForm($this->getFilters()); - } - - $this->filters->setTableMethod($tableMethod); - - $query = $this->filters->buildQuery($this->getFilters()); - - $query = Doctrine_Core::getTable('getModelClass() ?>') - ->createQuery('a'); - - if ($tableMethod) - { - $query = Doctrine_Core::getTable('getModelClass() ?>')->$tableMethod($query); - } - - - $this->addSortQuery($query); - - $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_query'), $query); - $query = $event->getReturnValue(); - - return $query; - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php deleted file mode 100644 index 5f84cef6a..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php +++ /dev/null @@ -1,11 +0,0 @@ - public function getPagerClass() - { - return 'config['list']['pager_class']) ? $this->config['list']['pager_class'] : 'sfDoctrinePager' ?>'; -config['list']['pager_class']) ?> - } - - public function getPagerMaxPerPage() - { - return config['list']['max_per_page']) ? (integer) $this->config['list']['max_per_page'] : 20 ?>; -config['list']['max_per_page']) ?> - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/processFormAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/processFormAction.php deleted file mode 100644 index 9d0911d6f..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/processFormAction.php +++ /dev/null @@ -1,43 +0,0 @@ - protected function processForm(sfWebRequest $request, sfForm $form) - { - $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); - if ($form->isValid()) - { - $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.'; - - try { - $getSingularName() ?> = $form->save(); - } catch (Doctrine_Validator_Exception $e) { - - $errorStack = $form->getObject()->getErrorStack(); - - $message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: "; - foreach ($errorStack as $field => $errors) { - $message .= "$field (" . implode(", ", $errors) . "), "; - } - $message = trim($message, ', '); - - $this->getUser()->setFlash('error', $message); - return sfView::SUCCESS; - } - - $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $getSingularName() ?>))); - - if ($request->hasParameter('_save_and_add')) - { - $this->getUser()->setFlash('notice', $notice.' You can add another one below.'); - - $this->redirect('@getUrlForAction('new') ?>'); - } - else - { - $this->getUser()->setFlash('notice', $notice); - - $this->redirect(array('sf_route' => 'getUrlForAction('edit') ?>', 'sf_subject' => $getSingularName() ?>)); - } - } - else - { - $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false); - } - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php deleted file mode 100644 index 937859a38..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingAction.php +++ /dev/null @@ -1,41 +0,0 @@ - protected function addSortQuery($query) - { - if (array(null, null) == ($sort = $this->getSort())) - { - return; - } - - if (!in_array(strtolower($sort[1]), array('asc', 'desc'))) - { - $sort[1] = 'asc'; - } - - $query->addOrderBy($sort[0] . ' ' . $sort[1]); - } - - protected function getSort() - { - if (null !== $sort = $this->getUser()->getAttribute('getModuleName() ?>.sort', null, 'admin_module')) - { - return $sort; - } - - $this->setSort($this->configuration->getDefaultSort()); - - return $this->getUser()->getAttribute('getModuleName() ?>.sort', null, 'admin_module'); - } - - protected function setSort(array $sort) - { - if (null !== $sort[0] && null === $sort[1]) - { - $sort[1] = 'asc'; - } - - $this->getUser()->setAttribute('getModuleName() ?>.sort', $sort, 'admin_module'); - } - - protected function isValidSortColumn($column) - { - return Doctrine_Core::getTable('getModelClass() ?>')->hasColumn($column); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php deleted file mode 100644 index c52479324..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php +++ /dev/null @@ -1,10 +0,0 @@ - public function getDefaultSort() - { -config['list']['sort']) ? $this->config['list']['sort'] : false)): ?> - - return array('', ''); - - return array(null, null); - -config['list']['sort']) ?> - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/updateAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/updateAction.php deleted file mode 100644 index 958a04a35..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/updateAction.php +++ /dev/null @@ -1,9 +0,0 @@ - public function executeUpdate(sfWebRequest $request) - { - $this->getSingularName() ?> = $this->getRoute()->getObject(); - $this->form = $this->configuration->getForm($this->getSingularName() ?>); - - $this->processForm($request, $this->form); - - $this->setTemplate('edit'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/skeleton/actions/actions.class.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/skeleton/actions/actions.class.php deleted file mode 100644 index 1cf3f3642..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/skeleton/actions/actions.class.php +++ /dev/null @@ -1,15 +0,0 @@ -moduleName) ?>GeneratorConfiguration.class.php'); -require_once(dirname(__FILE__).'/../lib/BasemoduleName) ?>GeneratorHelper.class.php'); - -/** - * getModuleName() ?> actions. - * - * @package ##PROJECT_NAME## - * @subpackage getModuleName()."\n" ?> - * @author ##AUTHOR_NAME## - */ -abstract class getGeneratedModuleName() ?>Actions extends getActionsBaseClass()."\n" ?> -{ - public function preExecute() - { - $this->configuration = new getModuleName() ?>GeneratorConfiguration(); - - if (!$this->getUser()->hasCredential($this->configuration->getCredentials($this->getActionName()))) - { - $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); - } - - $this->dispatcher->notify(new sfEvent($this, 'admin.pre_execute', array('configuration' => $this->configuration))); - - $this->helper = new getModuleName() ?>GeneratorHelper(); - - parent::preExecute(); - } - - - -configuration->hasFilterForm()): ?> - - - - - - - - - - - - - -configuration->getValue('list.batch_actions')): ?> - - - - - -configuration->hasFilterForm()): ?> - - - - - - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/lib/helper.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/lib/helper.php deleted file mode 100644 index 290124bed..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/lib/helper.php +++ /dev/null @@ -1,16 +0,0 @@ -[?php - -/** - * getModuleName() ?> module configuration. - * - * @package ##PROJECT_NAME## - * @subpackage getModuleName()."\n" ?> - * @author ##AUTHOR_NAME## - */ -abstract class BasegetModuleName()) ?>GeneratorHelper extends sfModelGeneratorHelper -{ - public function getUrlForAction($action) - { - return 'list' == $action ? 'params['route_prefix'] ?>' : 'params['route_prefix'] ?>_'.$action; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_assets.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_assets.php deleted file mode 100644 index f307e0c68..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_assets.php +++ /dev/null @@ -1,6 +0,0 @@ -params['css']) && ($this->params['css'] !== false)): ?> -[?php use_stylesheet('params['css'] ?>', 'first') ?] -params['css'])): ?> -[?php use_stylesheet('', 'first') ?] -[?php use_stylesheet('', 'first') ?] - \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php deleted file mode 100644 index b8259edb3..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters.php +++ /dev/null @@ -1,36 +0,0 @@ -[?php use_stylesheets_for_form($form) ?] -[?php use_javascripts_for_form($form) ?] - -
- [?php if ($form->hasGlobalErrors()): ?] - [?php echo $form->renderGlobalErrors() ?] - [?php endif; ?] - -
- - - - - - - - [?php foreach ($configuration->getFormFilterFields($form) as $name => $field): ?] - [?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?] - [?php include_partial('getModuleName() ?>/filters_field', array( - 'name' => $name, - 'attributes' => $field->getConfig('attributes', array()), - 'label' => $field->getConfig('label'), - 'help' => $field->getConfig('help'), - 'form' => $form, - 'field' => $field, - 'class' => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_filter_field_'.$name, - )) ?] - [?php endforeach; ?] - -
- [?php echo $form->renderHiddenFields() ?] - [?php echo link_to(__('Reset', array(), 'sf_admin'), 'getUrlForAction('collection') ?>', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post')) ?] - -
-
-
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters_field.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters_field.php deleted file mode 100644 index 749ecc868..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_filters_field.php +++ /dev/null @@ -1,20 +0,0 @@ -[?php if ($field->isPartial()): ?] - [?php include_partial('getModuleName() ?>/'.$name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] -[?php elseif ($field->isComponent()): ?] - [?php include_component('getModuleName() ?>', $name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] -[?php else: ?] - - - [?php echo $form[$name]->renderLabel($label) ?] - - - [?php echo $form[$name]->renderError() ?] - - [?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?] - - [?php if ($help || $help = $form[$name]->renderHelp()): ?] -
[?php echo __($help, array(), 'getI18nCatalogue() ?>') ?]
- [?php endif; ?] - - -[?php endif; ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_flashes.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_flashes.php deleted file mode 100644 index da049da0b..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_flashes.php +++ /dev/null @@ -1,7 +0,0 @@ -[?php if ($sf_user->hasFlash('notice')): ?] -
[?php echo __($sf_user->getFlash('notice'), array(), 'sf_admin') ?]
-[?php endif; ?] - -[?php if ($sf_user->hasFlash('error')): ?] -
[?php echo __($sf_user->getFlash('error'), array(), 'sf_admin') ?]
-[?php endif; ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form.php deleted file mode 100644 index c07123c2c..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form.php +++ /dev/null @@ -1,18 +0,0 @@ -[?php use_stylesheets_for_form($form) ?] -[?php use_javascripts_for_form($form) ?] - -
- [?php echo form_tag_for($form, '@params['route_prefix'] ?>') ?] - [?php echo $form->renderHiddenFields(false) ?] - - [?php if ($form->hasGlobalErrors()): ?] - [?php echo $form->renderGlobalErrors() ?] - [?php endif; ?] - - [?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?] - [?php include_partial('getModuleName() ?>/form_fieldset', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'fields' => $fields, 'fieldset' => $fieldset)) ?] - [?php endforeach; ?] - - [?php include_partial('getModuleName() ?>/form_actions', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?] - -
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_actions.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_actions.php deleted file mode 100644 index c3d66bbeb..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_actions.php +++ /dev/null @@ -1,35 +0,0 @@ - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_field.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_field.php deleted file mode 100644 index a7111ff60..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_field.php +++ /dev/null @@ -1,20 +0,0 @@ -[?php if ($field->isPartial()): ?] - [?php include_partial('getModuleName() ?>/'.$name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] -[?php elseif ($field->isComponent()): ?] - [?php include_component('getModuleName() ?>', $name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?] -[?php else: ?] -
- [?php echo $form[$name]->renderError() ?] -
- [?php echo $form[$name]->renderLabel($label) ?] - -
[?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?]
- - [?php if ($help): ?] -
[?php echo __($help, array(), 'getI18nCatalogue() ?>') ?]
- [?php elseif ($help = $form[$name]->renderHelp()): ?] -
[?php echo $help ?]
- [?php endif; ?] -
-
-[?php endif; ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php deleted file mode 100644 index ae30a30e6..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_fieldset.php +++ /dev/null @@ -1,18 +0,0 @@ -
- [?php if ('NONE' != $fieldset): ?] -

[?php echo __($fieldset, array(), 'getI18nCatalogue() ?>') ?]

- [?php endif; ?] - - [?php foreach ($fields as $name => $field): ?] - [?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?] - [?php include_partial('getModuleName() ?>/form_field', array( - 'name' => $name, - 'attributes' => $field->getConfig('attributes', array()), - 'label' => $field->getConfig('label'), - 'help' => $field->getConfig('help'), - 'form' => $form, - 'field' => $field, - 'class' => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_form_field_'.$name, - )) ?] - [?php endforeach; ?] -
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_footer.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_footer.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_header.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_form_header.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list.php deleted file mode 100644 index ae2b0c55f..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list.php +++ /dev/null @@ -1,54 +0,0 @@ -
- [?php if (!$pager->getNbResults()): ?] -

[?php echo __('No result', array(), 'sf_admin') ?]

- [?php else: ?] - - - -configuration->getValue('list.batch_actions')): ?> - - - [?php include_partial('getModuleName() ?>/list_th_configuration->getValue('list.layout') ?>', array('sort' => $sort)) ?] -configuration->getValue('list.object_actions')): ?> - - - - - - - - - - - [?php foreach ($pager->getResults() as $i => $getSingularName() ?>): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?] - -configuration->getValue('list.batch_actions')): ?> - [?php include_partial('getModuleName() ?>/list_td_batch_actions', array('getSingularName() ?>' => $getSingularName() ?>, 'helper' => $helper)) ?] - - [?php include_partial('getModuleName() ?>/list_td_configuration->getValue('list.layout') ?>', array('getSingularName() ?>' => $getSingularName() ?>)) ?] -configuration->getValue('list.object_actions')): ?> - [?php include_partial('getModuleName() ?>/list_td_actions', array('getSingularName() ?>' => $getSingularName() ?>, 'helper' => $helper)) ?] - - - [?php endforeach; ?] - -
[?php echo __('Actions', array(), 'sf_admin') ?]
- [?php if ($pager->haveToPaginate()): ?] - [?php include_partial('getModuleName() ?>/pagination', array('pager' => $pager)) ?] - [?php endif; ?] - - [?php echo format_number_choice('[0] no result|[1] 1 result|(1,+Inf] %1% results', array('%1%' => $pager->getNbResults()), $pager->getNbResults(), 'sf_admin') ?] - [?php if ($pager->haveToPaginate()): ?] - [?php echo __('(page %%page%%/%%nb_pages%%)', array('%%page%%' => $pager->getPage(), '%%nb_pages%%' => $pager->getLastPage()), 'sf_admin') ?] - [?php endif; ?] -
- [?php endif; ?] -
- diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_actions.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_actions.php deleted file mode 100644 index 09019a008..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_actions.php +++ /dev/null @@ -1,11 +0,0 @@ -configuration->getValue('list.actions')): ?> - $params): ?> - -addCredentialCondition('[?php echo $helper->linkToNew('.$this->asPhp($params).') ?]', $params)."\n" ?> - -
  • - addCredentialCondition($this->getLinkToAction($name, $params, false), $params)."\n" ?> -
  • - - - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_batch_actions.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_batch_actions.php deleted file mode 100644 index 6f85a5e2a..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_batch_actions.php +++ /dev/null @@ -1,15 +0,0 @@ -configuration->getValue('list.batch_actions')): ?> -
  • - - [?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?] - - [?php endif; ?] - -
  • - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_field_boolean.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_field_boolean.php deleted file mode 100644 index 85b5dd10b..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_field_boolean.php +++ /dev/null @@ -1,5 +0,0 @@ -[?php if ($value): ?] - [?php echo image_tag(sfConfig::get('sf_admin_module_web_dir').'/images/tick.png', array('alt' => __('Checked', array(), 'sf_admin'), 'title' => __('Checked', array(), 'sf_admin'))) ?] -[?php else: ?] -   -[?php endif; ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_footer.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_footer.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_header.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_header.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_actions.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_actions.php deleted file mode 100644 index 65e302890..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_actions.php +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_batch_actions.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_batch_actions.php deleted file mode 100644 index 505a41f18..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_batch_actions.php +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_stacked.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_stacked.php deleted file mode 100644 index 00639252b..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_stacked.php +++ /dev/null @@ -1,3 +0,0 @@ - - [?php echo getI18NString('list.params') ?> ?] - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php deleted file mode 100644 index 4d56b50ef..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_td_tabular.php +++ /dev/null @@ -1,9 +0,0 @@ -configuration->getValue('list.display') as $name => $field): ?> -addCredentialCondition(sprintf(<< - [?php echo %s ?] - - -EOF -, strtolower($field->getType()), $name, $this->renderField($field)), $field->getConfig()) ?> - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_stacked.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_stacked.php deleted file mode 100644 index 669386258..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_stacked.php +++ /dev/null @@ -1 +0,0 @@ -[?php include_partial('getModuleName() ?>/list_th_tabular', array('sort' => $sort)) ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php deleted file mode 100644 index 298b900ee..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_list_th_tabular.php +++ /dev/null @@ -1,17 +0,0 @@ -configuration->getValue('list.display') as $name => $field): ?> -[?php slot('sf_admin.current_header') ?] - -isReal()): ?> - [?php if ('' == $sort[0]): ?] - [?php echo link_to(__('getConfig('label', '', true) ?>', array(), 'getI18nCatalogue() ?>'), '@getUrlForAction('list') ?>', array('query_string' => 'sort=&sort_type='.($sort[1] == 'asc' ? 'desc' : 'asc'))) ?] - [?php echo image_tag(sfConfig::get('sf_admin_module_web_dir').'/images/'.$sort[1].'.png', array('alt' => __($sort[1], array(), 'sf_admin'), 'title' => __($sort[1], array(), 'sf_admin'))) ?] - [?php else: ?] - [?php echo link_to(__('getConfig('label', '', true) ?>', array(), 'getI18nCatalogue() ?>'), '@getUrlForAction('list') ?>', array('query_string' => 'sort=&sort_type=asc')) ?] - [?php endif; ?] - - [?php echo __('getConfig('label', '', true) ?>', array(), 'getI18nCatalogue() ?>') ?] - - -[?php end_slot(); ?] -addCredentialCondition("[?php include_slot('sf_admin.current_header') ?]", $field->getConfig()) ?> - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_pagination.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_pagination.php deleted file mode 100644 index 1760cb974..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/_pagination.php +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/editSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/editSuccess.php deleted file mode 100644 index 2ab44e466..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/editSuccess.php +++ /dev/null @@ -1,20 +0,0 @@ -[?php use_helper('I18N', 'Date') ?] -[?php include_partial('getModuleName() ?>/assets') ?] - -
    -

    [?php echo getI18NString('edit.title') ?> ?]

    - - [?php include_partial('getModuleName() ?>/flashes') ?] - -
    - [?php include_partial('getModuleName() ?>/form_header', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'configuration' => $configuration)) ?] -
    - -
    - [?php include_partial('getModuleName() ?>/form', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?] -
    - - -
    diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/indexSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/indexSuccess.php deleted file mode 100644 index 5ed168a25..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/indexSuccess.php +++ /dev/null @@ -1,36 +0,0 @@ -[?php use_helper('I18N', 'Date') ?] -[?php include_partial('getModuleName() ?>/assets') ?] - -
    -

    [?php echo getI18NString('list.title') ?> ?]

    - - [?php include_partial('getModuleName() ?>/flashes') ?] - -
    - [?php include_partial('getModuleName() ?>/list_header', array('pager' => $pager)) ?] -
    - -configuration->hasFilterForm()): ?> -
    - [?php include_partial('getModuleName() ?>/filters', array('form' => $filters, 'configuration' => $configuration)) ?] -
    - - -
    -configuration->getValue('list.batch_actions')): ?> -
    - - [?php include_partial('getModuleName() ?>/list', array('pager' => $pager, 'sort' => $sort, 'helper' => $helper)) ?] -
      - [?php include_partial('getModuleName() ?>/list_batch_actions', array('helper' => $helper)) ?] - [?php include_partial('getModuleName() ?>/list_actions', array('helper' => $helper)) ?] -
    -configuration->getValue('list.batch_actions')): ?> -
    - -
    - - -
    diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/newSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/newSuccess.php deleted file mode 100644 index bc55b698f..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/template/templates/newSuccess.php +++ /dev/null @@ -1,20 +0,0 @@ -[?php use_helper('I18N', 'Date') ?] -[?php include_partial('getModuleName() ?>/assets') ?] - -
    -

    [?php echo getI18NString('new.title') ?> ?]

    - - [?php include_partial('getModuleName() ?>/flashes') ?] - -
    - [?php include_partial('getModuleName() ?>/form_header', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'configuration' => $configuration)) ?] -
    - -
    - [?php include_partial('getModuleName() ?>/form', array('getSingularName() ?>' => $getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?] -
    - - -
    diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/createAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/createAction.php deleted file mode 100644 index 23447e7ef..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/createAction.php +++ /dev/null @@ -1,13 +0,0 @@ - public function executeCreate(sfWebRequest $request) - { -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - - $this->forward404Unless($request->isMethod(sfRequest::POST)); - - - $this->form = new getModelClass().'Form' ?>(); - - $this->processForm($request, $this->form); - - $this->setTemplate('new'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/deleteAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/deleteAction.php deleted file mode 100644 index 385a76a94..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/deleteAction.php +++ /dev/null @@ -1,17 +0,0 @@ - public function executeDelete(sfWebRequest $request) - { - $request->checkCSRFProtection(); - -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - $this->getRoute()->getObject()->delete(); - - $this->forward404Unless($getSingularName() ?> = Doctrine_Core::getTable('getModelClass() ?>')->find(array(getRetrieveByPkParamsForAction(43) ?>)), sprintf('Object getSingularName() ?> does not exist (%s).', getRetrieveByPkParamsForAction(43) ?>)); - $getSingularName() ?>->delete(); - - -params['route_prefix']) && $this->params['route_prefix']): ?> - $this->redirect('@getUrlForAction('list') ?>'); - - $this->redirect('getModuleName() ?>/index'); - - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/editAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/editAction.php deleted file mode 100644 index 96676a9e2..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/editAction.php +++ /dev/null @@ -1,9 +0,0 @@ - public function executeEdit(sfWebRequest $request) - { -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - $this->form = new getModelClass().'Form' ?>($this->getRoute()->getObject()); - - $this->forward404Unless($getSingularName() ?> = Doctrine_Core::getTable('getModelClass() ?>')->find(array(getRetrieveByPkParamsForAction(43) ?>)), sprintf('Object getSingularName() ?> does not exist (%s).', getRetrieveByPkParamsForAction(43) ?>)); - $this->form = new getModelClass().'Form' ?>($getSingularName() ?>); - - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/indexAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/indexAction.php deleted file mode 100644 index d49837d2a..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/indexAction.php +++ /dev/null @@ -1,10 +0,0 @@ - public function executeIndex(sfWebRequest $request) - { -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - $this->getPluralName() ?> = $this->getRoute()->getObjects(); - - $this->getPluralName() ?> = Doctrine_Core::getTable('getModelClass() ?>') - ->createQuery('a') - ->execute(); - - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/newAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/newAction.php deleted file mode 100644 index 526ba5804..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/newAction.php +++ /dev/null @@ -1,4 +0,0 @@ - public function executeNew(sfWebRequest $request) - { - $this->form = new getModelClass().'Form' ?>(); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/processFormAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/processFormAction.php deleted file mode 100644 index e0eef8ba8..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/processFormAction.php +++ /dev/null @@ -1,14 +0,0 @@ - protected function processForm(sfWebRequest $request, sfForm $form) - { - $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); - if ($form->isValid()) - { - $getSingularName() ?> = $form->save(); - -params['route_prefix']) && $this->params['route_prefix']): ?> - $this->redirect('@getUrlForAction('edit') ?>?getPrimaryKeyUrlParams() ?>); - - $this->redirect('getModuleName() ?>/edit?getPrimaryKeyUrlParams() ?>); - - } - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/showAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/showAction.php deleted file mode 100644 index e6e7cf66c..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/showAction.php +++ /dev/null @@ -1,9 +0,0 @@ - public function executeShow(sfWebRequest $request) - { -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - $this->getSingularName() ?> = $this->getRoute()->getObject(); - - $this->getSingularName() ?> = Doctrine_Core::getTable('getModelClass() ?>')->find(array(getRetrieveByPkParamsForAction(65) ?>)); - $this->forward404Unless($this->getSingularName() ?>); - - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/updateAction.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/updateAction.php deleted file mode 100644 index 62d9f7263..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/parts/updateAction.php +++ /dev/null @@ -1,14 +0,0 @@ - public function executeUpdate(sfWebRequest $request) - { -params['with_doctrine_route']) && $this->params['with_doctrine_route']): ?> - $this->form = new getModelClass().'Form' ?>($this->getRoute()->getObject()); - - $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT)); - $this->forward404Unless($getSingularName() ?> = Doctrine_Core::getTable('getModelClass() ?>')->find(array(getRetrieveByPkParamsForAction(43) ?>)), sprintf('Object getSingularName() ?> does not exist (%s).', getRetrieveByPkParamsForAction(43) ?>)); - $this->form = new getModelClass().'Form' ?>($getSingularName() ?>); - - - $this->processForm($request, $this->form); - - $this->setTemplate('edit'); - } diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/skeleton/actions/actions.class.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/skeleton/actions/actions.class.php deleted file mode 100644 index e5bb06eb7..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/skeleton/actions/actions.class.php +++ /dev/null @@ -1,12 +0,0 @@ -getModuleName() ?> actions. - * - * @package ##PROJECT_NAME## - * @subpackage getModuleName()."\n" ?> - * @author ##AUTHOR_NAME## - */ -class getGeneratedModuleName() ?>Actions extends getActionsBaseClass() ?> - -{ - - -params['with_show']) && $this->params['with_show']): ?> - - - - - - - - - - - - - - -} diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/_form.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/_form.php deleted file mode 100644 index 7ebe1575a..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/_form.php +++ /dev/null @@ -1,53 +0,0 @@ -[?php use_stylesheets_for_form($form) ?] -[?php use_javascripts_for_form($form) ?] - -getFormObject() ?> -params['route_prefix']) && $this->params['route_prefix']): ?> -[?php echo form_tag_for($form, '@params['route_prefix'] ?>') ?] - -
    isMultipart() and print 'enctype="multipart/form-data" ' ?]> -[?php if (!$form->getObject()->isNew()): ?] - -[?php endif; ?] - - - - - - - - -params['non_verbose_templates']) && $this->params['non_verbose_templates']): ?> - [?php echo $form ?] - - [?php echo $form->renderGlobalErrors() ?] - $field): if ($field->isHidden()) continue ?> - - - - - - - -
    -params['non_verbose_templates']) || !$this->params['non_verbose_templates']): ?> - [?php echo $form->renderHiddenFields(false) ?] - -params['route_prefix']) && $this->params['route_prefix']): ?> -  Back to list - -  Back to list - - [?php if (!$form->getObject()->isNew()): ?] -params['route_prefix']) && $this->params['route_prefix']): ?> -  [?php echo link_to('Delete', 'getUrlForAction('delete') ?>', $form->getObject(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?] - -  [?php echo link_to('Delete', 'getModuleName() ?>/delete?getPrimaryKeyUrlParams('$form->getObject()', true) ?>, array('method' => 'delete', 'confirm' => 'Are you sure?')) ?] - - [?php endif; ?] - -
    [?php echo $form['']->renderLabel() ?] - [?php echo $form['']->renderError() ?] - [?php echo $form[''] ?] -
    -
    diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/editSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/editSuccess.php deleted file mode 100644 index 032d848bb..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/editSuccess.php +++ /dev/null @@ -1,3 +0,0 @@ -

    Edit getSingularName()) ?>

    - -[?php include_partial('form', array('form' => $form)) ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/indexSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/indexSuccess.php deleted file mode 100644 index 73752d555..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/indexSuccess.php +++ /dev/null @@ -1,34 +0,0 @@ -

    getPluralName()) ?> List

    - - - - -getColumns() as $column): ?> - - - - - - [?php foreach ($getPluralName() ?> as $getSingularName() ?>): ?] - -getColumns() as $column): ?> -isPrimaryKey()): ?> -params['route_prefix']) && $this->params['route_prefix']): ?> - - - - - - - - - - [?php endforeach; ?] - -
    getPhpName())) ?>
    [?php echo $getSingularName() ?>->getgetPhpName()) ?>() ?][?php echo $getSingularName() ?>->getgetPhpName()) ?>() ?][?php echo $getSingularName() ?>->getgetPhpName()) ?>() ?]
    - -params['route_prefix']) && $this->params['route_prefix']): ?> - New - - New - diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/newSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/newSuccess.php deleted file mode 100644 index 3f4f2330d..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/newSuccess.php +++ /dev/null @@ -1,3 +0,0 @@ -

    New getSingularName()) ?>

    - -[?php include_partial('form', array('form' => $form)) ?] diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/showSuccess.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/showSuccess.php deleted file mode 100644 index cd45d8614..000000000 --- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/default/template/templates/showSuccess.php +++ /dev/null @@ -1,22 +0,0 @@ - - -getColumns() as $column): ?> - - - - - - -
    getPhpName())) ?>:[?php echo $getSingularName() ?>->getgetPhpName()) ?>() ?]
    - -
    - -params['route_prefix']) && $this->params['route_prefix']): ?> -Edit -  -List - -Edit -  -List - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ar.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ar.xml deleted file mode 100644 index c076fb521..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ar.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - جديد - - - Edit - تحديث - - - Delete - حذف - - - List - لائحة - - - Save - حفظ - - - Save and add - حفظ و إضافة - - - Cancel - إلغاء - - - - - Reset - مسح - - - Filter - فرز - - - - - No result - لا توجد نتائج - - - Actions - إجراءات - - - (page %%page%%/%%nb_pages%%) - (%%nb_pages%%/%%page%% صفحة) - - - asc - تصاعدي - - - desc - تنازلي - - - - - First page - الأولى - - - Previous page - الصفحة السابقة - - - Next page - الصفحة الاحقة - - - Last page - الاخيرة - - - - - The item was created successfully. - .تمت الإضافة بنجاح - - - The item was updated successfully. - .تم التحديث بنجاح - - - The item was created successfully. You can add another one below. - .تمت الإضافة بنجاح. يمكنك إضافة آخر - - - The item was updated successfully. You can add another one below. - .تم التحديث بنجاح. يمكنك إضافة آخر - - - The item has not been saved due to some errors. - .لم يتم التحديث - - - The item was deleted successfully. - .تم الحذف بنجاح - - - You must at least select one item. - .يجب اختيار عنصر واحد على الأقل - - - You must select an action to execute on the selected items. - .يجب اختيار عمل للتنفيذ ضمن العناصر المختارة - - - A problem occurs when deleting the selected items as some items do not exist anymore. - .حال مشكل دون عملية الحذف للعناصر المختارة لأن بعضها غير موجود - - - The selected items have been deleted successfully. - .تم حذف العناصر المختارة بنجاح - - - A problem occurs when deleting the selected items. - .حال مشكل أثناء عملية الحذف للعناصر المختارة - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.bg.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.bg.xml deleted file mode 100644 index 8d38fdc1c..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.bg.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - -
    - - - - New - Нов - - - Edit - Редакция - - - Delete - Изтриване - - - List - Списък - - - Save - Съхраняване - - - Save and add - Съхраняване и Добавяне - - - Cancel - Отказ - - - Choose an action - Избери действие - - - go - ок - - - - - Reset - Нулиране - - - Filter - Филтър - - - - - No result - Няма резултати - - - Actions - Действия - - - (page %%page%%/%%nb_pages%%) - (страница %%page%% от %%nb_pages%%) - - - asc - възходящ - - - desc - низходящ - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] няма резултати|[1] 1 резултат|(1,+Inf] %1% резултата - - - - - First page - Първа страница - - - Previous page - Предишна страница - - - Next page - Следваща страница - - - Last page - Последна страница - - - - - The item was created successfully. - Записът беше създаден успешно. - - - The item was updated successfully. - Записът беше успешно обновен. - - - The item was created successfully. You can add another one below. - Записът беше създаден успешно. Можете да добавите друг. - - - The item was updated successfully. You can add another one below. - Записът беше успешно обновен. Можете да добавите друг. - - - The item has not been saved due to some errors. - Записът не беше запазен поради грешки. - - - The item was deleted successfully. - Записът беше успешно изтрит. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ca.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ca.xml deleted file mode 100644 index 6301a25af..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ca.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - -
    - - - - New - Nou - - - Edit - Edita - - - Delete - Esborrar - - - List - Llista - - - Save - Desar - - - Save and add - Desar i afegir - - - Cancel - Cancel·lar - - - - - Filters - Filtres - - - Reset - Restablir - - - Filter - Filtrar - - - - - No result - Cap resultat - - - Actions - Accions - - - (page %%page%%/%%nb_pages%%) - (pàgina %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - Choose an action - Tria una opció - - - go - executa - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] cap resultat|[1] 1 resultat|(1,+Inf] %1% resultats - - - - - First page - Primera pàgina - - - Previous page - Pàgina anterior - - - Next page - Pàgina següent - - - Last page - Última pàgina - - - - - - The item was created successfully. - El tema s'ha creat amb èxit. - - - The item was updated successfully. - El tema s'ha actualitzat amb èxit. - - - The item was created successfully. You can add another one below. - El tema s'ha creat amb èxit. Podeu afegir una altra més endavant. - - - The item was updated successfully. You can add another one below. - El tema s'ha actualitzat amb èxit. Podeu afegir una altra més endavant. - - - The item has not been saved due to some errors. - El tema no s'ha desat degut a alguns errors. - - - The item was deleted successfully. - El tema s'ha eliminat amb èxit. - - - You must at least select one item. - Has de seleccionar almenys un element. - - - You must select an action to execute on the selected items. - Has de triar l'acció que vols executar sobre els elements seleccionats. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - S'ha produït un error a l'esborrar els elements seleccionats perquè almenys un d'ells ja no existeix. - - - The selected items have been deleted successfully. - Els elements seleccionats s'han esborrat correctament. - - - A problem occurs when deleting the selected items. - S'ha produït un error a l'esborrar els elements seleccionats. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.cs.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.cs.xml deleted file mode 100644 index c4ffc007a..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.cs.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - -
    - - - - New - Vytvořit - - - Edit - Upravit - - - Delete - Odstranit - - - List - Výpis - - - Save - Uložit - - - Save and add - Uložit a přidat - - - Cancel - Zrušit - - - Choose an action - Vybrat akci - - - go - ok - - - - - Reset - Zrušit - - - Filter - Filtrovat - - - - - No result - Žádné položky - - - Actions - Akce - - - (page %%page%%/%%nb_pages%%) - (stránka %%page%%/%%nb_pages%%) - - - asc - vzestupně - - - desc - sestupně - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] žádné položky|[1] 1 položka|(1,+Inf] %1% položky - - - Are you sure? - Jste si jist? - - - Checked - Aktivováno - - - - - First page - První stránka - - - Previous page - Předchozí stránka - - - Next page - Další stránka - - - Last page - Poslední stránka - - - - - The item was created successfully. - Položka byla úspešně vytvořena. - - - The item was updated successfully. - Položka byla úspešně upravena. - - - The item was created successfully. You can add another one below. - Položka byla úspešně vytvořena. Můžete přidat další. - - - The item was updated successfully. You can add another one below. - Položka byla úspešne upravena. Můžete přidat další. - - - The item has not been saved due to some errors. - Položka nebyla uložena kvůli chybám. - - - The item was deleted successfully. - Položka byla úspešně odstraněna. - - - You must at least select one item. - Zvolte alespoň jednu položku. - - - You must select an action to execute on the selected items. - Zvolte si akci, která se provede se zvolenými položkami. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Došlo k chybě při odstraňování zvolených položek, některé z nich již neexistují. - - - The selected items have been deleted successfully. - Zvolené položky byly úspěšně odstraněny. - - - A problem occurs when deleting the selected items. - Došlo k chybě při odstraňování zvolených položek. - - - is empty - je prázdný - - - yes or no - ano nebo ne - - - yes - ano - - - no - ne - - - - - - - to %to_date%]]> - do %to_date%]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.da.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.da.xml deleted file mode 100644 index 894c03050..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.da.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Ny - - - Edit - Rediger - - - Delete - Slet - - - List - Liste - - - Save - Gem - - - Save and add - Gem og tilføj - - - Cancel - Annuler - - - - - Reset - Nulstil - - - Filter - Filtrer - - - - - No result - Intet resultat - - - Actions - Handlinger - - - (page %%page%%/%%nb_pages%%) - (side %%page%% af %%nb_pages%%) - - - asc - stigende - - - desc - faldende - - - - - First page - Første side - - - Previous page - Forrige side - - - Next page - Næste side - - - Last page - Sidste side - - - - - The item was created successfully. - Elementet er blevet tilføjet. - - - The item was updated successfully. - Elementet er blevet opdateret. - - - The item was created successfully. You can add another one below. - Elementet er blevet tilføjet, du kan tilføje endnu et element herunder. - - - The item was updated successfully. You can add another one below. - Elementet er blevet opdateret, du kan tilføje endnu et herunder. - - - The item has not been saved due to some errors. - Elementet er ikke blevet tilføjet, pga. fejl. - - - The item was deleted successfully. - Elementet er blevet slettet. - - - You must at least select one item. - Du skal vælge mindst et element. - - - You must select an action to execute on the selected items. - Du skal vælge en handling, at udføre på de valgte elementer. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Et problem opstod ved sletning af de valgte elementer, da nogen af disse ikke eksisterer mere. - - - The selected items have been deleted successfully. - De valgte elementer er blevet slettet. - - - A problem occurs when deleting the selected items. - Der var et problem, med at slette de valgte elementer. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.de.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.de.xml deleted file mode 100644 index 69c2ae1cb..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.de.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - -
    - - - - New - Neu - - - Edit - Bearbeiten - - - Delete - Löschen - - - List - Liste - - - Save - Speichern - - - Save and add - Speichern und hinzufügen - - - Cancel - Abbrechen - - - Choose an action - Eine Aktion wählen - - - go - ok - - - Back to list - Zurück zur Liste - - - - - Reset - Zurücksetzen - - - Filter - Filtern - - - - - No result - Keine Ergebnisse - - - Actions - Aktionen - - - (page %%page%%/%%nb_pages%%) - (Seite %%page%% von %%nb_pages%%) - - - asc - aufsteigend - - - desc - absteigend - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] kein Ergebnis|[1] 1 Ergebnis|(1,+Inf] %1% Ergebnisse - - - - - First page - Erste Seite - - - Previous page - Vorherige Seite - - - Next page - Nächste Seite - - - Last page - Letzte Seite - - - - - The item was created successfully. - Das Objekt wurde erfolgreich erstellt. - - - The item was updated successfully. - Das Objekt wurde erfolgreich aktualisiert. - - - The item was created successfully. You can add another one below. - Das Objekt wurde erfolgreich erstellt. Weitere können unten erstellt werden. - - - The item was updated successfully. You can add another one below. - Das Objekt wurde erfolgreich aktualisiert. Weitere können unten erstellt werden. - - - The item has not been saved due to some errors. - Das Objekt konnte wegen Fehlern nicht gespeichert werden. - - - The item was deleted successfully. - Das Objekt wurde erfolgreich gelöscht. - - - is empty - ist leer - - - yes or no - Ja oder Nein - - - yes - Ja - - - no - Nein - - - - - - - to %to_date%]]> - bis %to_date%]]> - - - - Required. - Erforderlich. - - - Invalid. - Ungültig. - - - - - - - - - - - - - - - - - - - - - - - Checked - Ausgewählt - - - Are you sure? - Sind Sie sicher? - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.el.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.el.xml deleted file mode 100644 index 811a36602..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.el.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - -
    - - - - New - Νέο - - - Edit - Επεξεργασία - - - Delete - Διαγραφή - - - List - Απαρίθμηση - - - Save - Αποθήκευση - - - Save and add - Αποθήκευση και Προσθήκη - - - Cancel - Ακύρωση - - - - - Reset - Καθαρισμός - - - Filter - Φίλτρο - - - - - No result - Κανένα Αποτέλεσμα. - - - Actions - Ενέργειες - - - (page %%page%%/%%nb_pages%%) - (Σελίδα %%page%%/%%nb_pages%%) - - - asc - αυξ - - - desc - φθι - - - - - First page - Πρώτη Σελίδα - - - Previous page - Προηγούμενη Σελίδα - - - Next page - Επόμενη Σελίδα - - - Last page - Τελευταία Σελίδα - - - - - The item was created successfully. - Το αντικείμενο δημιουργήθηκε επιτυχώς. - - - The item was updated successfully. - Το αντικείμενο ενημερώθηκε επιτυχώς. - - - The item was created successfully. You can add another one below. - Το αντικείμενο δημιουργήθηκε επιτυχώς. Μπορείτε να προσθέσετε ένα καινούριο παρακάτω. - - - The item was updated successfully. You can add another one below. - Το αντικείμενο ενημερώθηκε επιτυχώς. Μπορείτε να προσθέσετε ένα καινούριο παρακάτω. - - - The item has not been saved due to some errors. - Το αντικείμενο δεν αποθηκεύθηκε λόγω κάποιων σφαλμάτων. - - - The item was deleted successfully. - Το αντικείμενο διαγράφηκε επιτυχώς. - - - You must at least select one item. - Πρέπει να επιλέξετε τουλάχιστον ένα αντικείμενο. - - - You must select an action to execute on the selected items. - Πρέπει να επιλέξετε κάποια ενέργεια να εκτελεστεί στα επιλεγμένα αντικείμενα. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Κάποιο πρόβλημα σημειώθηκε κατά την διαγραφή των επιλεγμένων αντικειμένων καθώς μερικά αντικείμενα δεν υπάρχουν πια. - - - The selected items have been deleted successfully. - Τα επιλεγμένα αντικείμενα διαγράφηκαν επιτυχώς. - - - A problem occurs when deleting the selected items. - Κάποιο πρόβλημα σημειώθηκε κατά την διαγραφή των επιλεγμένων αντικειμένων. - - - is empty - είναι κενό - - - yes or no - ναι ή όχι - - - yes - ναι - - - no - όχι - - - - - - - to %to_date%]]> - εώς %to_date%]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es.xml deleted file mode 100644 index 913f4aeaa..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - - -
    - - - - New - Nuevo - - - Edit - Editar - - - Delete - Borrar - - - Save - Guardar - - - Save and add - Guardar y crear otro - - - Show - Mostrar - - - Are you sure? - ¿Está seguro? - - - Cancel - Cancelar - - - Choose an action - Seleccione una acción - - - go - ok - - - Back to list - Listar - - - List - Listar - - - - - Reset - Restablecer - - - Filter - Filtrar - - - Filters - Filtrar - - - - - No result - Sin resultados - - - Actions - Acciones - - - (page %%page%%/%%nb_pages%%) - (página %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] sin resultados|[1] 1 resultado|(1,+Inf] %1% resultados - - - - - First page - Primera página - - - Previous page - Página anterior - - - Next page - Página siguiente - - - Last page - Última página - - - - - The item was created successfully. - El elemento se ha creado correctamente. - - - The item was updated successfully. - El elemento se ha actualizado correctamente. - - - The item was created successfully. You can add another one below. - El elemento se ha creado correctamente y ahora puede crear otro elemento. - - - The item was updated successfully. You can add another one below. - El elemento se ha actualizado correctamente y ahora puede crear otro elemento. - - - The item has not been saved due to some errors. - El elemento no se ha guardado porque se ha producido algún error. - - - The item was deleted successfully. - El elemento se ha borrado correctamente. - - - - - - - - - - - - - - - - - You must at least select one item. - Debe seleccionar al menos un elemento. - - - You must select an action to execute on the selected items. - Seleccione la acción que quiera ejecutar sobre los elementos seleccionados. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Se ha producido un error al borrar los elementos seleccionados porque al menos uno de ellos ya no existe. - - - The selected items have been deleted successfully. - Los elementos seleccionados se han borrado correctamente. - - - A problem occurs when deleting the selected items. - Se ha producido un error al borrar los elementos seleccionados. - - - - - - - - - to %to_date%]]> - a %to_date%]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Checked - Marcado - - - is empty - Vacío - - - yes or no - si o no - - - yes - si - - - no - no - - - Required. - Obligatorio. - - - Invalid. - Inválido. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es_AR.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es_AR.xml deleted file mode 100644 index ce999a42b..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.es_AR.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - -
    - - - - New - Nuevo - - - Edit - Editar - - - Delete - Borrar - - - List - Listar - - - Save - Guardar - - - Save and add - Guardar y agregar otro - - - Cancel - Cancelar - - - - - Reset - Reiniciar - - - Filter - Filtrar - - - - - No result - Sin resultados - - - Actions - Acciones - - - (page %%page%%/%%nb_pages%%) - (página %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - - - First page - Primera página - - - Previous page - Página anterior - - - Next page - Siguiente página - - - Last page - Ultima página - - - - - The item was created successfully. - El elemento fue creado satisfactoriamente. - - - The item was updated successfully. - El elemento fue actualizado satisfactoriamente. - - - The item was created successfully. You can add another one below. - El elemento fue creado satisfactoriamente. Podés agregar otro abajo. - - - The item was updated successfully. You can add another one below. - El elemento fue actualizado satisfactoriamente. Podés agregar otro abajo. - - - The item has not been saved due to some errors. - El elemento no fue guardado debido a algunos errores. - - - The item was deleted successfully. - El elemento fue borrado satisfactoriamente. - - - - \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.eu.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.eu.xml deleted file mode 100644 index 4a925661e..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.eu.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - -
    - - - - New - Berria - - - Edit - Aldatu - - - Delete - Ezabatu - - - List - Zerrendatu - - - Save - Gorde - - - Save and add - Gorde eta berria - - - Cancel - Ezeztatu - - - Choose an action - Ekintza bat aukeratu - - - go - ok - - - - - Reset - Garbitu - - - Filter - Mugatu - - - - - No result - Emaitzarik ez - - - Actions - Ekintzak - - - (page %%page%%/%%nb_pages%%) - (%%page%%/%%nb_pages%% orria) - - - asc - gora - - - desc - behera - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] emaitzarik ez|[1] emaitza bat|(1,+Inf] %1% emaitzak - - - - - First page - Lehen orria - - - Previous page - Aurreko orria - - - Next page - Hurrengo orria - - - Last page - Azken orria - - - - - The item was created successfully. - Elementua egoki sortu da. - - - The item was updated successfully. - Elementua egoki eguneratu da. - - - The item was created successfully. You can add another one below. - Elementua egoki sortu da eta orain beste elementu bat sor dezakezu. - - - The item was updated successfully. You can add another one below. - Elementua egoki eguneratu da eta orain beste elementu bat sor dezakezu. - - - The item has not been saved due to some errors. - Elementua ez da gorde errakuntzaren bat gertatu delako. - - - The item was deleted successfully. - Elementua egoki ezabatu da. - - - You must at least select one item. - Gutxienez, elementu bat aukeratu behar duzu. - - - You must select an action to execute on the selected items. - Aukeratutako elementuen artean, exekutatu nahi duzun ekintza aukeratu. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Aukeratutako elementuak ezabatzerakoan errakuntza bat gertatu da, horietako bat, gutxienez, existitzen ez delako. - - - The selected items have been deleted successfully. - Aukeratutako elementuak egoki ezabatu dira. - - - A problem occurs when deleting the selected items. - Errakuntza bat gertatu da, aukeratutako elementuak ezabatzerakoan. - - - is empty - hutsik - - - yes or no - bai ala ez - - - yes - bai - - - no - ez - - - - - - - to %to_date%]]> - %to_date%-ra]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fa.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fa.xml deleted file mode 100644 index 5a5c84cfc..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fa.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - -
    - - - - - Choose an action - انتخاب عملیات - - - go - برو - - - New - جديد - - - Edit - ویرایش - - - Delete - حذف - - - List - لیست - - - Save - ذخیره - - - Save and add - دخیره و افزودن - - - Cancel - لغو - - - Show - نمایش - - - Back to list - بازگشت به لیست - - - - - Filters - فیلترها - - - Reset - بازنشانی - - - Filter - فیلتر - - - - - No result - بدون نتیجه - - - Actions - عملیات - - - (page %%page%%/%%nb_pages%%) - (%%nb_pages%%/%%page%% صفحه) - - - asc - صعودی - - - desc - نزولی - - - Choose an action - عملیاتی را انتخاب کنید - - - go - انجام - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] بدون نتیجه|[1] 1 نتیجه|(1,+Inf] %1% نتیجه - - - - - First page - صفحه اول - - - Previous page - صفحه قبل - - - Next page - صفحه بعد - - - Last page - صفحه آخر - - - - - - The item was created successfully. - مورد با موفقیت ایجاد شد. - - - The item was updated successfully. - مورد با موفقیت به روز رسانی شد - - - The item was created successfully. You can add another one below. - مورد با موفقیت ایجاد شد. میتوانید مورد دیگری را در ادامه اضافه کنید. - - - The item was updated successfully. You can add another one below. - مورد با موفیت به روز رسانی شد. میتوانید مورد دیگری را در ادامه اضافه کنید - - - The item has not been saved due to some errors. - به علت بروز خطا مورد ذخیره نشد. - - - The item was deleted successfully. - مورد با موفقیت حذف شد. - - - You must at least select one item. - شما باید حداقل یک مورد را انتخاب نمایید. - - - You must select an action to execute on the selected items. - شما باید عملیاتی را جهت اعمال روی اقلام انتخابی ، انتخاب کنید. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - مشکلی در حذف موارد انتخابی پیش آمد.زیرا بعضی از اقلام انتخابی دیگر وجود ندارند. - - - The selected items have been deleted successfully. - اقلام انتخاب شده با موفقیت حذف گردید. - - - A problem occurs when deleting the selected items. - مشکلی در حذف اقلام انتخابی پیش آمد. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fi.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fi.xml deleted file mode 100644 index 71c934ca4..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fi.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Uusi - - - Edit - Muokkaa - - - Delete - Poista - - - List - Näytä lista - - - Save - Tallenna - - - Save and add - Tallenna ja lisää - - - Cancel - Peruuta - - - - - Reset - Tyhjennä - - - Filter - Suodata - - - - - No result - Ei tuloksia - - - Actions - Toiminnot - - - (page %%page%%/%%nb_pages%%) - (sivu %%page%%/%%nb_pages%%) - - - asc - kasvava - - - desc - madaltuva - - - - - First page - Ensimmäinen sivu - - - Previous page - Edellinen sivu - - - Next page - Seuraava sivu - - - Last page - Viimeinen sivu - - - - - The item was created successfully. - Merkinnän luonti onnistui. - - - The item was updated successfully. - Merkinnän päivittäminen onnistui. - - - The item was created successfully. You can add another one below. - Merkinnän luonti onnistui. Voit lisätä sen alle seuraavan. - - - The item was updated successfully. You can add another one below. - Merkinnän päivitys onnistui. Voit lisätä sen alle seuraavan. - - - The item has not been saved due to some errors. - Merkintää ei tallennettu virheiden takia. - - - The item was deleted successfully. - Merkinnän poistaminen onnistui. - - - You must at least select one item. - Valitse vähintään yksi merkintä. - - - You must select an action to execute on the selected items. - Valitse toiminto, joka suoritetaan valituille merkinnöille. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Valittujen merkintöjen poistamisessa esiintyi virhe, koska jotkut merkinnät eivät enää olleet olemassa. - - - The selected items have been deleted successfully. - Valittujen merkintöjen poistaminen onnistui. - - - A problem occurs when deleting the selected items. - Valittujen merkintöjen poistamisessa esiintyi virhe. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fr.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fr.xml deleted file mode 100644 index cffa788aa..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.fr.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - -
    - - - - New - Nouveau - - - Edit - Modifier - - - Delete - Supprimer - - - List - Liste - - - Save - Mettre à jour - - - Save and add - Mettre à jour et ajouter - - - Cancel - Annuler - - - Choose an action - Choisir une action - - - go - ok - - - Back to list - Retour à la liste - - - - - Reset - Effacer - - - Filter - Filtrer - - - - - No result - Aucun résultat. - - - Actions - Actions - - - (page %%page%%/%%nb_pages%%) - (page %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] aucun résultat|[1] 1 résultat|(1,+Inf] %1% résultats - - - - - First page - Première page - - - Previous page - Page précédente - - - Next page - Page suivante - - - Last page - Dernière page - - - - - The item was created successfully. - L'objet a été ajouté avec succès. - - - The item was updated successfully. - L'objet a été mis à jour avec succès. - - - The item was created successfully. You can add another one below. - L'objet a été ajouté avec succès. Vous pouvez en ajouter un autre. - - - The item was updated successfully. You can add another one below. - L'objet a été mis à jour avec succès. Vous pouvez en ajouter un autre. - - - The item has not been saved due to some errors. - L'objet n'a pu être mis à jour. - - - The item was deleted successfully. - L'objet a été supprimé avec succès. - - - You must at least select one item. - Vous devez au moins sélectionner un objet. - - - You must select an action to execute on the selected items. - Vous devez sélectionner une action à executer sur les objets sélectionnés. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Un problème est survenu lors de la suppression des objets sélectionnés car certains objets n'existent plus. - - - The selected items have been deleted successfully. - Les objets sélectionnés ont été supprimés avec succès. - - - A problem occurs when deleting the selected items. - Un problème est survenu lors de la suppression des objets sélectionnés. - - - is empty - est vide - - - yes or no - oui ou non - - - yes - oui - - - no - non - - - - - - - to %to_date%]]> - au %to_date%]]> - - - - Required. - Obligatoire. - - - Invalid. - Invalide. - - - - - - - - - - - - - - - - - - - - - - - Are you sure? - Etes-vous sûr ? - - - Checked - Activé - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hr.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hr.xml deleted file mode 100644 index fe0c4e502..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hr.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Novo - - - Edit - Uredi - - - Delete - Obriši - - - List - Lista - - - Save - Spremi - - - Save and add - Spremi i dodaj - - - Cancel - Odustani - - - - - Reset - Poništi - - - Filter - Filtriraj - - - - - No result - Nema rezultata - - - Actions - Akcije - - - (page %%page%%/%%nb_pages%%) - (stranica %%page%%/%%nb_pages%%) - - - asc - rastuće - - - desc - padajuće - - - - - First page - Prva stranica - - - Previous page - Prethodna stranica - - - Next page - Sljedeća stranica - - - Last page - Zadnja stranica - - - - - The item was created successfully. - Stavka je uspješno kreirana. - - - The item was updated successfully. - Izmjene su spremljene. - - - The item was created successfully. You can add another one below. - Stavka uspješno kreirana. Možete dodati sljedeću. - - - The item was updated successfully. You can add another one below. - Izmjene su spremljene. Možete dodati sljedeću stavku. - - - The item has not been saved due to some errors. - Stavka nije spremljena zbog greške. - - - The item was deleted successfully. - Stavka uspješno izbrisana. - - - You must at least select one item. - Morate izabrati barem jednu stavku. - - - You must select an action to execute on the selected items. - Morate izabrati akciju koja će se izvršiti na izabranim stavkama. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Ne mogu izbrisati izabrane stavke jer neke više ne postoje. - - - The selected items have been deleted successfully. - Izabrane stavke su uspješno obrisane. - - - A problem occurs when deleting the selected items. - Ne mogu izbrisati izabrane stavke zbog greške. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hu.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hu.xml deleted file mode 100644 index 7642ad554..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.hu.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Új - - - Edit - Szerkesztés - - - Delete - Törlés - - - List - Lista - - - Save - Mentés - - - Save and add - Mentés és új elem - - - Cancel - Mégsem - - - - - Reset - Alapértelmezett - - - Filter - Szűrés - - - - - No result - Nincs találat. - - - Actions - Műveletek - - - (page %%page%%/%%nb_pages%%) - (oldal %%page%%/%%nb_pages%%) - - - asc - növekvő - - - desc - csökkenő - - - - - First page - Első oldal - - - Previous page - Előző oldal - - - Next page - Következő oldal - - - Last page - Utolsó oldal - - - - - The item was created successfully. - Az elem létrehozása sikeres volt. - - - The item was updated successfully. - Az elem mentése sikeres volt. - - - The item was created successfully. You can add another one below. - Az elem létrehozása sikeres volt. Újabb létrehozása az alábbi adatlapon. - - - The item was updated successfully. You can add another one below. - Az elem mentése sikeres volt. Újabb létrehozása az alábbi adatlapon. - - - The item has not been saved due to some errors. - Az elem mentése hiba miatt sikertelen volt. - - - The item was deleted successfully. - Az elem törlése sikeres volt. - - - You must at least select one item. - Legalább egy elemet ki kell választani. - - - You must select an action to execute on the selected items. - Válassza ki a kiválasztott elemeken végrehajtandó műveletet. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Probléma lépett fel a kiválasztott elemek törlése közben, valamely elem már eleve nem létezett. - - - The selected items have been deleted successfully. - A kiválasztott elemek törlése sikeres volt. - - - A problem occurs when deleting the selected items. - Probléma lépett fel a kiválasztott elemek törlése közben. - - - - \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.id.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.id.xml deleted file mode 100644 index 4c271141d..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.id.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Buat Baru - - - Edit - Sunting - - - Delete - Hapus - - - List - Indeks - - - Save - Simpan - - - Save and add - Simpan dan tambah baru - - - Cancel - Batalkan - - - - - Reset - Kembalikan seperti semula - - - Filter - Filter - - - - - No result - Tak ada hasil - - - Actions - Aksi - - - (page %%page%%/%%nb_pages%%) - (halaman %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - - - First page - Halaman pertama - - - Previous page - Halaman sebelumnya - - - Next page - Halaman berikut - - - Last page - Halaman terakhir - - - - - The item was created successfully. - Data telah berhasil dibuat. - - - The item was updated successfully. - Data telah berhasil diperbaharui. - - - The item was created successfully. You can add another one below. - Data telah berhasil dibuat. Anda dapat menambahkan data baru di bawah ini. - - - The item was updated successfully. You can add another one below. - Data telah berhasil diperbaharui. Anda dapat menambahkan data baru di bawah ini. - - - The item has not been saved due to some errors. - Data gagal disimpan karena adanya kesalahan. - - - The item was deleted successfully. - Data telah berhasil dihapus. - - - You must at least select one item. - Anda harus memilih paling tidak satu data. - - - You must select an action to execute on the selected items. - Anda harus memilih sebuah aksi pada data yang telah terpilih. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Terjadi masalah pada saat akan menghapus data yang terpilih karena beberapa data tidak lagi tersedia. - - - The selected items have been deleted successfully. - Data yang terpilih telah berhasil dihapus. - - - A problem occurs when deleting the selected items. - Terjadi masalah pada saat akan menghapus data yang terpilih. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.it.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.it.xml deleted file mode 100644 index f8041d935..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.it.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - - -
    - - - - New - Nuovo - - - Edit - Modifica - - - Delete - Cancella - - - List - Lista - - - Save - Salva - - - Save and add - Salva e aggiungi - - - Cancel - Annulla - - - Choose an action - Scegli un'azione - - - go - ok - - - Back to list - Torna alla lista - - - - - Reset - Reset - - - Filter - Filtra - - - - - No result - Nessun risultato - - - Actions - Azioni - - - (page %%page%%/%%nb_pages%%) - (pagina %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - disc - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] nessun risultato|[1] 1 risultato|(1,+Inf] %1% risultati - - - - - First page - Prima pagina - - - Previous page - Pagina precedente - - - Next page - Pagina seguente - - - Last page - Ultima pagina - - - - - The item was created successfully. - L'elemento è stato creato con successo. - - - The item was updated successfully. - L'elemento è stato aggiornato con successo. - - - The item was created successfully. You can add another one below. - L'elemento è stato creato con successo. Puoi aggiungerne un altro di seguito. - - - The item was updated successfully. You can add another one below. - L'elemento è stato aggiornato con successo. Puoi aggiungerne un altro di seguito. - - - The item has not been saved due to some errors. - L'elemento non è stato salvato a causa di qualche errore. - - - The item was deleted successfully. - L'elemento è stato cancellato con successo. - - - You must at least select one item. - Selezionare almeno un elemento. - - - You must select an action to execute on the selected items. - Selezionare un'azione da eseguire sugli elementi selezionati. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Si è verificato un problema durante la cancellazione degli elementi selezionati, alcuni elementi non esistono più. - - - The selected items have been deleted successfully. - Gli elementi selezionati sono stati cancellati. - - - A problem occurs when deleting the selected items. - Si è verificato un problema durante la cancellazione degli elementi selezionati. - - - is empty - è vuoto - - - yes or no - si o no - - - yes - si - - - no - no - - - - - - - to %to_date%]]> - a %to_date%]]> - - - Required. - Obbligatorio. - - - Invalid. - Non valido. - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ja.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ja.xml deleted file mode 100644 index 05f4f2ec1..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ja.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - -
    - - - - New - 新規作成 - - - Edit - 編集 - - - Delete - 削除 - - - List - 一覧 - - - Save - 保存 - - - Save and add - 保存して更に追加 - - - Cancel - キャンセル - - - Choose an action - アクションを選択 - - - go - 実行 - - - Back to list - リストに戻る - - - - - Reset - リセット - - - Filter - 検索 - - - - - No result - データがありません - - - Actions - 操作 - - - (page %%page%%/%%nb_pages%%) - (ページ %%page%%/%%nb_pages%%) - - - asc - 降順 - - - desc - 昇順 - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] 0件|[1] 1件|(1,+Inf] %1% 件 - - - - - First page - 最初のページ - - - Previous page - 前のページ - - - Next page - 次のページ - - - Last page - 最後のページ - - - - - The item was created successfully. - アイテムを作成しました - - - The item was updated successfully. - アイテムを更新しました - - - The item was created successfully. You can add another one below. - アイテムを作成しました。以下で別のアイテムを追加できます。 - - - The item was updated successfully. You can add another one below. - アイテムを更新しました。以下で別のアイテムを追加できます。 - - - The item has not been saved due to some errors. - エラーのためアイテムを保存できませんでした - - - The item was deleted successfully. - アイテムを削除しました - - - You must at least select one item. - 最低でも1つを選択してください。 - - - You must select an action to execute on the selected items. - 選択されたアイテムを処理するためにアクションを選択してください。 - - - A problem occurs when deleting the selected items as some items do not exist anymore. - すでに存在しないアイテムを削除しようとしてエラーが発生しました。 - - - The selected items have been deleted successfully. - 選択されたアイテムを削除しました。 - - - A problem occurs when deleting the selected items. - 選択されたアイテムを削除するときにエラーが発生しました。 - - - is empty - 空の値も含む - - - yes or no - 全て - - - yes - はい - - - no - いいえ - - - - - - - to %to_date%]]> - %to_date%]]> - - - - - Required. - 必須項目です。 - - - Invalid. - 無効な値です。 - - - "%value%" is not an integer. - "%value%" は数値でありません。 - - - "%value%" is not a number. - "%value%" は数字でありません。 - - - At least %min% values must be selected (%count% values selected). - %min% 個以上選択してください(現在 %count% が選択されています)。 - - - At most %max% values must be selected (%count% values selected). - %min% 個以内で選択してください(現在 %count% が選択されています)。 - - - CSRF attack detected. - 画面遷移が確認できませんでした - - - "%value%" does not match the date format (%date_format%). - "%value%" が日付のフォーマット (%date_format%)に一致しません - - - The date must be before %max%. - 日付は %max% より前を指定してください - - - The date must be after %min%. - 日付は %min% より後を指定してください - - - The begin date must be before the end date. - 開始日は終了日より前でなければなりません。 - - - File is too large (maximum is %max_size% bytes). - ファイルのサイズが大きすぎます(アップロードできるファイルサイズは%max_size%バイトです)。 - - - Invalid mime type (%mime_type%). - 無効なmimeタイプです(%mime_type%)。 - - - The uploaded file was only partially uploaded. - アップロードされたファイルは不十分な状態でアップロードされました。 - - - Missing a temporary folder. - テンポラリフォルダーがありません。 - - - Failed to write file to disk. - ディスクへのファイル書き込みに失敗しました。 - - - File upload stopped by extension. - ファイルの拡張子の制限でアップロードは中止しました。 - - - Unexpected extra form field named "%field%". - "%field%" という不明のフィールドがあります - - - "%value%" is too long (%max_length% characters max). - 入力文字数がオーバーしています (%max_length%文字以下) - - - "%value%" is too short (%min_length% characters min). - 入力文字数が不足しています (%min_length%文字以上) - - - "%value%" does not match the time format (%time_format%). - "%value%"が時刻のフォーマット (%time_format%)に一致しません - - - "%value%" must be at most %max%. - "%value%" は %max% より小さくなければなりません。 - - - "%value%" must be at least %min. - "%value%" %min% より大きくなければなりません。 - - - The date must be before %max%. - 日付は %max% より前の日付でなければなりません。 - - - The date must be after %min%. - 日付は %mix% より後の日付でなければなりません。 - - - The form submission cannot be processed. It probably means that you have uploaded a file that is too big. - フォームの処理ができませんでした。アップロードしたファイルのサイズが大きすぎるのかもしれません。 - - - - - "%value%" must be less than %max%. - "%value%" は %max% より小さい値を指定してください - - - "%value%" must be greater than %min%. - "%value%" は %min% より大きい値を指定してください - - - An object with the same "%column%" already exist. - 既に登録されています - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lt.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lt.xml deleted file mode 100644 index b19c4d27e..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lt.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Naujas - - - Edit - Redaguoti - - - Delete - Šalinti - - - List - Sąrašas - - - Save - Išsaugoti - - - Save and add - Išsaugoti ir pridėti - - - Cancel - Atšaukti - - - - - Reset - Atstatyti - - - Filter - Filtruoti - - - - - No result - Rezultatų nerasta - - - Actions - Veiksmai - - - (page %%page%%/%%nb_pages%%) - (puslapis %%page%%/%%nb_pages%%) - - - asc - didėjančiai - - - desc - mažėjančiai - - - - - First page - Pirmas puslapis - - - Previous page - Ankstesnis puslapis - - - Next page - Kitas puslapis - - - Last page - Paskutinis puslapis - - - - - The item was created successfully. - Sukurta sėkmingai. - - - The item was updated successfully. - Atnaujinta sėkmingai. - - - The item was created successfully. You can add another one below. - Sukurta sėkmingai. Naują galite pridėti žemiau. - - - The item was updated successfully. You can add another one below. - Ataujinta sėkmingai. Naują galite pridėti žemiau. - - - The item has not been saved due to some errors. - Išsaugoti nepavyko dėl esančių klaidų. - - - The item was deleted successfully. - Pašalinta sėkmingai. - - - You must at least select one item. - Turite pasirinkti bent vieną elementą. - - - You must select an action to execute on the selected items. - Turite pasirinkti veiksmą, kurį norite atlikti su pasirinktais elementais. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Nepavyko pašalinti pasirinktų elementų, kadangi kai kurie elementai jau nebeegzistuoja. - - - The selected items have been deleted successfully. - Pasirinkti elementai pašalinti sėkmingai. - - - A problem occurs when deleting the selected items. - Nepavyko pašalinti pasirinktų elementų. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lv.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lv.xml deleted file mode 100644 index 7f51560c1..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.lv.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Jauns - - - Edit - Rediģēt - - - Delete - Dzēst - - - List - Saraksts - - - Save - Saglabāt - - - Save and add - Saglabāt un pievienot - - - Cancel - Atcelt - - - - - Reset - Atiestatīt - - - Filter - Filtrēt - - - - - No result - Nav datu - - - Actions - Darbības - - - (page %%page%%/%%nb_pages%%) - (lapa %%page%%/%%nb_pages%%) - - - asc - augoši - - - desc - dilstoši - - - - - First page - Pirmā lapa - - - Previous page - Iepriekšejā lapa - - - Next page - Nākamā lapa - - - Last page - Pēdējā lapa - - - - - The item was created successfully. - Izveide sekmīga. - - - The item was updated successfully. - Rediģēšana sekmīga. - - - The item was created successfully. You can add another one below. - Izveide sekmīga, lai pievienotu vēl vienu, lietojiet zemāk esošo formu. - - - The item was updated successfully. You can add another one below. - Rediģēšana sekmīga, lai pievienotu vēl vienu, lietojiet zemāk esošo formu. - - - The item has not been saved due to some errors. - Neizdevās saglabāt kļūdu dēļ. - - - The item was deleted successfully. - Dzēšana sekmīga. - - - You must at least select one item. - Jāiezīmē vismaz viena vienība. - - - You must select an action to execute on the selected items. - Jānorāda darbība, kura veicama ar iezīmētajām vienībām. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Problēma dzēsot - visas vienības vairs neeksistē. - - - The selected items have been deleted successfully. - Atzīmētās vienības sekmīgi izdzēstas. - - - A problem occurs when deleting the selected items. - Dzēsot atzīmētās vienības notiek kļūda. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.nl.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.nl.xml deleted file mode 100644 index b17ed088c..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.nl.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - -
    - - - - New - Nieuw - - - Edit - Wijzig - - - Delete - Verwijder - - - List - Lijst - - - Save - Opslaan - - - Save and add - Opslaan en Doorgaan - - - Cancel - Annuleren - - - Choose an action - Kies een optie - - - go - ok - - - Back to list - Terug naar lijst - - - - - Reset - Herstellen - - - Filter - Filteren - - - - - No result - Geen resultaat - - - Actions - Acties - - - (page %%page%%/%%nb_pages%%) - (pagina %%page%%/%%nb_pages%%) - - - asc - opl - - - desc - afl - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] geen resultaat|[1] 1 resultaat|(1,+Inf] %1% resultaten - - - - - First page - Eerste pagina - - - Previous page - Vorige pagina - - - Next page - Volgende pagina - - - Last page - Laatste pagina - - - - - The item was created successfully. - Het item is succesvol aangemaakt. - - - The item was updated successfully. - Het item is succesvol gewijzigd. - - - The item was created successfully. You can add another one below. - Het items is succesvol aangemaakt. Hieronder kan je nog een item toevoegen. - - - The item was updated successfully. You can add another one below. - Het item is succesvol gewijzigd. Hieronder kan je nog een item toevoegen. - - - The item has not been saved due to some errors. - Het item is niet opgeslagen vanwege fouten. - - - The item was deleted successfully. - Het item is succesvol verwijderd - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.no.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.no.xml deleted file mode 100644 index b1ebe4012..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.no.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - -
    - - - - New - Ny - - - Edit - Rediger - - - Delete - Slett - - - List - Liste - - - Save - Lagre - - - Save and add - Lagre og opprett ny - - - Cancel - Avbryt - - - - - Reset - Tilbakestill - - - Filter - Filtrer - - - - - No result - Ingen resultater - - - Actions - Handlinger - - - (page %%page%%/%%nb_pages%%) - (side %%page%%/%%nb_pages%%) - - - asc - stigende - - - desc - synkende - - - - - First page - Første side - - - Previous page - Forrige side - - - Next page - Neste side - - - Last page - Siste side - - - - - The item was created successfully. - Nytt objekt opprettet. - - - The item was updated successfully. - Objekt oppdatert. - - - The item was created successfully. You can add another one below. - Objektet ble opprettet, du kan opprette et nytt nedenfor. - - - The item was updated successfully. You can add another one below. - Objekt oppdatert, du kan opprette et nytt nedenfor. - - - The item has not been saved due to some errors. - Objektet ble ikke lagret, grunnet noen feil. - - - The item was deleted successfully. - Objekt slettet. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pl.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pl.xml deleted file mode 100644 index af874c585..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pl.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - -
    - - - - New - Nowy - - - Edit - Edytuj - - - Delete - Skasuj - - - List - Lista - - - Save - Zapisz - - - Save and add - Zapisz i dodaj - - - Cancel - Anuluj - - - Choose an action - Wybierz akcję - - - go - ok - - - Back to list - Powrót do listy - - - - - Reset - Wyczyść - - - Filter - Szukaj - - - - - No result - Brak wyników. - - - Actions - Akcje - - - (page %%page%%/%%nb_pages%%) - (strona %%page%%/%%nb_pages%%) - - - asc - rosnąco - - - desc - malejąco - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] brak wyników|[1,+Inf] wyników: %1% - - - - - First page - Pierwsza strona - - - Previous page - Poprzednia strona - - - Next page - Następna strona - - - Last page - Ostatnia strona - - - - - The item was created successfully. - Obiekt został poprawnie utworzony. - - - The item was updated successfully. - Obiekt został poprawnie zaktualizowany. - - - The item was created successfully. You can add another one below. - Obiekt został poprawnie utworzony. Możesz teraz dodać kolejny. - - - The item was updated successfully. You can add another one below. - Obiekt został poprawnie zaktualizowany. Możesz teraz dodać kolejny. - - - The item has not been saved due to some errors. - Z powodu błędów obiekt nie został zapisany. - - - The item was deleted successfully. - Obiekt został poprawnie skasowany. - - - You must at least select one item. - Musisz wybrać co najmniej jeden obiekt. - - - You must select an action to execute on the selected items. - Musisz wybrać akcję do wykonania na wybranych obiektach. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Wystąpił błąd podczas usuwania wybranych obiektów, ponieważ niektóre już nie istnieją. - - - The selected items have been deleted successfully. - Wybrane obiekty zostały skasowane. - - - A problem occurs when deleting the selected items. - Wystąpił błąd podczas usuwania wybranych obiektów. - - - is empty - jest pusty - - - yes or no - tak lub nie - - - yes - tak - - - no - nie - - - - - - - to %to_date%]]> - do %to_date%]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt.xml deleted file mode 100644 index 6081506eb..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - -
    - - - - New - Novo - - - Edit - Editar - - - Delete - Apagar - - - List - Listar - - - Save - Gravar - - - Save and add - Gravar e adicionar - - - Cancel - Cancelar - - - - - Reset - Eliminar - - - Filter - Filtrar - - - - - No result - Nenhum resultado. - - - Actions - Acções - - - (page %%page%%/%%nb_pages%%) - (página %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - - - First page - Primeira página - - - Previous page - Página anterior - - - Next page - Próxima página - - - Last page - Última página - - - - - The item was created successfully. - O objecto foi criado com sucesso. - - - The item was updated successfully. - O objecto foi actualizado com sucesso. - - - The item was created successfully. You can add another one below. - O objecto foi criado com sucesso. Poderá adicionar outro de seguida. - - - The item was updated successfully. You can add another one below. - O objecto foi actualizado com sucesso. Poderá adicionar outro de seguida. - - - The item has not been saved due to some errors. - O objecto não foi guardado devido a erros. - - - The item was deleted successfully. - O objecto foi apagado com sucesso. - - - You must at least select one item. - Deverá seleccionar pelo menos um objecto. - - - You must select an action to execute on the selected items. - Deverá selecionar uma acção para executar nos objectos seleccionados. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Um problema ocorreu ao apagar os objectos seleccionados devido à sua inexistência. - - - The selected items have been deleted successfully. - Os objectos seleccionados foram apagados com sucesso.. - - - A problem occurs when deleting the selected items. - Ocorreu um erro ao apagar os objectos seleccionados. - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt_BR.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt_BR.xml deleted file mode 100644 index a669e319a..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.pt_BR.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - -
    - - - - New - Novo - - - Edit - Editar - - - Delete - Remover - - - List - Listar - - - Save - Salvar - - - Save and add - Salvar e Adicionar outro - - - Cancel - Cancelar - - - - - Reset - Limpar - - - Filter - Filtrar - - - - - No result - Nenhum resultado. - - - Actions - Ações - - - (page %%page%%/%%nb_pages%%) - (página %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - - - First page - Primeira página - - - Previous page - Página anterior - - - Next page - Próxima página - - - Last page - Última página - - - - - The item was created successfully. - Item adicionado com sucesso. - - - The item was updated successfully. - Item atualizado com sucesso. - - - The item was created successfully. You can add another one below. - Item adicionado com sucesso. Você pode adicionar outro abaixo. - - - The item was updated successfully. You can add another one below. - Item atualizado com sucesso. Você pode adicionar outro abaixo. - - - The item has not been saved due to some errors. - Item não atualizado devido a erros. - - - The item was deleted successfully. - Item removido com sucesso. - - - The item was deleted successfully. - Ítem excluído com sucesso. - - - You must at least select one item. - Você deve selecionar pelo menos um ítem. - - - You must select an action to execute on the selected items. - Você deve selecionar uma ação a ser executada nos ítens selecionados. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Ocorreu um problema ao excluir os ítens selecionados pois alguns deles não existem mais. - - - The selected items have been deleted successfully. - Os ítens selecionados foram excluídos com sucesso. - - - A problem occurs when deleting the selected items. - Ocorreu um problema ao deletar os ítens selecionados. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ro.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ro.xml deleted file mode 100644 index cbeff9cf8..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ro.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - -
    - - - - New - Nou - - - Edit - Editare - - - Delete - Ştergere - - - List - Listare - - - Save - Salvare - - - Save and add - Salvare şi adăugare - - - Cancel - Anulare - - - - - Reset - Resetare - - - Filter - Filtrare - - - - - No result - Nici un rezultat. - - - Actions - Acţiuni - - - (page %%page%%/%%nb_pages%%) - (pagina %%page%%/%%nb_pages%%) - - - asc - asc - - - desc - desc - - - - - First page - Prima pagină - - - Previous page - Pagina precedentă - - - Next page - Pagina următoare - - - Last page - Ultima pagină - - - - - The item was created successfully. - Obiectul a fost creat cu succes. - - - The item was updated successfully. - Obiectul a fost actualizat cu succes. - - - The item was created successfully. You can add another one below. - Obiectul a fost creat cu succes. Puteţi să mai adăugaţi unul mai jos. - - - The item was updated successfully. You can add another one below. - Obiectul a fost actualizat cu succes. Puteţi să mai adăugaţi unul mai jos. - - - The item has not been saved due to some errors. - Obiectul n-a putut fi salvat. - - - The item was deleted successfully. - Obiectul a fost şters cu succes. - - - You must at least select one item. - Trebuie să selectaţi cel puţin un obiect. - - - You must select an action to execute on the selected items. - Trebuie să selectaţi o acţiune ce va fi executată asupra obiectelor selectate. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - A survenit o problemă la ştergerea obiectelor selectate deoarece o parte din acestea nu mai există. - - - The selected items have been deleted successfully. - Obiectele selectate au fost şterse cu succes. - - - A problem occurs when deleting the selected items. - A survenit o problemă la ştergerea obiectelor selectate. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ru.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ru.xml deleted file mode 100644 index 0a3067778..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.ru.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - -
    - - - - New - Создать - - - Edit - Редактировать - - - Delete - Удалить - - - List - Список - - - Save - Сохранить - - - Save and add - Сохранить и добавить - - - Cancel - Отмена - - - Choose an action - Выберите действие - - - go - Выполнить - - - Back to list - Вернуться к списку - - - - - Reset - Очистить - - - Filter - Фильтр - - - - - No result - Нет результатов - - - Actions - Действия - - - (page %%page%%/%%nb_pages%%) - (страница %%page%%/%%nb_pages%%) - - - asc - По возрастанию - - - desc - По убыванию - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] нет результатов|[1] 1 результат|(1,+Inf] %1% результата(ов) - - - - - First page - Первая страница - - - Previous page - Предыдущая страница - - - Next page - Следующая страница - - - Last page - Последняя страница - - - - - The item was created successfully. - Объект успешно создан. - - - The item was updated successfully. - Объект успешно изменен. - - - The item was created successfully. You can add another one below. - Объект успешно создан. Вы можете добавить еще один. - - - The item was updated successfully. You can add another one below. - Объект успешно обновлен. Вы можете добавить еще один. - - - The item has not been saved due to some errors. - Объект не сохранен из-за некоторых ошибок. - - - The item was deleted successfully. - Объект успешно удален. - - - You must at least select one item. - Вы должны выделить как минимум один объект. - - - You must select an action to execute on the selected items. - Вы должны выбрать действие, которое будет выполнено с выделенными объектами. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Возникла проблемма при удалении выделенных объектов, так как некоторые объекты больше не существуют. - - - The selected items have been deleted successfully. - Выделенные объекты успешно удалены. - - - A problem occurs when deleting the selected items. - Возникла проблемма при удалении выделенных объектов. - - - is empty - пустое значение - - - yes or no - да или нет - - - yes - да - - - no - нет - - - - - - - to %to_date%]]> - до %to_date%]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sk.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sk.xml deleted file mode 100644 index 5e512e8a0..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sk.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - -
    - - - - New - Vytvoriť - - - Edit - Upraviť - - - Delete - Vymazať - - - List - Výpis - - - Save - Uložiť - - - Save and add - Uložiť a pridať - - - Cancel - Zrušiť - - - - - Reset - Zrušiť - - - Filter - Filtrovať - - - - - No result - Žiaden výsledok. - - - Actions - Akcie - - - (page %%page%%/%%nb_pages%%) - (stránka %%page%%/%%nb_pages%%) - - - asc - vzostupne - - - desc - zostupne - - - - - First page - Prvá stránka - - - Previous page - Predchádzajúca stránka - - - Next page - Nasledujúca stránka - - - Last page - Posledná stránka - - - - - The item was created successfully. - Položka bola úspešne vytvorená. - - - The item was updated successfully. - Položka bola úspešne upravená. - - - The item was created successfully. You can add another one below. - Položka bola úspešne vytvorená. Môžete pridať ďalšiu. - - - The item was updated successfully. You can add another one below. - Položka bola úspešne upravená. Môžete pridať ďalšiu. - - - The item has not been saved due to some errors. - Položka nebola uložená kôli niekoľkým chybám. - - - The item was deleted successfully. - Položka bola úspešne vymazaná. - - - You must at least select one item. - Prosím zvoľte si aspoň jednu položku. - - - You must select an action to execute on the selected items. - Prosím zvoľte si akciu na vykonanie s týmito položkami. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Vyskytol sa problem pri mazaní viacerých položiek, keďže niektore z nich už neexistujú. - - - The selected items have been deleted successfully. - Vybrané položky boli úspešne vymazané. - - - A problem occurs when deleting the selected items. - Vyskytol sa problem pri mazaní zvolených položiek. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sl.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sl.xml deleted file mode 100644 index 11e1f1309..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sl.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - -
    - - - - New - Novo - - - Edit - Uredi - - - Delete - Izbriši - - - List - Navedi - - - Save - Shrani - - - Save and add - Shrani in dodaj - - - Cancel - Razveljavi - - - Choose an action - Izberi aktivnost - - - go - Pojdi - - - Back to list - Nazaj na seznam - - - Are you sure? - Ste prepričani? - - - - - Reset - Znova - - - Filter - Filtriraj - - - - - No result - Ni rezultatov - - - Actions - Aktivnosti - - - (page %%page%%/%%nb_pages%%) - (stran %%page%%/%%nb_pages%%) - - - asc - navzgor - - - desc - navzdol - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - - - - Checked - Označeno - - - - - First page - Prva stran - - - Previous page - Prejšnja stran - - - Next page - Naslednja stran - - - Last page - Zadnja stran - - - - - The item was created successfully. - Predmet ste uspešno dodali. - - - The item was updated successfully. - Predmet ste uspešno shranili. - - - The item was created successfully. You can add another one below. - Predmet ste uspešno dodali. Lahko dodate novega. - - - The item was updated successfully. You can add another one below. - Predmet ste uspešno shranili. Lahko dodate novega. - - - The item has not been saved due to some errors. - Predmeta zaradi napake niste uspeli shraniti. - - - The item was deleted successfully. - Predmet ste uspešno izbrisali. - - - You must at least select one item. - Izbrati morate vsaj en predmet. - - - You must select an action to execute on the selected items. - Izbrati morate aktivnost za izbrane predmete. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Pri brisanju izbranih predmetov se je pojavila napaka, ker določeni predmeti ne obstajajo več. - - - The selected items have been deleted successfully. - Izbrane predmete ste uspešno izbrisali. - - - A problem occurs when deleting the selected items. - Pri brisanju izbranih predmetov se je pojavila napaka. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sv.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sv.xml deleted file mode 100644 index 47f24d442..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.sv.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - -
    - - - - New - Ny - - - Edit - Redigera - - - Delete - Radera - - - List - Lista - - - Save - Spara - - - Save and add - Spara och skapa ny - - - Cancel - Avbryt - - - Choose an action - Välj en åtgärd - - - go - ok - - - - - Reset - Nollställ - - - Filter - Filtrera - - - - - No result - Inga resultat - - - Actions - Åtgärder - - - (page %%page%%/%%nb_pages%%) - (sida %%page%%/%%nb_pages%%) - - - asc - stigande - - - desc - fallande - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] inget resultat|[1] 1 resultat|(1,+Inf] %1% resultat - - - - - First page - Första sidan - - - Previous page - Föregående sida - - - Next page - Näste sida - - - Last page - Sista sidan - - - - - The item was created successfully. - Objekt skapades. - - - The item was updated successfully. - Objekt uppdaterat. - - - The item was created successfully. You can add another one below. - Objektet skapades. Du kan skapa ett nytt nedanför. - - - The item was updated successfully. You can add another one below. - Objektet uppdaterades. Du kan skapa ett nytt nedanför. - - - The item has not been saved due to some errors. - Objektet kunde inte sparas på grund av vissa fel. - - - The item was deleted successfully. - Objektet raderades. - - - You must at least select one item. - Du måste välja minst ett objekt - - - You must select an action to execute on the selected items. - Du måste välja en åtgärd att utföra på det valda objektet. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Ett problem uppstod när de valda objekten skulle raderas då vissa objekt inte existerar längre. - - - The selected items have been deleted successfully. - De valda objekten har raderats. - - - A problem occurs when deleting the selected items. - Ett problem uppstod när de valda objekten raderades. - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.tr.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.tr.xml deleted file mode 100644 index 4f8cef90f..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.tr.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - -
    - - - - New - Yeni - - - Edit - Düzenle - - - Delete - Sil - - - List - Liste - - - Save - Kaydet - - - Save and add - Kaydet ve ekle - - - Cancel - Vazgeç - - - Choose an action - Bir Eylem Seç - - - go - devam - - - Back to list - Listeye geri dön - - - - - Reset - Temizle - - - Filter - Filtrele - - - - - No result - Kayıt yok. - - - Actions - Eylemler - - - (page %%page%%/%%nb_pages%%) - (sayfa %%page%%/%%nb_pages%%) - - - asc - artan - - - desc - azalan - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] kayıt yok|[1] 1 sonuç|(1,+Inf] %1% sonuçlar - - - - - First page - İlk sayfa - - - Previous page - Önceki sayfa - - - Next page - Sonraki sayfa - - - Last page - Son sayfa - - - - - The item was created successfully. - Kayıt başarıyla oluşturuldu. - - - The item was updated successfully. - Kayıt başarıyla güncellendi. - - - The item was created successfully. You can add another one below. - Kayıt başarıyla oluşturuldu. Aşağıdan yeni bir tane ekleyebilirsiniz. - - - The item was updated successfully. You can add another one below. - Kayıt başarıyla güncellendi. Aşağıdan yeni bir tane ekleyebilirsiniz. - - - The item has not been saved due to some errors. - Bazı hatalar nedeniyle kayıt oluşturulamadı. - - - The item was deleted successfully. - Kayıt başarıyla silindi. - - - You must at least select one item. - En az bir kayıt seçmelisiniz. - - - You must select an action to execute on the selected items. - Seçilen kayıtlar üzerinde çalıştırılmak üzere bir eylem seçmelisiniz. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Seçilen kayıtlar silinirken bir sorun oluştu, bazı kayıtlar artık bulunmuyor. - - - The selected items have been deleted successfully. - Seçilen kayıtlar başarıyla silindi. - - - A problem occurs when deleting the selected items. - Seçilen kayıtlar silinirken bir sorun oluştu. - - - is empty - boş mu? - - - yes or no - evet ya da hayır - - - yes - evet - - - no - hayır - - - - - - - to %to_date%]]> - %to_date% arası]]> - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.uk.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.uk.xml deleted file mode 100644 index 532bda41b..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.uk.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - -
    - - - - New - Новий запис - - - Edit - Редагувати - - - Delete - Видалити - - - List - Список - - - Save - Зберегти - - - Save and add - Зберегти і додати - - - Cancel - Скасувати - - - Choose an action - Виберіть дію - - - go - Виконати - - - Back to list - Повернутися до списку - - - - - Reset - Скинути - - - Filter - Фільтрувати - - - - - No result - Результат відсутній - - - Actions - Дії - - - (page %%page%%/%%nb_pages%%) - (сторінка %%page%%/%%nb_pages%%) - - - asc - (А-Я) - - - desc - (Я-А) - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] результат відсутній|[1] 1 результат|(1,+Inf] %1% результати(ів) - - - - - First page - Перша сторінка - - - Previous page - Попередня сторінка - - - Next page - Наступна сторінка - - - Last page - Остання сторінка - - - - - The item was created successfully. - Запис успішно створено. - - - The item was updated successfully. - Запис успішно оновлено. - - - The item was created successfully. You can add another one below. - Запис успішно створено. Можете додати ще один. - - - The item was updated successfully. You can add another one below. - Запис успішно змінено. Можете додати ще один. - - - The item has not been saved due to some errors. - Запис не було збережено через помилки. - - - The item was deleted successfully. - Запис успішно знищено. - - - You must at least select one item. - Ви повинні вибрати принаймні один запис. - - - You must select an action to execute on the selected items. - Ви повинні вибрати дію, що буде виконана над позначеними записами. - - - A problem occurs when deleting the selected items as some items do not exist anymore. - Деякі записи серед вибраних для знищення вже відсутні. - - - The selected items have been deleted successfully. - Позначені записи успішно знищено. - - - A problem occurs when deleting the selected items. - При видаленні позначених записів виникла помилка. - - - is empty - пусте значення - - - yes or no - так чи ні - - - yes - так - - - no - ні - - - - - - - to %to_date%]]> - до %to_date%]]> - - - - \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_CN.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_CN.xml deleted file mode 100644 index abcf56193..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_CN.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - -
    - - - - New - 新建 - - - Edit - 编辑 - - - Delete - 删除 - - - List - 列表 - - - Save - 保存 - - - Save and add - 保存并继续添加 - - - Cancel - 返回 - - - - - Reset - 重设 - - - Filter - 过滤器 - - - - - No result - 没有数据 - - - Actions - 操作 - - - (page %%page%%/%%nb_pages%%) - (页码 %%page%%/%%nb_pages%%) - - - asc - 顺序 - - - desc - 逆序 - - - - - First page - 首页 - - - Previous page - 上一页 - - - Next page - 下一页 - - - Last page - 尾页 - - - - - The item was created successfully. - 内容创建成功。 - - - The item was updated successfully. - 内容已更新。 - - - The item was created successfully. You can add another one below. - 内容已创建,将继续创建新内容。 - - - The item was updated successfully. You can add another one below. - 内容已更新,将继续创建新内容。 - - - The item has not been saved due to some errors. - 有错误,内容保存失败。 - - - The item was deleted successfully. - 内容已删除。 - - - You must at least select one item. - 至少要选择一项。 - - - You must select an action to execute on the selected items. - 请选取一个针对该条目的操作。 - - - A problem occurs when deleting the selected items as some items do not exist anymore. - 不能删除不存在的条目。 - - - The selected items have been deleted successfully. - 选定的条目已删除。 - - - A problem occurs when deleting the selected items. - 在删除过程中发生错误。 - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_TW.xml b/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_TW.xml deleted file mode 100644 index a1988eba0..000000000 --- a/lib/plugins/sfDoctrinePlugin/i18n/sf_admin.zh_TW.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - -
    - - - - Choose an action - 選擇一個動作 - - - go - 進行 - - - New - 新建 - - - Edit - 編輯 - - - Delete - 刪除 - - - List - 列表 - - - Save - 保存 - - - Save and add - 保存並繼續添加 - - - Cancel - 返回 - - - - Back to list - 返回列表 - - - - - Reset - 重設 - - - Filter - 篩選 - - - - - [0] no result|[1] 1 result|(1,+Inf] %1% results - [0] 沒有數據|[1] 1 筆數據|(1,+Inf] %1% 筆數據 - - - No result - 沒有數據 - - - Actions - 操作 - - - (page %%page%%/%%nb_pages%%) - (頁碼 %%page%%/%%nb_pages%%) - - - asc - 遞增 - - - desc - 遞減 - - - - - First page - 首頁 - - - Previous page - 上一頁 - - - Next page - 下一頁 - - - Last page - 尾頁 - - - - The item was created successfully. - 內容創建成功。 - - - The item was updated successfully. - 內容已更新。 - - - The item was created successfully. You can add another one below. - 內容已創建,將繼續創建新內容。 - - - The item was updated successfully. You can add another one below. - 內容已更新,將繼續創建新內容。 - - - The item has not been saved due to some errors. - 有錯誤,內容保存失敗。 - - - The item was deleted successfully. - 內容已刪除。 - - - You must at least select one item. - 至少要選擇一項。 - - - You must select an action to execute on the selected items. - 請選取一個針對該條目的操作。 - - - A problem occurs when deleting the selected items as some items do not exist anymore. - 不能刪除不存在的條目。 - - - The selected items have been deleted successfully. - 選定的條目已刪除。 - - - A problem occurs when deleting the selected items. - 在刪除過程中發生錯誤。 - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/lib/cli/sfDoctrineCli.class.php b/lib/plugins/sfDoctrinePlugin/lib/cli/sfDoctrineCli.class.php deleted file mode 100644 index 7930ff9d2..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/cli/sfDoctrineCli.class.php +++ /dev/null @@ -1,67 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrineCli. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineCli extends Doctrine_Cli -{ - protected $symfonyDispatcher; - protected $symfonyFormatter; - - /** - * Set the symfony dispatcher of the cli instance. - * - * @param object $dispatcher - */ - public function setSymfonyDispatcher($dispatcher) - { - $this->symfonyDispatcher = $dispatcher; - } - - /** - * Set the symfony formatter to use for the cli. - * - * @param object $formatter - */ - public function setSymfonyFormatter($formatter) - { - $this->symfonyFormatter = $formatter; - } - - /** - * Notify the dispatcher of a message. We silent the messages from the Doctrine cli. - * - * @param string $notification - * @param string $style - * - * @return false - */ - public function notify($notification = null, $style = 'HEADER') - { - $this->symfonyDispatcher->notify(new sfEvent($this, 'command.log', [$this->symfonyFormatter->formatSection('doctrine', $notification)])); - } - - /** - * Notify symfony of an exception thrown by the Doctrine cli. - * - * @param Doctrine_Exception $exception - * - * @throws sfException - */ - public function notifyException(Exception $exception) - { - throw $exception; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionListener.class.php b/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionListener.class.php deleted file mode 100644 index 6700c7233..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionListener.class.php +++ /dev/null @@ -1,34 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Standard connection listener. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineConnectionListener extends Doctrine_EventListener -{ - protected $connection; - protected $encoding; - - public function __construct($connection, $encoding) - { - $this->connection = $connection; - $this->encoding = $encoding; - } - - public function postConnect(Doctrine_Event $event) - { - $this->connection->setCharset($this->encoding); - $this->connection->setDateFormat(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php b/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php deleted file mode 100644 index 036fa08d8..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php +++ /dev/null @@ -1,180 +0,0 @@ - - */ -class sfDoctrineConnectionProfiler extends Doctrine_Connection_Profiler -{ - protected $dispatcher; - protected $options = []; - - /** - * Constructor. - * - * Available options: - * - * * logging: Whether to notify query logging events (defaults to false) - * * slow_query_threshold: How many seconds a query must take to be considered slow (defaults to 1) - * - * @param array $options - */ - public function __construct(sfEventDispatcher $dispatcher, $options = []) - { - $this->dispatcher = $dispatcher; - $this->options = array_merge([ - 'logging' => false, - 'slow_query_threshold' => 1, - ], $options); - } - - /** - * Returns an option value. - * - * @param string $name - */ - public function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; - } - - /** - * Sets an option value. - * - * @param string $name - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - } - - /** - * Logs time and a connection query on behalf of the connection. - */ - public function preQuery(Doctrine_Event $event) - { - if ($this->options['logging']) { - $this->dispatcher->notify(new sfEvent($event->getInvoker(), 'application.log', [sprintf('query : %s - (%s)', $event->getQuery(), join(', ', self::fixParams($event->getParams())))])); - } - - sfTimerManager::getTimer('Database (Doctrine)'); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - } - - /** - * Logs to the timer. - */ - public function postQuery(Doctrine_Event $event) - { - sfTimerManager::getTimer('Database (Doctrine)', false)->addTime(); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - - if ($event->getElapsedSecs() > $this->options['slow_query_threshold']) { - $event->slowQuery = true; - } - } - - /** - * Logs a connection exec on behalf of the connection. - */ - public function preExec(Doctrine_Event $event) - { - if ($this->options['logging']) { - $this->dispatcher->notify(new sfEvent($event->getInvoker(), 'application.log', [sprintf('exec : %s - (%s)', $event->getQuery(), join(', ', self::fixParams($event->getParams())))])); - } - - sfTimerManager::getTimer('Database (Doctrine)'); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - } - - /** - * Logs to the timer. - */ - public function postExec(Doctrine_Event $event) - { - sfTimerManager::getTimer('Database (Doctrine)', false)->addTime(); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - - if ($event->getElapsedSecs() > $this->options['slow_query_threshold']) { - $event->slowQuery = true; - } - } - - /** - * Logs a statement execute on behalf of the statement. - */ - public function preStmtExecute(Doctrine_Event $event) - { - if ($this->options['logging']) { - $this->dispatcher->notify(new sfEvent($event->getInvoker(), 'application.log', [sprintf('execute : %s - (%s)', $event->getQuery(), join(', ', self::fixParams($event->getParams())))])); - } - - sfTimerManager::getTimer('Database (Doctrine)'); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - } - - /** - * Logs to the timer. - */ - public function postStmtExecute(Doctrine_Event $event) - { - sfTimerManager::getTimer('Database (Doctrine)', false)->addTime(); - - $args = func_get_args(); - $this->__call(__FUNCTION__, $args); - - if ($event->getElapsedSecs() > $this->options['slow_query_threshold']) { - $event->slowQuery = true; - } - } - - /** - * Returns events having to do with query execution. - * - * @return array - */ - public function getQueryExecutionEvents() - { - $events = []; - foreach ($this as $event) { - if (in_array($event->getCode(), [Doctrine_Event::CONN_QUERY, Doctrine_Event::CONN_EXEC, Doctrine_Event::STMT_EXECUTE])) { - $events[] = $event; - } - } - - return $events; - } - - /** - * Fixes query parameters for logging. - * - * @param array $params - * - * @return array - */ - public static function fixParams($params) - { - if (!is_array($params)) { - return []; - } - - foreach ($params as $key => $param) { - if ($param && strlen($param) >= 255) { - $params[$key] = '['.number_format(strlen($param) / 1024, 2).'Kb]'; - } - } - - return $params; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineDatabase.class.php b/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineDatabase.class.php deleted file mode 100644 index 98d4b22f0..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineDatabase.class.php +++ /dev/null @@ -1,139 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * A symfony database driver for Doctrine. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineDatabase extends sfDatabase -{ - /** - * Instance of the Doctrine_Connection for this instance of sfDoctrineDatabase. - * Connection can be accessed by the getDoctrineConnection() accessor method. - * - * @var Doctrine_Connection - */ - protected $_doctrineConnection; - - /** - * @var sfDoctrineConnectionProfiler - */ - protected $profiler; - - /** - * Initialize a sfDoctrineDatabase connection with the given parameters. - * - * - * $parameters = array( - * 'name' => 'doctrine', - * 'dsn' => 'sqlite:////path/to/sqlite/db'); - * - * $p = new sfDoctrineDatabase($parameters); - * - * - * @param array $parameters Array of parameters used to initialize the database connection - */ - public function initialize($parameters = []) - { - parent::initialize($parameters); - - if (null !== $this->_doctrineConnection) { - return; - } - - $dsn = $this->getParameter('dsn'); - $name = $this->getParameter('name'); - - // Make sure we pass non-PEAR style DSNs as an array - if (!strpos($dsn, '://')) { - $dsn = [$dsn, $this->getParameter('username'), $this->getParameter('password')]; - } - - // Make the Doctrine connection for $dsn and $name - $configuration = sfProjectConfiguration::getActive(); - $dispatcher = $configuration->getEventDispatcher(); - $manager = Doctrine_Manager::getInstance(); - - $this->_doctrineConnection = $manager->openConnection($dsn, $name); - - $attributes = $this->getParameter('attributes', []); - foreach ($attributes as $name => $value) { - if (is_string($name)) { - $stringName = $name; - $name = constant('Doctrine_Core::ATTR_'.strtoupper($name)); - } - - if (is_string($value)) { - $valueConstantName = 'Doctrine_Core::'.strtoupper($stringName).'_'.strtoupper($value); - $value = defined($valueConstantName) ? constant($valueConstantName) : $value; - } - - $this->_doctrineConnection->setAttribute($name, $value); - } - - $encoding = $this->getParameter('encoding', 'UTF8'); - $eventListener = new sfDoctrineConnectionListener($this->_doctrineConnection, $encoding); - $this->_doctrineConnection->addListener($eventListener); - - // Load Query Profiler - if ($this->getParameter('profiler', sfConfig::get('sf_debug'))) { - $this->profiler = new sfDoctrineConnectionProfiler($dispatcher, [ - 'logging' => $this->getParameter('logging', sfConfig::get('sf_logging_enabled')), - ]); - $this->_doctrineConnection->addListener($this->profiler, 'symfony_profiler'); - } - - $dispatcher->notify(new sfEvent($manager, 'doctrine.configure_connection', ['connection' => $this->_doctrineConnection, 'database' => $this])); - } - - /** - * Get the Doctrine_Connection instance. - * - * @return Doctrine_Connection $conn - */ - public function getDoctrineConnection() - { - return $this->_doctrineConnection; - } - - /** - * Returns the connection profiler. - * - * @return sfDoctrineConnectionProfiler|null - */ - public function getProfiler() - { - return $this->profiler; - } - - /** - * Initializes the connection and sets it to object. - */ - public function connect() - { - $this->connection = $this->_doctrineConnection->getDbh(); - } - - /** - * Execute the shutdown procedure. - */ - public function shutdown() - { - if (null !== $this->connection) { - $this->connection = null; - } - if (null !== $this->_doctrineConnection) { - $this->_doctrineConnection->getManager()->closeConnection($this->_doctrineConnection); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/debug/sfWebDebugPanelDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/debug/sfWebDebugPanelDoctrine.class.php deleted file mode 100644 index 8cd0228ba..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/debug/sfWebDebugPanelDoctrine.class.php +++ /dev/null @@ -1,151 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfWebDebugPanelDoctrine adds a panel to the web debug toolbar with Doctrine information. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfWebDebugPanelDoctrine extends sfWebDebugPanel -{ - /** - * Get the title/icon for the panel. - * - * @return string $html - */ - public function getTitle() - { - if ($events = $this->getDoctrineEvents()) { - return 'SQL queries '.count($events); - } - } - - /** - * Get the verbal title of the panel. - * - * @return string $title - */ - public function getPanelTitle() - { - return 'SQL queries'; - } - - /** - * Get the html content of the panel. - * - * @return string $html - */ - public function getPanelContent() - { - return ' -
    -

    Doctrine Version: '.Doctrine_Core::VERSION.'

    -
      '.implode("\n", $this->getSqlLogs()).'
    -
    - '; - } - - /** - * Listens to debug.web.load_panels and adds this panel. - */ - public static function listenToAddPanelEvent(sfEvent $event) - { - $event->getSubject()->setPanel('db', new self($event->getSubject())); - } - - /** - * Returns an array of Doctrine query events. - * - * @return array - */ - protected function getDoctrineEvents() - { - $databaseManager = sfContext::getInstance()->getDatabaseManager(); - - $events = []; - if ($databaseManager) { - foreach ($databaseManager->getNames() as $name) { - $database = $databaseManager->getDatabase($name); - if ($database instanceof sfDoctrineDatabase && $profiler = $database->getProfiler()) { - foreach ($profiler->getQueryExecutionEvents() as $event) { - $events[$event->getSequence()] = $event; - } - } - } - } - - // sequence events - ksort($events); - - return $events; - } - - /** - * Builds the sql logs and returns them as an array. - * - * @return array - */ - protected function getSqlLogs() - { - $logs = $this->webDebug->getLogger()->getLogs(); - - $html = []; - foreach ($this->getDoctrineEvents() as $i => $event) { - $conn = $event->getInvoker() instanceof Doctrine_Connection ? $event->getInvoker() : $event->getInvoker()->getConnection(); - $params = sfDoctrineConnectionProfiler::fixParams($event->getParams()); - $query = $this->formatSql(htmlspecialchars($event->getQuery(), ENT_QUOTES, sfConfig::get('sf_charset'))); - - // interpolate parameters - foreach ($params as $param) { - $param = htmlspecialchars((string) $param, ENT_QUOTES, sfConfig::get('sf_charset')); - $query = join(var_export(is_scalar($param) ? $param : (string) $param, true), explode('?', $query, 2)); - } - - // slow query - if ($event->slowQuery && $this->getStatus() > sfLogger::NOTICE) { - $this->setStatus(sfLogger::NOTICE); - } - - // backtrace - $backtrace = null; - foreach ($logs as $i => $log) { - if (!isset($log['debug_backtrace']) || !count($log['debug_backtrace'])) { - // backtrace disabled - break; - } - - if (false !== strpos($log['message'], $event->getQuery())) { - // assume queries are being requested in order - unset($logs[$i]); - $backtrace = ' '.$this->getToggleableDebugStack($log['debug_backtrace']); - - break; - } - } - - $html[] = sprintf( - ' - -

    %s

    -
    %ss, "%s" connection%s
    - ', - $event->slowQuery ? ' class="sfWebDebugWarning"' : '', - $query, - number_format($event->getElapsedSecs(), 2), - $conn->getName(), - $backtrace - ); - } - - return $html; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php deleted file mode 100644 index aa0080f38..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php +++ /dev/null @@ -1,396 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfFormDoctrine is the base class for forms based on Doctrine objects. - * - * This class extends BaseForm, a class generated automatically with each new project. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -abstract class sfFormDoctrine extends sfFormObject -{ - /** - * Constructor. - * - * @param mixed $object A object used to initialize default values - * @param array $options An array of options - * @param string $CSRFSecret A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret) - * - * @throws sfException - * - * @see sfForm - */ - public function __construct($object = null, $options = [], $CSRFSecret = null) - { - $class = $this->getModelName(); - if (!$object) { - $this->object = new $class(); - } else { - if (!$object instanceof $class) { - throw new sfException(sprintf('The "%s" form only accepts a "%s" object.', get_class($this), $class)); - } - - $this->object = $object; - $this->isNew = !$this->getObject()->exists(); - } - - parent::__construct([], $options, $CSRFSecret); - - $this->updateDefaultsFromObject(); - } - - /** - * @return Doctrine_Connection - * - * @see sfFormObject - */ - public function getConnection() - { - return Doctrine_Manager::getInstance()->getConnectionForComponent($this->getModelName()); - } - - /** - * Embeds i18n objects into the current form. - * - * @param array $cultures An array of cultures - * @param string $decorator A HTML decorator for the embedded form - * - * @throws sfException - */ - public function embedI18n($cultures, $decorator = null) - { - if (!$this->isI18n()) { - throw new sfException(sprintf('The model "%s" is not internationalized.', $this->getModelName())); - } - - $class = $this->getI18nFormClass(); - foreach ($cultures as $culture) { - $i18nObject = $this->getObject()->Translation[$culture]; - $i18n = new $class($i18nObject); - - if (false === $i18nObject->exists()) { - unset($i18n[$this->getI18nModelPrimaryKeyName()], $i18n[$this->getI18nModelI18nField()]); - } - - $this->embedForm($culture, $i18n, $decorator); - } - } - - /** - * Embed a Doctrine_Collection relationship in to a form. - * - * [php] - * $userForm = new UserForm($user); - * $userForm->embedRelation('Groups AS groups'); - * - * @param string $relationName The name of the relation and an optional alias - * @param string $formClass The name of the form class to use - * @param array $formArgs Arguments to pass to the constructor (related object will be shifted onto the front) - * @param string $innerDecorator A HTML decorator for each embedded form - * @param string $decorator A HTML decorator for the main embedded form - * - * @throws InvalidArgumentException If the relationship is not a collection - */ - public function embedRelation($relationName, $formClass = null, $formArgs = [], $innerDecorator = null, $decorator = null) - { - if (false !== $pos = stripos($relationName, ' as ')) { - $fieldName = substr($relationName, $pos + 4); - $relationName = substr($relationName, 0, $pos); - } else { - $fieldName = $relationName; - } - - $relation = $this->getObject()->getTable()->getRelation($relationName); - - $r = new ReflectionClass(null === $formClass ? $relation->getClass().'Form' : $formClass); - - if (Doctrine_Relation::ONE == $relation->getType()) { - $this->embedForm($fieldName, $r->newInstanceArgs(array_merge([$this->getObject()->{$relationName}], $formArgs)), $decorator); - } else { - $subForm = new sfForm(); - - foreach ($this->getObject()->{$relationName} as $index => $childObject) { - $form = $r->newInstanceArgs(array_merge([$childObject], $formArgs)); - - $subForm->embedForm($index, $form, $innerDecorator); - $subForm->getWidgetSchema()->setLabel($index, (string) $childObject); - } - - $this->embedForm($fieldName, $subForm, $decorator); - } - } - - /** - * Processes cleaned up values with user defined methods. - * - * To process a value before it is used by the updateObject() method, - * you need to define an updateXXXColumn() method where XXX is the PHP name - * of the column. - * - * The method must return the processed value or false to remove the value - * from the array of cleaned up values. - * - * @see sfFormObject - * - * @param array $values - * - * @return array - */ - public function processValues($values) - { - // see if the user has overridden some column setter - $valuesToProcess = $values; - foreach ($valuesToProcess as $field => $value) { - $method = sprintf('update%sColumn', $this->camelize($field)); - - if (method_exists($this, $method)) { - if (false === $ret = $this->{$method}($value)) { - unset($values[$field]); - } else { - $values[$field] = $ret; - } - } else { - // save files - if ($this->validatorSchema[$field] instanceof sfValidatorFile) { - $values[$field] = $this->processUploadedFile($field, null, $valuesToProcess); - } - } - } - - return $values; - } - - /** - * Returns true if the current form has some associated i18n objects. - * - * @return bool true if the current form has some associated i18n objects, false otherwise - */ - public function isI18n() - { - return $this->getObject()->getTable()->hasTemplate('Doctrine_Template_I18n'); - } - - /** - * Returns the name of the i18n model. - * - * @return string The name of the i18n model - */ - public function getI18nModelName() - { - return $this->getObject()->getTable()->getTemplate('Doctrine_Template_I18n')->getI18n()->getOption('className'); - } - - /** - * Returns the name of the i18n form class. - * - * @return string The name of the i18n form class - */ - public function getI18nFormClass() - { - return $this->getI18nModelName().'Form'; - } - - /** - * Returns the primary key name of the i18n model. - * - * @return string The primary key name of the i18n model - * - * @throws sfException - */ - public function getI18nModelPrimaryKeyName() - { - $primaryKey = $this->getObject()->getTable()->getIdentifier(); - - if (is_array($primaryKey)) { - throw new sfException(sprintf('The model "%s" has composite primary keys and cannot be used with i18n..', $this->getModelName())); - } - - return $primaryKey; - } - - /** - * Returns the i18nField name of the i18n model. - * - * @return string The i18nField name of the i18n model - */ - public function getI18nModelI18nField() - { - return $this->getObject()->getTable()->getTemplate('Doctrine_Template_I18n')->getI18n()->getOption('i18nField'); - } - - /** - * @see sfFormObject - */ - protected function doUpdateObject($values) - { - $this->getObject()->fromArray($values); - } - - /** - * Updates the default values of the form with the current values of the current object. - */ - protected function updateDefaultsFromObject() - { - $defaults = $this->getDefaults(); - - // update defaults for the main object - if ($this->isNew()) { - $defaults = $defaults + $this->getObject()->toArray(false); - } else { - $defaults = $this->getObject()->toArray(false) + $defaults; - } - - foreach ($this->embeddedForms as $name => $form) { - if ($form instanceof sfFormDoctrine) { - $form->updateDefaultsFromObject(); - $defaults[$name] = $form->getDefaults(); - } - } - - $this->setDefaults($defaults); - } - - /** - * Saves the uploaded file for the given field. - * - * @param string $field The field name - * @param string $filename The file name of the file to save - * @param array $values An array of values - * - * @return string The filename used to save the file - */ - protected function processUploadedFile($field, $filename = null, $values = null) - { - if (!$this->validatorSchema[$field] instanceof sfValidatorFile) { - throw new LogicException(sprintf('You cannot save the current file for field "%s" as the field is not a file.', $field)); - } - - if (null === $values) { - $values = $this->values; - } - - if (isset($values[$field.'_delete']) && $values[$field.'_delete']) { - $this->removeFile($field); - - return ''; - } - - if (!$values[$field]) { - // this is needed if the form is embedded, in which case - // the parent form has already changed the value of the field - $oldValues = $this->getObject()->getModified(true, false); - - return isset($oldValues[$field]) ? $oldValues[$field] : $this->object->{$field}; - } - - // we need the base directory - if (!$this->validatorSchema[$field]->getOption('path')) { - return $values[$field]; - } - - $this->removeFile($field); - - return $this->saveFile($field, $filename, $values[$field]); - } - - /** - * Removes the current file for the field. - * - * @param string $field The field name - */ - protected function removeFile($field) - { - if (!$this->validatorSchema[$field] instanceof sfValidatorFile) { - throw new LogicException(sprintf('You cannot remove the current file for field "%s" as the field is not a file.', $field)); - } - - $directory = $this->validatorSchema[$field]->getOption('path'); - $filename = $this->getObject()->{$field}; - - // this is needed if the form is embedded, in which case - // the parent form has already changed the value of the field - if (!is_string($filename)) { - $oldValues = $this->getObject()->getModified(true, false); - if (isset($oldValues[$field])) { - $filename = $oldValues[$field]; - } - } - - if ($directory && $filename && is_file($file = $directory.'/'.$filename)) { - unlink($file); - } - } - - /** - * Saves the current file for the field. - * - * @param string $field The field name - * @param string $filename The file name of the file to save - * @param sfValidatedFile $file The validated file to save - * - * @return string The filename used to save the file - */ - protected function saveFile($field, $filename = null, ?sfValidatedFile $file = null) - { - if (!$this->validatorSchema[$field] instanceof sfValidatorFile) { - throw new LogicException(sprintf('You cannot save the current file for field "%s" as the field is not a file.', $field)); - } - - if (null === $file) { - $file = $this->getValue($field); - } - - $method = sprintf('generate%sFilename', $this->camelize($field)); - - if (null !== $filename) { - return $file->save($filename); - } - if (method_exists($this, $method)) { - return $file->save($this->{$method}($file)); - } - if (method_exists($this->getObject(), $method)) { - return $file->save($this->getObject()->{$method}($file)); - } - - return $file->save(); - } - - /** - * Used in generated forms when models use inheritance. - */ - protected function setupInheritance() - { - } - - /** - * Returns the name of the related model. - * - * @param string $alias A relation alias - * - * @return string - * - * @throws InvalidArgumentException If no relation with the supplied alias exists on the current model - */ - protected function getRelatedModelName($alias) - { - $table = Doctrine_Core::getTable($this->getModelName()); - - if (!$table->hasRelation($alias)) { - throw new InvalidArgumentException(sprintf('The "%s" model has no "%s" relation.', $this->getModelName(), $alias)); - } - - $relation = $table->getRelation($alias); - - return $relation['class']; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php deleted file mode 100644 index 7d946b4fe..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php +++ /dev/null @@ -1,297 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfFormFilterDoctrine is the base class for filter forms based on Doctrine objects. - * - * Available options: - * - * * query: The query object to use - * * table_method: A method on the table class that will either filter the passed query object or create a new one - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -abstract class sfFormFilterDoctrine extends sfFormFilter -{ - /** - * Returns the current model name. - * - * @return string The model class name - */ - abstract public function getModelName(); - - /** - * Returns the fields and their filter type. - * - * @return array An array of fields with their filter type - */ - abstract public function getFields(); - - /** - * Get the name of the table method used to retrieve the query object for the filter. - * - * @return string - */ - public function getTableMethod() - { - return $this->getOption('table_method'); - } - - /** - * Set the name of the table method used to retrieve the query object for the filter. - * - * The specified method will be passed the query object before any changes - * are made based on incoming parameters. - * - * @param string $tableMethod - */ - public function setTableMethod($tableMethod) - { - $this->setOption('table_method', $tableMethod); - } - - /** - * Sets the query object to use. - * - * @param Doctrine_Query $query - */ - public function setQuery($query) - { - $this->setOption('query', $query); - } - - /** - * Returns a Doctrine Query based on the current values form the form. - * - * @return Doctrine_Query A Doctrine Query object - * - * @throws sfValidatorErrorSchema - */ - public function getQuery() - { - if (!$this->isValid()) { - throw $this->getErrorSchema(); - } - - return $this->buildQuery($this->getValues()); - } - - /** - * Processes cleaned up values with user defined methods. - * - * To process a value before it is used by the buildQuery() method, - * you need to define an convertXXXValue() method where XXX is the PHP name - * of the column. - * - * The method must return the processed value or false to remove the value - * from the array of cleaned up values. - * - * @param array $values An array of cleaned up values to process - * - * @return array An array of cleaned up values processed by the user defined methods - */ - public function processValues($values) - { - // see if the user has overridden some column setter - $originalValues = $values; - foreach ($originalValues as $field => $value) { - if (method_exists($this, $method = sprintf('convert%sValue', self::camelize($field)))) { - if (false === $ret = $this->{$method}($value)) { - unset($values[$field]); - } else { - $values[$field] = $ret; - } - } - } - - return $values; - } - - /** - * Builds a Doctrine Query based on the passed values. - * - * @param array $values An array of parameters to build the Query object - * - * @return Doctrine_Query A Doctrine Query object - */ - public function buildQuery(array $values) - { - return $this->doBuildQuery($this->processValues($values)); - } - - /** - * Builds a Doctrine query with processed values. - * - * Overload this method instead of {@link buildQuery()} to avoid running - * {@link processValues()} multiple times. - * - * @return Doctrine_Query - * - * @throws LogicException - */ - protected function doBuildQuery(array $values) - { - $query = isset($this->options['query']) ? clone $this->options['query'] : $this->getTable()->createQuery('r'); - - if ($method = $this->getTableMethod()) { - $tmp = $this->getTable()->{$method}($query); - - // for backward compatibility - if ($tmp instanceof Doctrine_Query) { - $query = $tmp; - } - } - - $fields = $this->getFields(); - - // add those fields that are not represented in getFields() with a null type - $names = array_merge($fields, array_diff(array_keys($this->validatorSchema->getFields()), array_keys($fields))); - $fields = array_merge($fields, array_combine($names, array_fill(0, count($names), null))); - - foreach ($fields as $field => $type) { - if (!isset($values[$field]) || null === $values[$field] || '' === $values[$field]) { - continue; - } - - if ($this->getTable()->hasField($field)) { - $method = sprintf('add%sColumnQuery', self::camelize($this->getFieldName($field))); - } elseif (!method_exists($this, $method = sprintf('add%sColumnQuery', self::camelize($field))) && null !== $type) { - throw new LogicException(sprintf('You must define a "%s" method to be able to filter with the "%s" field.', $method, $field)); - } - - if (method_exists($this, $method)) { - $this->{$method}($query, $field, $values[$field]); - } elseif (null !== $type) { - if (!method_exists($this, $method = sprintf('add%sQuery', $type))) { - throw new LogicException(sprintf('Unable to filter for the "%s" type.', $type)); - } - - $this->{$method}($query, $field, $values[$field]); - } - } - - return $query; - } - - protected function addForeignKeyQuery(Doctrine_Query $query, $field, $value) - { - $fieldName = $this->getFieldName($field); - - if (is_array($value)) { - $query->andWhereIn(sprintf('%s.%s', $query->getRootAlias(), $fieldName), $value); - } else { - $query->addWhere(sprintf('%s.%s = ?', $query->getRootAlias(), $fieldName), $value); - } - } - - protected function addEnumQuery(Doctrine_Query $query, $field, $value) - { - $fieldName = $this->getFieldName($field); - - $query->addWhere(sprintf('%s.%s = ?', $query->getRootAlias(), $fieldName), $value); - } - - protected function addTextQuery(Doctrine_Query $query, $field, $values) - { - $fieldName = $this->getFieldName($field); - - if (is_array($values) && isset($values['is_empty']) && $values['is_empty']) { - $query->addWhere(sprintf('(%s.%s IS NULL OR %1$s.%2$s = ?)', $query->getRootAlias(), $fieldName), ['']); - } elseif (is_array($values) && isset($values['text']) && '' != $values['text']) { - $query->addWhere(sprintf('%s.%s LIKE ?', $query->getRootAlias(), $fieldName), '%'.$values['text'].'%'); - } - } - - protected function addNumberQuery(Doctrine_Query $query, $field, $values) - { - $fieldName = $this->getFieldName($field); - - if (is_array($values) && isset($values['is_empty']) && $values['is_empty']) { - $query->addWhere(sprintf('(%s.%s IS NULL OR %1$s.%2$s = ?)', $query->getRootAlias(), $fieldName), ['']); - } elseif (is_array($values) && isset($values['text']) && '' !== $values['text']) { - $query->addWhere(sprintf('%s.%s = ?', $query->getRootAlias(), $fieldName), $values['text']); - } - } - - protected function addBooleanQuery(Doctrine_Query $query, $field, $value) - { - $fieldName = $this->getFieldName($field); - $query->addWhere(sprintf('%s.%s = ?', $query->getRootAlias(), $fieldName), $value); - } - - protected function addDateQuery(Doctrine_Query $query, $field, $values) - { - $fieldName = $this->getFieldName($field); - - if (isset($values['is_empty']) && $values['is_empty']) { - $query->addWhere(sprintf('%s.%s IS NULL', $query->getRootAlias(), $fieldName)); - } else { - if (null !== $values['from'] && null !== $values['to']) { - $query->andWhere(sprintf('%s.%s >= ?', $query->getRootAlias(), $fieldName), $values['from']); - $query->andWhere(sprintf('%s.%s <= ?', $query->getRootAlias(), $fieldName), $values['to']); - } elseif (null !== $values['from']) { - $query->andWhere(sprintf('%s.%s >= ?', $query->getRootAlias(), $fieldName), $values['from']); - } elseif (null !== $values['to']) { - $query->andWhere(sprintf('%s.%s <= ?', $query->getRootAlias(), $fieldName), $values['to']); - } - } - } - - /** - * Used in generated forms when models use inheritance. - */ - protected function setupInheritance() - { - } - - /** - * Returns the name of the related model. - * - * @param string $alias A relation alias - * - * @return string - * - * @throws InvalidArgumentException If no relation with the supplied alias exists on the current model - */ - protected function getRelatedModelName($alias) - { - $table = Doctrine_Core::getTable($this->getModelName()); - - if (!$table->hasRelation($alias)) { - throw new InvalidArgumentException(sprintf('The "%s" model has no "%s" relation.', $this->getModelName(), $alias)); - } - - $relation = $table->getRelation($alias); - - return $relation['class']; - } - - protected function getColName($field) - { - return $this->getTable()->getColumnName($field); - } - - protected function getFieldName($colName) - { - return $this->getTable()->getFieldName($colName); - } - - protected function camelize($text) - { - return strtr(ucwords(strtr($text, ['/' => ':: ', '_' => ' ', '-' => ' '])), [' ' => '']); - } - - protected function getTable() - { - return Doctrine_Core::getTable($this->getModelName()); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php deleted file mode 100644 index 809e16d10..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php +++ /dev/null @@ -1,347 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Represents a Doctrine column. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineColumn implements ArrayAccess -{ - /** - * Array mapping Doctrine column types to the native symfony type. - */ - public static $doctrineToSymfony = [ - 'boolean' => 'BOOLEAN', - 'string' => 'LONGVARCHAR', - 'integer' => 'INTEGER', - 'date' => 'DATE', - 'timestamp' => 'TIMESTAMP', - 'time' => 'TIME', - 'enum' => 'LONGVARCHAR', - 'float' => 'FLOAT', - 'double' => 'DOUBLE', - 'clob' => 'CLOB', - 'blob' => 'BLOB', - 'object' => 'LONGVARCHAR', - 'array' => 'LONGVARCHAR', - 'decimal' => 'DECIMAL', - ]; - - /** - * Store the name of the related class for this column if it is - * a foreign key. - * - * @var string - */ - protected $foreignClassName; - - /** - * Store the name of the related column for this column if it is - * a foreign key. - * - * @var string - */ - protected $foreignFieldName; - - /** - * Doctrine_Table instance this column belongs to. - * - * @var Doctrine_Table - */ - protected $table; - - /** - * Field name of the column. - * - * @var string - */ - protected $name; - - /** - * Definition of the column. - * - * @var array - */ - protected $definition = []; - - /** - * Constructor. - * - * @param string $name - */ - public function __construct($name, Doctrine_Table $table) - { - $this->name = $name; - $this->table = $table; - $this->definition = $table->getDefinitionOf($name); - } - - /** - * Get the name of the column. - * - * @return string $name - */ - public function getName() - { - return $this->table->getColumnName($this->name); - } - - /** - * Get the alias/field name. - * - * @return string $fieldName - */ - public function getFieldName() - { - return $this->table->getFieldName($this->getName()); - } - - /** - * Get php name. Exists for backwards compatibility with propel orm. - * - * @return string $fieldName - */ - public function getPhpName() - { - return $this->getFieldName(); - } - - /** - * Get the Doctrine type of the column. - */ - public function getDoctrineType() - { - return isset($this->definition['type']) ? $this->definition['type'] : null; - } - - /** - * Get symfony type of the column. - */ - public function getType() - { - $doctrineType = $this->getDoctrineType(); - - // we simulate the CHAR/VARCHAR types to generate input_tags - if ('string' == $doctrineType && null !== $this->getSize() && $this->getSize() <= 255) { - return 'VARCHAR'; - } - - return $doctrineType ? self::$doctrineToSymfony[$doctrineType] : 'VARCHAR'; - } - - /** - * Get size/length of the column. - */ - public function getSize() - { - return $this->definition['length']; - } - - public function getLength() - { - return $this->getSize(); - } - - /** - * Check if the column definition has a certain key. - * - * @param string $key - * - * @return bool - */ - public function hasDefinitionKey($key) - { - return isset($this->definition[$key]) ? true : false; - } - - /** - * Get the value of a column definition key. - * - * @param string $key - * - * @return array $definition - */ - public function getDefinitionKey($key) - { - if ($this->hasDefinitionKey($key)) { - return $this->definition[$key]; - } - - return false; - } - - /** - * Returns a value from the current column's relation. - * - * @param string $key - * - * @return mixed|null - */ - public function getRelationKey($key) - { - foreach ($this->table->getRelations() as $relation) { - $local = (array) $relation['local']; - $local = array_map('strtolower', $local); - if (in_array(strtolower($this->name), $local)) { - return $relation[$key]; - } - } - - return null; - } - - /** - * Returns true of the column is not null and false if it is null. - * - * @return bool - */ - public function isNotNull() - { - if (isset($this->definition['notnull'])) { - return $this->definition['notnull']; - } - - if (isset($this->definition['notblank'])) { - return $this->definition['notblank']; - } - - return false; - } - - /** - * Returns true if the column is a primary key and false if it is not. - */ - public function isPrimaryKey() - { - if (isset($this->definition['primary'])) { - return $this->definition['primary']; - } - - return false; - } - - /** - * Returns true if this column is a foreign key and false if it is not. - * - * @return bool $isForeignKey - */ - public function isForeignKey() - { - if (isset($this->foreignClassName)) { - return true; - } - - if ($this->isPrimaryKey()) { - return false; - } - - foreach ($this->table->getRelations() as $relation) { - $local = (array) $relation['local']; - $local = array_map('strtolower', $local); - if (in_array(strtolower($this->name), $local)) { - $this->foreignClassName = $relation['class']; - if (Doctrine_Relation::ONE === $relation->getType()) { - $this->foreignFieldName = $relation['foreign']; - } - - return true; - } - } - - return false; - } - - /** - * Get the name of the related class for this column foreign key. - * - * @return string $foreignClassName - */ - public function getForeignClassName() - { - if ($this->isForeignKey()) { - return $this->foreignClassName; - } - - return false; - } - - /** - * Get the name of the related field for this column foreign key. - * - * @return string - */ - public function getForeignFieldName() - { - if ($this->isForeignKey()) { - return $this->foreignFieldName; - } - - return false; - } - - /** - * If foreign key get the related Doctrine_Table object. - * - * @return Doctrine_Table $table - */ - public function getForeignTable() - { - if ($this->isForeignKey()) { - return Doctrine_Core::getTable($this->foreignClassName); - } - - return false; - } - - /** - * Set the Doctrine_Table object this column belongs to. - */ - public function setTable(Doctrine_Table $table) - { - $this->table = $table; - } - - /** - * Get the Doctrine_Table object this column belongs to. - * - * @return Doctrine_Table $table - */ - public function getTable() - { - return $this->table; - } - - #[\ReturnTypeWillChange] - public function offsetExists($offset) - { - return isset($this->definition[$offset]); - } - - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) - { - $this->definition[$offset] = $value; - } - - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->definition[$offset]; - } - - #[\ReturnTypeWillChange] - public function offsetUnset($offset) - { - unset($this->definition[$offset]); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormFilterGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormFilterGenerator.class.php deleted file mode 100644 index 53755b630..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormFilterGenerator.class.php +++ /dev/null @@ -1,375 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Doctrine filter form generator. - * - * This class generates a Doctrine filter forms. - * - * @author Fabien Potencier - */ -class sfDoctrineFormFilterGenerator extends sfDoctrineFormGenerator -{ - /** - * Initializes the current sfGenerator instance. - * - * @param sfGeneratorManager $generatorManager A sfGeneratorManager instance - */ - public function initialize(sfGeneratorManager $generatorManager) - { - parent::initialize($generatorManager); - - $this->setGeneratorClass('sfDoctrineFormFilter'); - } - - /** - * Generates classes and templates in cache. - * - * @param array $params The parameters - * - * @return string The data to put in configuration cache - */ - public function generate($params = []) - { - $this->params = $params; - - if (!isset($this->params['model_dir_name'])) { - $this->params['model_dir_name'] = 'model'; - } - - if (!isset($this->params['filter_dir_name'])) { - $this->params['filter_dir_name'] = 'filter'; - } - - $models = $this->loadModels(); - - // create the project base class for all forms - $file = sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php'; - if (!file_exists($file)) { - if (!is_dir($directory = dirname($file))) { - mkdir($directory, 0777, true); - } - - file_put_contents($file, $this->evalTemplate('sfDoctrineFormFilterBaseTemplate.php')); - } - - $pluginPaths = $this->generatorManager->getConfiguration()->getAllPluginPaths(); - - // create a form class for every Doctrine class - foreach ($models as $model) { - $this->table = Doctrine_Core::getTable($model); - $this->modelName = $model; - - $baseDir = sfConfig::get('sf_lib_dir').'/filter/doctrine'; - - $isPluginModel = $this->isPluginModel($model); - if ($isPluginModel) { - $pluginName = $this->getPluginNameForModel($model); - $baseDir .= '/'.$pluginName; - } - - if (!is_dir($baseDir.'/base')) { - mkdir($baseDir.'/base', 0777, true); - } - - file_put_contents($baseDir.'/base/Base'.$model.'FormFilter.class.php', $this->evalTemplate(null === $this->getParentModel() ? 'sfDoctrineFormFilterGeneratedTemplate.php' : 'sfDoctrineFormFilterGeneratedInheritanceTemplate.php')); - - if ($isPluginModel) { - $pluginBaseDir = $pluginPaths[$pluginName].'/lib/filter/doctrine'; - if (!file_exists($classFile = $pluginBaseDir.'/Plugin'.$model.'FormFilter.class.php')) { - if (!is_dir($pluginBaseDir)) { - mkdir($pluginBaseDir, 0777, true); - } - file_put_contents($classFile, $this->evalTemplate('sfDoctrineFormFilterPluginTemplate.php')); - } - } - if (!file_exists($classFile = $baseDir.'/'.$model.'FormFilter.class.php')) { - if ($isPluginModel) { - file_put_contents($classFile, $this->evalTemplate('sfDoctrinePluginFormFilterTemplate.php')); - } else { - file_put_contents($classFile, $this->evalTemplate('sfDoctrineFormFilterTemplate.php')); - } - } - } - } - - /** - * Returns a sfWidgetForm class name for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The name of a subclass of sfWidgetForm - */ - public function getWidgetClassForColumn($column) - { - switch ($column->getDoctrineType()) { - case 'boolean': - $name = 'Choice'; - - break; - - case 'date': - case 'datetime': - case 'timestamp': - $name = 'FilterDate'; - - break; - - case 'enum': - $name = 'Choice'; - - break; - - default: - $name = 'FilterInput'; - } - - if ($column->isForeignKey()) { - $name = 'DoctrineChoice'; - } - - return sprintf('sfWidgetForm%s', $name); - } - - /** - * Returns a PHP string representing options to pass to a widget for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The options to pass to the widget as a PHP string - */ - public function getWidgetOptionsForColumn($column) - { - $options = []; - - $withEmpty = $column->isNotNull() && !$column->isForeignKey() ? ["'with_empty' => false"] : []; - - switch ($column->getDoctrineType()) { - case 'boolean': - $options[] = "'choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no')"; - - break; - - case 'date': - case 'datetime': - case 'timestamp': - $options[] = "'from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate()"; - $options = array_merge($options, $withEmpty); - - break; - - case 'enum': - $values = ['' => '']; - $values = array_merge($values, $column['values']); - $values = array_combine($values, $values); - $options[] = "'choices' => ".$this->arrayExport($values); - - break; - - default: - $options = array_merge($options, $withEmpty); - } - - if ($column->isForeignKey()) { - $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\'), \'add_empty\' => true', $column->getRelationKey('alias')); - } - - return count($options) ? sprintf('array(%s)', implode(', ', $options)) : ''; - } - - /** - * Returns a sfValidator class name for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The name of a subclass of sfValidator - */ - public function getValidatorClassForColumn($column) - { - switch ($column->getDoctrineType()) { - case 'boolean': - $name = 'Choice'; - - break; - - case 'float': - case 'decimal': - $name = 'Number'; - - break; - - case 'integer': - $name = 'Integer'; - - break; - - case 'date': - case 'datetime': - case 'timestamp': - $name = 'DateRange'; - - break; - - case 'enum': - $name = 'Choice'; - - break; - - default: - $name = 'Pass'; - } - - if ($column->isPrimarykey() || $column->isForeignKey()) { - $name = 'DoctrineChoice'; - } - - return sprintf('sfValidator%s', $name); - } - - /** - * Returns a PHP string representing options to pass to a validator for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The options to pass to the validator as a PHP string - */ - public function getValidatorOptionsForColumn($column) - { - $options = ['\'required\' => false']; - - if ($column->isForeignKey()) { - $columns = $column->getForeignTable()->getColumns(); - foreach ($columns as $name => $col) { - if (isset($col['primary']) && $col['primary']) { - break; - } - } - - $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\'), \'column\' => \'%s\'', $column->getRelationKey('alias'), $column->getForeignTable()->getFieldName($name)); - } elseif ($column->isPrimaryKey()) { - $options[] = sprintf('\'model\' => \'%s\', \'column\' => \'%s\'', $this->table->getOption('name'), $column->getFieldName()); - } else { - switch ($column->getDoctrineType()) { - case 'boolean': - $options[] = "'choices' => array('', 1, 0)"; - - break; - - case 'date': - $options[] = "'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false))"; - - break; - - case 'datetime': - case 'timestamp': - $options[] = "'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59'))"; - - break; - - case 'enum': - $values = array_combine($column['values'], $column['values']); - $options[] = "'choices' => ".$this->arrayExport($values); - - break; - } - } - - return count($options) ? sprintf('array(%s)', implode(', ', $options)) : ''; - } - - public function getValidatorForColumn($column) - { - $format = 'new %s(%s)'; - - if (in_array($class = $this->getValidatorClassForColumn($column), ['sfValidatorInteger', 'sfValidatorNumber'])) { - $format = 'new sfValidatorSchemaFilter(\'text\', new %s(%s))'; - } - - return sprintf($format, $class, $this->getValidatorOptionsForColumn($column)); - } - - public function getType($column) - { - if ($column->isForeignKey()) { - return 'ForeignKey'; - } - - switch ($column->getDoctrineType()) { - case 'enum': - return 'Enum'; - - case 'boolean': - return 'Boolean'; - - case 'date': - case 'datetime': - case 'timestamp': - return 'Date'; - - case 'integer': - case 'decimal': - case 'float': - return 'Number'; - - default: - return 'Text'; - } - } - - /** - * Get the name of the form class to extend based on the inheritance of the model. - * - * @return string - */ - public function getFormClassToExtend() - { - return null === ($model = $this->getParentModel()) ? 'BaseFormFilterDoctrine' : sprintf('%sFormFilter', $model); - } - - /** - * Array export. Export array to formatted php code. - * - * @param array $values - * - * @return string $php - */ - protected function arrayExport($values) - { - $php = var_export($values, true); - $php = str_replace("\n", '', $php); - $php = str_replace('array ( ', 'array(', $php); - $php = str_replace(',)', ')', $php); - - return str_replace(' ', ' ', $php); - } - - /** - * Filter out models that have disabled generation of form classes. - * - * @return array $models Array of models to generate forms for - */ - protected function filterModels($models) - { - foreach ($models as $key => $model) { - $table = Doctrine_Core::getTable($model); - $symfonyOptions = (array) $table->getOption('symfony'); - - if ($table->isGenerator()) { - $symfonyOptions = array_merge((array) $table->getParentGenerator()->getOption('table')->getOption('symfony'), $symfonyOptions); - } - - if (isset($symfonyOptions['filter']) && !$symfonyOptions['filter']) { - unset($models[$key]); - } - } - - return $models; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php deleted file mode 100644 index f2f873cc6..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineFormGenerator.class.php +++ /dev/null @@ -1,704 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Doctrine form generator. - * - * This class generates a Doctrine forms. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineFormGenerator extends sfGenerator -{ - /** - * @var Doctrine_Table - */ - public $table; - - /** - * @var string - */ - public $modelName; - - /** - * Array of all the loaded models. - * - * @var array - */ - public $models = []; - - /** - * Array of all plugin models. - * - * @var array - */ - public $pluginModels = []; - - /** - * Array of all configuration params. - * - * @var array - */ - public $params = []; - - /** - * Initializes the current sfGenerator instance. - * - * @param sfGeneratorManager A sfGeneratorManager instance - */ - public function initialize(sfGeneratorManager $generatorManager) - { - parent::initialize($generatorManager); - - $this->getPluginModels(); - $this->setGeneratorClass('sfDoctrineForm'); - } - - /** - * Generates classes and templates in cache. - * - * @param array The parameters - * - * @return string The data to put in configuration cache - */ - public function generate($params = []) - { - $this->params = $params; - - if (!isset($this->params['model_dir_name'])) { - $this->params['model_dir_name'] = 'model'; - } - - if (!isset($this->params['form_dir_name'])) { - $this->params['form_dir_name'] = 'form'; - } - - $models = $this->loadModels(); - - // create the project base class for all forms - $file = sfConfig::get('sf_lib_dir').'/form/doctrine/BaseFormDoctrine.class.php'; - if (!file_exists($file)) { - if (!is_dir($directory = dirname($file))) { - mkdir($directory, 0777, true); - } - - file_put_contents($file, $this->evalTemplate('sfDoctrineFormBaseTemplate.php')); - } - - $pluginPaths = $this->generatorManager->getConfiguration()->getAllPluginPaths(); - - // create a form class for every Doctrine class - foreach ($models as $model) { - $this->table = Doctrine_Core::getTable($model); - $this->modelName = $model; - - $baseDir = sfConfig::get('sf_lib_dir').'/form/doctrine'; - - $isPluginModel = $this->isPluginModel($model); - if ($isPluginModel) { - $pluginName = $this->getPluginNameForModel($model); - $baseDir .= '/'.$pluginName; - } - - if (!is_dir($baseDir.'/base')) { - mkdir($baseDir.'/base', 0777, true); - } - - file_put_contents($baseDir.'/base/Base'.$model.'Form.class.php', $this->evalTemplate(null === $this->getParentModel() ? 'sfDoctrineFormGeneratedTemplate.php' : 'sfDoctrineFormGeneratedInheritanceTemplate.php')); - - if ($isPluginModel) { - $pluginBaseDir = $pluginPaths[$pluginName].'/lib/form/doctrine'; - if (!file_exists($classFile = $pluginBaseDir.'/Plugin'.$model.'Form.class.php')) { - if (!is_dir($pluginBaseDir)) { - mkdir($pluginBaseDir, 0777, true); - } - file_put_contents($classFile, $this->evalTemplate('sfDoctrineFormPluginTemplate.php')); - } - } - if (!file_exists($classFile = $baseDir.'/'.$model.'Form.class.php')) { - if ($isPluginModel) { - file_put_contents($classFile, $this->evalTemplate('sfDoctrinePluginFormTemplate.php')); - } else { - file_put_contents($classFile, $this->evalTemplate('sfDoctrineFormTemplate.php')); - } - } - } - } - - /** - * Get all the models which are a part of a plugin and the name of the plugin. - * The array format is modelName => pluginName. - * - * @todo This method is ugly and is a very weird way of finding the models which - * belong to plugins. If we could come up with a better way that'd be great - * - * @return array $pluginModels - */ - public function getPluginModels() - { - if (!$this->pluginModels) { - $plugins = $this->generatorManager->getConfiguration()->getPlugins(); - $pluginPaths = $this->generatorManager->getConfiguration()->getAllPluginPaths(); - - foreach ($pluginPaths as $pluginName => $path) { - if (!in_array($pluginName, $plugins)) { - continue; - } - - foreach (sfFinder::type('file')->name('*.php')->in($path.'/lib/model/doctrine') as $path) { - $info = pathinfo($path); - $e = explode('.', $info['filename']); - $modelName = substr($e[0], 6, strlen($e[0])); - - if (class_exists($e[0]) && class_exists($modelName)) { - $parent = new ReflectionClass('Doctrine_Record'); - $reflection = new ReflectionClass($modelName); - if ($reflection->isSubclassOf($parent)) { - $this->pluginModels[$modelName] = $pluginName; - - if ($reflection->isInstantiable()) { - $generators = Doctrine_Core::getTable($modelName)->getGenerators(); - foreach ($generators as $generator) { - $this->pluginModels[$generator->getOption('className')] = $pluginName; - } - } - } - } - } - } - } - - return $this->pluginModels; - } - - /** - * Check to see if a model is part of a plugin. - * - * @param string $modelName - * - * @return bool $bool - */ - public function isPluginModel($modelName) - { - return isset($this->pluginModels[$modelName]) ? true : false; - } - - /** - * Get the name of the plugin a model belongs to. - * - * @param string $modelName - * - * @return string $pluginName - */ - public function getPluginNameForModel($modelName) - { - if ($this->isPluginModel($modelName)) { - return $this->pluginModels[$modelName]; - } - - return false; - } - - /** - * Returns an array of relations that represents a many to many relationship. - * - * @return array An array of relations - */ - public function getManyToManyRelations() - { - $relations = []; - foreach ($this->table->getRelations() as $relation) { - if ( - Doctrine_Relation::MANY == $relation->getType() - && isset($relation['refTable']) - && (null === $this->getParentModel() || !Doctrine_Core::getTable($this->getParentModel())->hasRelation($relation->getAlias())) - ) { - $relations[] = $relation; - } - } - - return $relations; - } - - /** - * Returns PHP names for all foreign keys of the current table. - * - * This method does not returns foreign keys that are also primary keys. - * - * @return array An array composed of: - * * The foreign table PHP name - * * The foreign key PHP name - * * A Boolean to indicate whether the column is required or not - * * A Boolean to indicate whether the column is a many to many relationship or not - */ - public function getForeignKeyNames() - { - $names = []; - foreach ($this->table->getRelations() as $relation) { - if (Doctrine_Relation::ONE === $relation->getType()) { - $foreignDef = $relation->getTable()->getDefinitionOf($relation->getForeignFieldName()); - $names[] = [$relation['table']->getOption('name'), $relation->getForeignFieldName(), $this->isColumnNotNull($relation->getForeignFieldName(), $foreignDef), false]; - } - } - - foreach ($this->getManyToManyRelations() as $relation) { - $names[] = [$relation['table']->getOption('name'), $relation['alias'], false, true]; - } - - return $names; - } - - /** - * Returns the first primary key column of the current table. - * - * @param ColumnMap A ColumnMap object - */ - public function getPrimaryKey() - { - foreach ($this->getColumns() as $column) { - if ($column->isPrimaryKey()) { - return $column; - } - } - } - - /** - * Returns a sfWidgetForm class name for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The name of a subclass of sfWidgetForm - */ - public function getWidgetClassForColumn($column) - { - switch ($column->getDoctrineType()) { - case 'string': - $widgetSubclass = null === $column->getLength() || $column->getLength() > 255 ? 'Textarea' : 'InputText'; - - break; - - case 'boolean': - $widgetSubclass = 'InputCheckbox'; - - break; - - case 'blob': - case 'clob': - $widgetSubclass = 'Textarea'; - - break; - - case 'date': - $widgetSubclass = 'Date'; - - break; - - case 'time': - $widgetSubclass = 'Time'; - - break; - - case 'timestamp': - $widgetSubclass = 'DateTime'; - - break; - - case 'enum': - $widgetSubclass = 'Choice'; - - break; - - default: - $widgetSubclass = 'InputText'; - } - - if ($column->isPrimaryKey()) { - $widgetSubclass = 'InputHidden'; - } elseif ($column->isForeignKey()) { - $widgetSubclass = 'DoctrineChoice'; - } - - return sprintf('sfWidgetForm%s', $widgetSubclass); - } - - /** - * Returns a PHP string representing options to pass to a widget for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The options to pass to the widget as a PHP string - */ - public function getWidgetOptionsForColumn($column) - { - $options = []; - - if ($column->isForeignKey()) { - $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\'), \'add_empty\' => %s', $column->getRelationKey('alias'), $column->isNotNull() ? 'false' : 'true'); - } elseif ('enum' == $column->getDoctrineType() && is_subclass_of($this->getWidgetClassForColumn($column), 'sfWidgetFormChoiceBase')) { - $options[] = '\'choices\' => '.$this->arrayExport(array_combine($column['values'], $column['values'])); - } - - return count($options) ? sprintf('array(%s)', implode(', ', $options)) : ''; - } - - /** - * Returns a sfValidator class name for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The name of a subclass of sfValidator - */ - public function getValidatorClassForColumn($column) - { - switch ($column->getDoctrineType()) { - case 'boolean': - $validatorSubclass = 'Boolean'; - - break; - - case 'string': - if ($column->getDefinitionKey('email')) { - $validatorSubclass = 'Email'; - } elseif ($column->getDefinitionKey('regexp')) { - $validatorSubclass = 'Regex'; - } else { - $validatorSubclass = 'String'; - } - - break; - - case 'clob': - case 'blob': - $validatorSubclass = 'String'; - - break; - - case 'float': - case 'decimal': - $validatorSubclass = 'Number'; - - break; - - case 'integer': - $validatorSubclass = 'Integer'; - - break; - - case 'date': - $validatorSubclass = 'Date'; - - break; - - case 'time': - $validatorSubclass = 'Time'; - - break; - - case 'timestamp': - $validatorSubclass = 'DateTime'; - - break; - - case 'enum': - $validatorSubclass = 'Choice'; - - break; - - default: - $validatorSubclass = 'Pass'; - } - - if ($column->isForeignKey()) { - $validatorSubclass = 'DoctrineChoice'; - } elseif ($column->isPrimaryKey()) { - $validatorSubclass = 'Choice'; - } - - return sprintf('sfValidator%s', $validatorSubclass); - } - - /** - * Returns a PHP string representing options to pass to a validator for a given column. - * - * @param sfDoctrineColumn $column - * - * @return string The options to pass to the validator as a PHP string - */ - public function getValidatorOptionsForColumn($column) - { - $options = []; - - if ($column->isForeignKey()) { - if ($foreignColumn = $column->getForeignTable()->getColumnName($column->getForeignFieldName())) { - $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\'), \'column\' => \'%s\'', $column->getRelationKey('alias'), $foreignColumn); - } else { - $options[] = sprintf('\'model\' => $this->getRelatedModelName(\'%s\')', $column->getRelationKey('alias')); - } - } elseif ($column->isPrimaryKey()) { - $options[] = sprintf('\'choices\' => array($this->getObject()->get(\'%s\')), \'empty_value\' => $this->getObject()->get(\'%1$s\')', $column->getFieldName()); - } else { - switch ($column->getDoctrineType()) { - case 'string': - if ($column['length']) { - $options[] = sprintf('\'max_length\' => %s', $column['length']); - } - if (isset($column['minlength'])) { - $options[] = sprintf('\'min_length\' => %s', $column['minlength']); - } - if (isset($column['regexp'])) { - $options[] = sprintf('\'pattern\' => \'%s\'', $column['regexp']); - } - - break; - - case 'enum': - $options[] = '\'choices\' => '.$this->arrayExport($column['values']); - - break; - } - } - - // If notnull = false, is a primary or the column has a default value then - // make the widget not required - if (!$column->isNotNull() || $column->isPrimaryKey() || $column->hasDefinitionKey('default')) { - $options[] = '\'required\' => false'; - } - - return count($options) ? sprintf('array(%s)', implode(', ', $options)) : ''; - } - - /** - * Returns the maximum length for a column name. - * - * @return int The length of the longer column name - */ - public function getColumnNameMaxLength() - { - $max = 0; - foreach ($this->getColumns() as $column) { - if (($m = strlen($column->getFieldName())) > $max) { - $max = $m; - } - } - - foreach ($this->getManyToManyRelations() as $relation) { - if (($m = strlen($this->underscore($relation['alias']).'_list')) > $max) { - $max = $m; - } - } - - return $max; - } - - /** - * Returns an array of primary key column names. - * - * @return array An array of primary key column names - */ - public function getPrimaryKeyColumNames() - { - return $this->table->getIdentifierColumnNames(); - } - - /** - * Returns a PHP string representation for the array of all primary key column names. - * - * @return string A PHP string representation for the array of all primary key column names - * - * @see getPrimaryKeyColumNames() - */ - public function getPrimaryKeyColumNamesAsString() - { - return sprintf('array(\'%s\')', implode('\', \'', $this->getPrimaryKeyColumNames())); - } - - /** - * Returns true if the current table is internationalized. - * - * @return bool true if the current table is internationalized, false otherwise - */ - public function isI18n() - { - return $this->table->hasRelation('Translation'); - } - - /** - * Returns the i18n model name for the current table. - * - * @return string The model class name - */ - public function getI18nModel() - { - return $this->table->getRelation('Translation')->getTable()->create(); - } - - public function underscore($name) - { - return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $name)); - } - - /** - * Get array of sfDoctrineColumn objects that exist on the current model but not its parent. - * - * @return array $columns - */ - public function getColumns() - { - $parentModel = $this->getParentModel(); - $parentColumns = $parentModel ? array_keys(Doctrine_Core::getTable($parentModel)->getColumns()) : []; - - $columns = []; - foreach (array_diff(array_keys($this->table->getColumns()), $parentColumns) as $name) { - $columns[] = new sfDoctrineColumn($name, $this->table); - } - - // add relations to columns for inherited classes - if ($parentModel) { - $parentRelationNames = array_keys(Doctrine_Core::getTable($parentModel)->getRelations()); - $relations = $this->table->getRelations(); - $relationColumns = []; - foreach (array_diff(array_keys($relations), $parentRelationNames) as $relationName) { - if (Doctrine_Relation::ONE == $relations[$relationName]->getType()) { - $columnName = $relations[$relationName]->getLocal(); - if (!in_array($columnName, $relationColumns)) { - $relationColumns[] = $columnName; - $columns[] = new sfDoctrineColumn($columnName, $this->table); - } - } - } - } - - return $columns; - } - - public function getUniqueColumnNames() - { - $uniqueColumns = []; - - foreach ($this->getColumns() as $column) { - if ($column->getDefinitionKey('unique')) { - $uniqueColumns[] = [$column->getFieldName()]; - } - } - - $indexes = $this->table->getOption('indexes'); - foreach ($indexes as $name => $index) { - $index['fields'] = (array) $index['fields']; - - if (isset($index['type']) && 'unique' == $index['type']) { - $tmp = $index['fields']; - if (is_array(array_shift($tmp))) { - $uniqueColumns[] = array_keys($index['fields']); - } else { - $uniqueColumns[] = $index['fields']; - } - } - } - - return $uniqueColumns; - } - - /** - * Returns the name of the model class this model extends. - * - * @return string|null - */ - public function getParentModel() - { - $baseClasses = [ - 'Doctrine_Record', - 'sfDoctrineRecord', - ]; - - $builderOptions = sfConfig::get('doctrine_model_builder_options', []); - if (isset($builderOptions['baseClassName'])) { - $baseClasses[] = $builderOptions['baseClassName']; - } - - // find the first non-abstract parent - $model = $this->modelName; - while ($model = get_parent_class($model)) { - if (in_array($model, $baseClasses)) { - break; - } - - $r = new ReflectionClass($model); - if (!$r->isAbstract()) { - return $r->getName(); - } - } - } - - /** - * Get the name of the form class to extend based on the inheritance of the model. - * - * @return string - */ - public function getFormClassToExtend() - { - return null === ($model = $this->getParentModel()) ? 'BaseFormDoctrine' : sprintf('%sForm', $model); - } - - /** - * Loads all Doctrine builders. - */ - protected function loadModels() - { - Doctrine_Core::loadModels($this->generatorManager->getConfiguration()->getModelDirs()); - $models = Doctrine_Core::getLoadedModels(); - $models = Doctrine_Core::initializeModels($models); - $models = Doctrine_Core::filterInvalidModels($models); - $this->models = $this->filterModels($models); - - return $this->models; - } - - /** - * Filter out models that have disabled generation of form classes. - * - * @return array $models Array of models to generate forms for - */ - protected function filterModels($models) - { - foreach ($models as $key => $model) { - $table = Doctrine_Core::getTable($model); - $symfonyOptions = (array) $table->getOption('symfony'); - - if ($table->isGenerator()) { - $symfonyOptions = array_merge((array) $table->getParentGenerator()->getOption('table')->getOption('symfony'), $symfonyOptions); - } - - if (isset($symfonyOptions['form']) && !$symfonyOptions['form']) { - unset($models[$key]); - } - } - - return $models; - } - - /** - * Array export. Export array to formatted php code. - * - * @param array $values - * - * @return string $php - */ - protected function arrayExport($values) - { - $php = var_export($values, true); - $php = str_replace("\n", '', $php); - $php = str_replace('array ( ', 'array(', $php); - $php = str_replace(',)', ')', $php); - - return str_replace(' ', ' ', $php); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php deleted file mode 100644 index d95d59bda..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php +++ /dev/null @@ -1,261 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Doctrine generator. - * - * @author Fabien Potencier - */ -class sfDoctrineGenerator extends sfModelGenerator -{ - protected $table; - - /** - * Initializes the current sfGenerator instance. - * - * @param sfGeneratorManager $generatorManager A sfGeneratorManager instance - */ - public function initialize(sfGeneratorManager $generatorManager) - { - parent::initialize($generatorManager); - - $this->setGeneratorClass('sfDoctrineModule'); - } - - /** - * Configures this generator. - */ - public function configure() - { - $this->table = Doctrine_Core::getTable($this->modelClass); - - // load all primary keys - $this->loadPrimaryKeys(); - } - - /** - * Returns an array of tables that represents a many to many relationship. - * - * A table is considered to be a m2m table if it has 2 foreign keys that are also primary keys. - * - * @return array an array of tables - */ - public function getManyToManyTables() - { - $relations = []; - foreach ($this->table->getRelations() as $relation) { - if (Doctrine_Relation::MANY === $relation->getType() && isset($relation['refTable'])) { - $relations[] = $relation; - } - } - - return $relations; - } - - /** - * Returns the getter either non-developped: 'getFoo' or developped: '$class->getFoo()'. - * - * @param string $column The column name - * @param bool $developed true if you want developped method names, false otherwise - * @param string $prefix The prefix value - * - * @return string PHP code - */ - public function getColumnGetter($column, $developed = false, $prefix = '') - { - $getter = 'get'.sfInflector::camelize($column); - if ($developed) { - $getter = sprintf('$%s%s->%s()', $prefix, $this->getSingularName(), $getter); - } - - return $getter; - } - - /** - * Returns the type of a column. - * - * @param object $column A column object - * - * @return string The column type - */ - public function getType($column) - { - if ($column->isForeignKey()) { - return 'ForeignKey'; - } - - switch ($column->getDoctrineType()) { - case 'enum': - return 'Enum'; - - case 'boolean': - return 'Boolean'; - - case 'date': - case 'timestamp': - return 'Date'; - - case 'time': - return 'Time'; - - default: - return 'Text'; - } - } - - /** - * Returns the default configuration for fields. - * - * @return array An array of default configuration for all fields - */ - public function getDefaultFieldsConfiguration() - { - $fields = []; - - $names = []; - foreach ($this->getColumns() as $name => $column) { - $names[] = $name; - $fields[$name] = array_merge([ - 'is_link' => (bool) $column->isPrimaryKey(), - 'is_real' => true, - 'is_partial' => false, - 'is_component' => false, - 'type' => $this->getType($column), - ], isset($this->config['fields'][$name]) ? $this->config['fields'][$name] : []); - } - - foreach ($this->getManyToManyTables() as $tables) { - $name = sfInflector::underscore($tables['alias']).'_list'; - $names[] = $name; - $fields[$name] = array_merge([ - 'is_link' => false, - 'is_real' => false, - 'is_partial' => false, - 'is_component' => false, - 'type' => 'Text', - ], isset($this->config['fields'][$name]) ? $this->config['fields'][$name] : []); - } - - if (isset($this->config['fields'])) { - foreach ($this->config['fields'] as $name => $params) { - if (in_array($name, $names)) { - continue; - } - - $fields[$name] = array_merge([ - 'is_link' => false, - 'is_real' => false, - 'is_partial' => false, - 'is_component' => false, - 'type' => 'Text', - ], is_array($params) ? $params : []); - } - } - - unset($this->config['fields']); - - return $fields; - } - - /** - * Returns the configuration for fields in a given context. - * - * @param string $context The Context - * - * @return array An array of configuration for all the fields in a given context - */ - public function getFieldsConfiguration($context) - { - $fields = []; - - $names = []; - foreach ($this->getColumns() as $name => $column) { - $names[] = $name; - $fields[$name] = isset($this->config[$context]['fields'][$name]) ? $this->config[$context]['fields'][$name] : []; - } - - foreach ($this->getManyToManyTables() as $tables) { - $name = sfInflector::underscore($tables['alias']).'_list'; - $names[] = $name; - $fields[$name] = isset($this->config[$context]['fields'][$name]) ? $this->config[$context]['fields'][$name] : []; - } - - if (isset($this->config[$context]['fields'])) { - foreach ($this->config[$context]['fields'] as $name => $params) { - if (in_array($name, $names)) { - continue; - } - - $fields[$name] = is_array($params) ? $params : []; - } - } - - unset($this->config[$context]['fields']); - - return $fields; - } - - /** - * Gets all the fields for the current model. - * - * @param bool $withM2M Whether to include m2m fields or not - * - * @return array An array of field names - */ - public function getAllFieldNames($withM2M = true) - { - $names = []; - foreach ($this->getColumns() as $name => $column) { - $names[] = $name; - } - - if ($withM2M) { - foreach ($this->getManyToManyTables() as $tables) { - $names[] = sfInflector::underscore($tables['alias']).'_list'; - } - } - - return $names; - } - - /** - * Get array of sfDoctrineAdminColumn objects. - * - * @return array $columns - */ - public function getColumns() - { - foreach (array_keys($this->table->getColumns()) as $name) { - $name = $this->table->getFieldName($name); - $columns[$name] = new sfDoctrineColumn($name, $this->table); - } - - return $columns; - } - - /** - * Loads primary keys. - * - * @throws sfException - */ - protected function loadPrimaryKeys() - { - $this->primaryKey = []; - foreach ($this->getColumns() as $name => $column) { - if ($column->isPrimaryKey()) { - $this->primaryKey[] = $name; - } - } - - if (!count($this->primaryKey)) { - throw new sfException(sprintf('Cannot generate a module for a model without a primary key (%s)', $this->modelClass)); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php deleted file mode 100644 index 8cf3f22ea..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Swift_DoctrineSpool is a spool that uses Doctrine. - * - * Example schema: - * - * MailMessage: - * actAs: { Timestampable: ~ } - * columns: - * message: { type: clob, notnull: true } - * - * @author Fabien Potencier - */ -class Swift_DoctrineSpool extends Swift_ConfigurableSpool -{ - protected $model; - protected $column; - protected $method; - - /** - * Constructor. - * - * @param string The Doctrine model to use to store the messages (MailMessage by default) - * @param string The column name to use for message storage (message by default) - * @param string The method to call to retrieve the query to execute (optional) - */ - public function __construct($model = 'MailMessage', $column = 'message', $method = 'createQuery') - { - $this->model = $model; - $this->column = $column; - $this->method = $method; - } - - /** - * Tests if this Transport mechanism has started. - * - * @return bool - */ - public function isStarted() - { - return true; - } - - /** - * Starts this Transport mechanism. - */ - public function start() - { - } - - /** - * Stops this Transport mechanism. - */ - public function stop() - { - } - - /** - * Stores a message in the queue. - * - * @param Swift_Mime_Message $message The message to store - */ - public function queueMessage(Swift_Mime_Message $message) - { - $object = new $this->model(); - - if (!$object instanceof Doctrine_Record) { - throw new InvalidArgumentException('The mailer message object must be a Doctrine_Record object.'); - } - - $object->{$this->column} = serialize($message); - $object->save(); - - $object->free(true); - } - - /** - * Sends messages using the given transport instance. - * - * @param Swift_Transport $transport A transport instance - * @param string[] &$failedRecipients An array of failures by-reference - * - * @return int The number of sent emails - */ - public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) - { - $table = Doctrine_Core::getTable($this->model); - $objects = $table->{$this->method}()->limit($this->getMessageLimit())->execute(); - - if (!$transport->isStarted()) { - $transport->start(); - } - - $count = 0; - $time = time(); - foreach ($objects as $object) { - $message = unserialize($object->{$this->column}); - - $object->delete(); - - try { - $count += $transport->send($message, $failedRecipients); - } catch (Exception $e) { - // TODO: What to do with errors? - } - - if ($this->getTimeLimit() && (time() - $time) >= $this->getTimeLimit()) { - break; - } - } - - return $count; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/pager/sfDoctrinePager.class.php b/lib/plugins/sfDoctrinePlugin/lib/pager/sfDoctrinePager.class.php deleted file mode 100644 index 7ae1cdd0c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/pager/sfDoctrinePager.class.php +++ /dev/null @@ -1,211 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrine pager class. - * - * @author Jonathan H. Wage - */ -class sfDoctrinePager extends sfPager implements Serializable -{ - protected $query; - protected $tableMethodName; - protected $tableMethodCalled = false; - - /** - * Serializes the current instance for php 7.4+. - * - * @return array - */ - public function __serialize() - { - $vars = get_object_vars($this); - unset($vars['query']); - - return $vars; - } - - /** - * Unserializes a sfDoctrinePager instance for php 7.4+. - * - * @param array $data - */ - public function __unserialize($data) - { - foreach ($data as $name => $values) { - $this->{$name} = $values; - } - - $this->tableMethodCalled = false; - } - - /** - * Get the name of the table method used to retrieve the query object for the pager. - * - * @return string $tableMethodName - */ - public function getTableMethod() - { - return $this->tableMethodName; - } - - /** - * Set the name of the table method used to retrieve the query object for the pager. - * - * @param string $tableMethodName - */ - public function setTableMethod($tableMethodName) - { - $this->tableMethodName = $tableMethodName; - } - - /** - * Serialize the pager object. - * - * @return string $serialized - */ - public function serialize() - { - return serialize($this->__serialize()); - } - - /** - * Unserialize a pager object. - * - * @param string $serialized - */ - public function unserialize($serialized) - { - $array = unserialize($serialized); - - return $this->__unserialize($array); - } - - /** - * Returns a query for counting the total results. - * - * @return Doctrine_Query - */ - public function getCountQuery() - { - $query = clone $this->getQuery(); - $query - ->offset(0) - ->limit(0) - ; - - return $query; - } - - /** - * @see sfPager - */ - public function init() - { - $this->resetIterator(); - - $countQuery = $this->getCountQuery(); - $count = $countQuery->count(); - - $this->setNbResults($count); - - $query = $this->getQuery(); - $query - ->offset(0) - ->limit(0) - ; - - if (0 == $this->getPage() || 0 == $this->getMaxPerPage() || 0 == $this->getNbResults()) { - $this->setLastPage(0); - } else { - $offset = ($this->getPage() - 1) * $this->getMaxPerPage(); - - $this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage())); - - $query - ->offset($offset) - ->limit($this->getMaxPerPage()) - ; - } - } - - /** - * Get the query for the pager. - * - * @return Doctrine_Query - */ - public function getQuery() - { - if (!$this->tableMethodCalled && $this->tableMethodName) { - $method = $this->tableMethodName; - $this->query = Doctrine_Core::getTable($this->getClass())->{$method}($this->query); - $this->tableMethodCalled = true; - } elseif (!$this->query) { - $this->query = Doctrine_Core::getTable($this->getClass())->createQuery(); - } - - return $this->query; - } - - /** - * Set query object for the pager. - * - * @param Doctrine_Query $query - */ - public function setQuery($query) - { - $this->query = $query; - } - - /** - * Get all the results for the pager instance. - * - * @param mixed $hydrationMode A hydration mode identifier - * - * @return array|Doctrine_Collection - */ - public function getResults($hydrationMode = null) - { - return $this->getQuery()->execute([], $hydrationMode); - } - - /** - * Retrieve the object for a certain offset. - * - * @param int $offset - * - * @return Doctrine_Record - */ - protected function retrieveObject($offset) - { - $queryForRetrieve = clone $this->getQuery(); - $queryForRetrieve - ->offset($offset - 1) - ->limit(1) - ; - - $results = $queryForRetrieve->execute(); - - return $results[0]; - } - - /** - * @see sfPager - */ - protected function initializeIterator() - { - parent::initializeIterator(); - - if ($this->results instanceof Doctrine_Collection) { - $this->results = $this->results->getData(); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php b/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php deleted file mode 100644 index dfbec5056..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecord.class.php +++ /dev/null @@ -1,237 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Base sfDoctrineRecord extends the base Doctrine_Record in Doctrine to provide some - * symfony specific functionality to Doctrine_Records. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -abstract class sfDoctrineRecord extends Doctrine_Record -{ - protected static $_defaultCulture = 'en'; - - /** - * Returns a string representation of the record. - * - * @return string A string representation of the record - */ - public function __toString() - { - $guesses = ['name', - 'title', - 'description', - 'subject', - 'keywords', - 'id']; - - // we try to guess a column which would give a good description of the object - foreach ($guesses as $descriptionColumn) { - try { - return (string) $this->get($descriptionColumn); - } catch (Exception $e) { - } - } - - return sprintf('No description for object of class "%s"', $this->getTable()->getComponentName()); - } - - /** - * Provides getter and setter methods. - * - * @param string $method The method name - * @param array $arguments The method arguments - * - * @return mixed The returned value of the called method - */ - public function __call($method, $arguments) - { - $failed = false; - - try { - if (in_array($verb = substr($method, 0, 3), ['set', 'get'])) { - $name = substr($method, 3); - - $table = $this->getTable(); - if ($table->hasRelation($name)) { - $entityName = $name; - } elseif ($table->hasField($fieldName = $table->getFieldName($name))) { - $entityNameLower = strtolower($fieldName); - if ($table->hasField($entityNameLower)) { - $entityName = $entityNameLower; - } else { - $entityName = $fieldName; - } - } else { - $underScored = $table->getFieldName(sfInflector::underscore($name)); - if ($table->hasField($underScored) || $table->hasRelation($underScored)) { - $entityName = $underScored; - } elseif ($table->hasField(strtolower($name)) || $table->hasRelation(strtolower($name))) { - $entityName = strtolower($name); - } else { - $camelCase = $table->getFieldName(sfInflector::camelize($name)); - $camelCase = strtolower($camelCase[0]).substr($camelCase, 1, strlen($camelCase)); - if ($table->hasField($camelCase) || $table->hasRelation($camelCase)) { - $entityName = $camelCase; - } else { - $entityName = $underScored; - } - } - } - - return call_user_func_array( - [$this, $verb], - array_merge([$entityName], $arguments) - ); - } - $failed = true; - } catch (Exception $e) { - $failed = true; - } - if ($failed) { - try { - return parent::__call($method, $arguments); - } catch (Doctrine_Record_UnknownPropertyException $e2) { - } - - if (isset($e) && $e) { - throw $e; - } - if (isset($e2) && $e2) { - throw $e2; - } - } - } - - /** - * Initializes internationalization. - * - * @see Doctrine_Record - */ - public function construct() - { - if ($this->getTable()->hasRelation('Translation')) { - // only add filter to each table once - if (!$this->getTable()->getOption('has_symfony_i18n_filter')) { - $this->getTable() - ->unshiftFilter(new sfDoctrineRecordI18nFilter()) - ->setOption('has_symfony_i18n_filter', true) - ; - } - } - } - - /** - * Listens to the user.change_culture event. - * - * @param sfEvent An sfEvent instance - */ - public static function listenToChangeCultureEvent(sfEvent $event) - { - self::$_defaultCulture = $event['culture']; - } - - /** - * Sets the default culture. - * - * @param string $culture - */ - public static function setDefaultCulture($culture) - { - self::$_defaultCulture = $culture; - } - - /** - * Return the default culture. - * - * @return string the default culture - */ - public static function getDefaultCulture() - { - if (!self::$_defaultCulture) { - throw new sfException('The default culture has not been set'); - } - - return self::$_defaultCulture; - } - - /** - * Returns the current record's primary key. - * - * This a proxy method to {@link Doctrine_Record::identifier()} for - * compatibility with a Propel-style API. - * - * @return mixed The value of the current model's last identifier column - */ - public function getPrimaryKey() - { - $identifier = (array) $this->identifier(); - - return end($identifier); - } - - /** - * Function require by symfony >= 1.2 admin generators. - * - * @return bool - */ - public function isNew() - { - return !$this->exists(); - } - - /** - * Get the Doctrine date value as a PHP DateTime object, null if the value is not set. - * - * @param string $dateFieldName The field name to get the DateTime object for - * - * @return DateTime|null $dateTime The instance of PHPs DateTime - * - * @throws sfException if the field is not one of date, datetime, or timestamp types - */ - public function getDateTimeObject($dateFieldName) - { - $type = $this->getTable()->getTypeOf($dateFieldName); - if ('date' == $type || 'timestamp' == $type || 'datetime' == $type) { - $datetime = $this->get($dateFieldName); - if ($datetime) { - return new DateTime($datetime); - } - } else { - throw new sfException('Cannot call getDateTimeObject() on a field that is not of type date or timestamp.'); - } - } - - /** - * Set the Doctrine date value by passing a valid PHP DateTime object instance. - * - * @param string $dateFieldName The field name to set the date for - * @param DateTime $dateTimeObject The DateTime instance to use to set the value - * - * @return sfDoctrineRecord - * - * @throws sfException if the field is not one of date, datetime, or timestamp types - */ - public function setDateTimeObject($dateFieldName, ?DateTime $dateTimeObject = null) - { - $type = $this->getTable()->getTypeOf($dateFieldName); - if ('date' == $type || 'timestamp' == $type || 'datetime' == $type) { - if (null === $dateTimeObject) { - return $this->set($dateFieldName, null); - } - - return $this->set($dateFieldName, $dateTimeObject->format('Y-m-d H:i:s')); - } - - throw new sfException('Cannot call setDateTimeObject() on a field that is not of type date or timestamp.'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecordI18nFilter.class.php b/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecordI18nFilter.class.php deleted file mode 100644 index c4e0677c6..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/record/sfDoctrineRecordI18nFilter.class.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrineRecordI18nFilter implements access to the translated properties for - * the current culture from the internationalized model. - * - * @author Jonathan H. Wage - */ -class sfDoctrineRecordI18nFilter extends Doctrine_Record_Filter -{ - /** - * @see Doctrine_Table::unshiftFilter() - */ - public function init() - { - } - - /** - * Calls set on Translation relationship. - * - * Allows manipulation of I18n properties from the main object. - * - * @param string $name Name of the property - * @param string $value Value of the property - */ - public function filterSet(Doctrine_Record $record, $name, $value) - { - return $record['Translation'][sfDoctrineRecord::getDefaultCulture()][$name] = $value; - } - - /** - * Call get on Translation relationship. - * - * Allow access to I18n properties from the main object. - * - * @param string $name Name of the property - */ - public function filterGet(Doctrine_Record $record, $name) - { - $culture = sfDoctrineRecord::getDefaultCulture(); - if (isset($record['Translation'][$culture]) && '' != $record['Translation'][$culture][$name]) { - return $record['Translation'][$culture][$name]; - } - - $defaultCulture = sfConfig::get('sf_default_culture'); - - return $record['Translation'][$defaultCulture][$name]; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRoute.class.php b/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRoute.class.php deleted file mode 100644 index c3952db17..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRoute.class.php +++ /dev/null @@ -1,121 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrineRoute represents a route that is bound to a Doctrine class. - * - * A Doctrine route can represent a single Doctrine object or a list of objects. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineRoute extends sfObjectRoute -{ - protected $query; - - public function setListQuery(Doctrine_Query $query) - { - if (!$this->isBound()) { - throw new LogicException('The route is not bound.'); - } - - $this->query = $query; - } - - protected function getObjectForParameters($parameters) - { - $results = $this->getObjectsForParameters($parameters); - - // If query returned Doctrine_Collection with results inside then we - // need to return the first Doctrine_Record - if ($results instanceof Doctrine_Collection) { - if (count($results)) { - $results = $results->getFirst(); - } else { - $results = null; - } - } - // If an object is returned then lets return it otherwise return null - elseif (!is_object($results)) { - $results = null; - } - - return $results; - } - - protected function getObjectsForParameters($parameters) - { - $tableModel = Doctrine_Core::getTable($this->options['model']); - - $variables = []; - $values = []; - foreach ($this->getRealVariables() as $variable) { - if ($tableModel->hasColumn($tableModel->getColumnName($variable))) { - $variables[] = $variable; - $values[$variable] = $parameters[$variable]; - } - } - - if (!isset($this->options['method'])) { - if (null === $this->query) { - $q = $tableModel->createQuery('a'); - foreach ($values as $variable => $value) { - $fieldName = $tableModel->getFieldName($variable); - $q->andWhere('a.'.$fieldName.' = ?', $parameters[$variable]); - } - } else { - $q = $this->query; - } - if (isset($this->options['method_for_query'])) { - $method = $this->options['method_for_query']; - $results = $tableModel->{$method}($q); - } else { - $results = $q->execute(); - } - } else { - $method = $this->options['method']; - $results = $tableModel->{$method}($this->filterParameters($parameters)); - } - - // If query returned a Doctrine_Record instance instead of a - // Doctrine_Collection then we need to create a new Doctrine_Collection with - // one element inside and return that - if ($results instanceof Doctrine_Record) { - $obj = $results; - $results = new Doctrine_Collection($obj->getTable()); - $results[] = $obj; - } - - return $results; - } - - protected function doConvertObjectToArray($object) - { - if (isset($this->options['convert']) || method_exists($object, 'toParams')) { - return parent::doConvertObjectToArray($object); - } - - $parameters = []; - foreach ($this->getRealVariables() as $variable) { - try { - $parameters[$variable] = $object->{$variable}; - } catch (Exception $e) { - try { - $method = 'get'.sfInflector::camelize($variable); - $parameters[$variable] = $object->{$method}(); - } catch (Exception $e) { - } - } - } - - return $parameters; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRouteCollection.class.php b/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRouteCollection.class.php deleted file mode 100644 index c12f07f06..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/routing/sfDoctrineRouteCollection.class.php +++ /dev/null @@ -1,21 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfObjectRouteCollection represents a collection of routes bound to Doctrine objects. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineRouteCollection extends sfObjectRouteCollection -{ - protected $routeClass = 'sfDoctrineRoute'; -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/sfDoctrineException.class.php b/lib/plugins/sfDoctrinePlugin/lib/sfDoctrineException.class.php deleted file mode 100644 index 4ee23fc9c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/sfDoctrineException.class.php +++ /dev/null @@ -1,20 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfDoctrine exception class. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineException extends sfException -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php deleted file mode 100644 index 094ee2844..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBaseTask.class.php +++ /dev/null @@ -1,251 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Base class for all symfony Doctrine tasks. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -abstract class sfDoctrineBaseTask extends sfBaseTask -{ - /** - * Returns an array of configuration variables for the Doctrine CLI. - * - * @return array $config - * - * @see sfDoctrinePluginConfiguration::getCliConfig() - */ - public function getCliConfig() - { - return $this->configuration->getPluginConfiguration('sfDoctrinePlugin')->getCliConfig(); - } - - /** - * Calls a Doctrine CLI command. - * - * @param string $task Name of the Doctrine task to call - * @param array $args Arguments for the task - * - * @see sfDoctrineCli - */ - public function callDoctrineCli($task, $args = []) - { - $config = $this->getCliConfig(); - - $arguments = ['./symfony', $task]; - - foreach ($args as $key => $arg) { - if (isset($config[$key])) { - $config[$key] = $arg; - } else { - $arguments[] = $arg; - } - } - - $cli = new sfDoctrineCli($config); - $cli->setSymfonyDispatcher($this->dispatcher); - $cli->setSymfonyFormatter($this->formatter); - $cli->run($arguments); - } - - /** - * Returns Doctrine databases from the supplied database manager. - * - * @param array|null $names An array of names or NULL for all databases - * - * @return array An associative array of {@link sfDoctrineDatabase} objects and their names - * - * @throws InvalidArgumentException If a requested database is not a Doctrine database - */ - protected function getDoctrineDatabases(sfDatabaseManager $databaseManager, ?array $names = null) - { - $databases = []; - - if (null === $names) { - foreach ($databaseManager->getNames() as $name) { - $database = $databaseManager->getDatabase($name); - - if ($database instanceof sfDoctrineDatabase) { - $databases[$name] = $database; - } - } - } else { - foreach ($names as $name) { - $database = $databaseManager->getDatabase($name); - - if (!$database instanceof sfDoctrineDatabase) { - throw new InvalidArgumentException(sprintf('The database "%s" is not a Doctrine database.', $name)); - } - - $databases[$name] = $database; - } - } - - return $databases; - } - - /** - * Merges all project and plugin schema files into one. - * - * Schema files are merged similar to how other configuration files are in - * symfony, utilizing a configuration cascade. Files later in the cascade - * can change values from earlier in the cascade. - * - * The order in which schema files are processed is like so: - * - * 1. Plugin schema files - * * Plugins are processed in the order which they were enabled in ProjectConfiguration - * * Each plugin's schema files are processed in alphabetical order - * 2. Project schema files - * * Project schema files are processed in alphabetical order - * - * A schema file is any file saved in a plugin or project's config/doctrine/ - * directory that matches the "*.yml" glob. - * - * @return string Absolute path to the consolidated schema file - */ - protected function prepareSchemaFile($yamlSchemaPath) - { - $models = []; - $finder = sfFinder::type('file')->name('*.yml')->sort_by_name()->follow_link(); - - // plugin models - foreach ($this->configuration->getPlugins() as $name) { - $plugin = $this->configuration->getPluginConfiguration($name); - foreach ($finder->in($plugin->getRootDir().'/config/doctrine') as $schema) { - $pluginModels = (array) sfYaml::load($schema); - $globals = $this->filterSchemaGlobals($pluginModels); - - foreach ($pluginModels as $model => $definition) { - // canonicalize this definition - $definition = $this->canonicalizeModelDefinition($model, $definition); - - // merge in the globals - $definition = array_merge($globals, $definition); - - // merge this model into the schema - $models[$model] = isset($models[$model]) ? sfToolkit::arrayDeepMerge($models[$model], $definition) : $definition; - - // the first plugin to define this model gets the package - if (!isset($models[$model]['package'])) { - $models[$model]['package'] = $plugin->getName().'.lib.model.doctrine'; - } - - if (!isset($models[$model]['package_custom_path']) && 0 === strpos($models[$model]['package'], $plugin->getName())) { - $models[$model]['package_custom_path'] = $plugin->getRootDir().'/lib/model/doctrine'; - } - } - } - } - - // project models - foreach ($finder->in($yamlSchemaPath) as $schema) { - $projectModels = (array) sfYaml::load($schema); - $globals = $this->filterSchemaGlobals($projectModels); - - foreach ($projectModels as $model => $definition) { - // canonicalize this definition - $definition = $this->canonicalizeModelDefinition($model, $definition); - - // merge in the globals - $definition = array_merge($globals, $definition); - - // merge this model into the schema - $models[$model] = isset($models[$model]) ? sfToolkit::arrayDeepMerge($models[$model], $definition) : $definition; - } - } - - // create one consolidated schema file - $file = realpath(sys_get_temp_dir()).'/doctrine_schema_'.rand(11111, 99999).'.yml'; - $this->logSection('file+', $file); - file_put_contents($file, sfYaml::dump($models, 4)); - - return $file; - } - - /** - * Removes and returns globals from the supplied array of models. - * - * @param array $models An array of model definitions - * - * @return array An array of globals - * - * @see Doctrine_Import_Schema::getGlobalDefinitionKeys() - */ - protected function filterSchemaGlobals(&$models) - { - $globals = []; - $globalKeys = Doctrine_Import_Schema::getGlobalDefinitionKeys(); - - foreach ($models as $key => $value) { - if (in_array($key, $globalKeys)) { - $globals[$key] = $value; - unset($models[$key]); - } - } - - return $globals; - } - - /** - * Canonicalizes a model definition in preparation for merging. - * - * @param string $model The model name - * @param array $definition The model definition - * - * @return array The canonicalized model definition - */ - protected function canonicalizeModelDefinition($model, $definition) - { - // expand short "type" syntax - if (isset($definition['columns'])) { - foreach ($definition['columns'] as $key => $value) { - if (!is_array($value)) { - $definition['columns'][$key] = ['type' => $value]; - $value = $definition['columns'][$key]; - } - - // expand short type(length, scale) syntax - if (isset($value['type']) && preg_match('/ *(\w+) *\( *(\d+)(?: *, *(\d+))? *\)/', $value['type'], $match)) { - $definition['columns'][$key]['type'] = $match[1]; - $definition['columns'][$key]['length'] = $match[2]; - - if (isset($match[3])) { - $definition['columns'][$key]['scale'] = $match[3]; - } - } - } - } - - // expand short "actAs" syntax - if (isset($definition['actAs'])) { - foreach ($definition['actAs'] as $key => $value) { - if (is_numeric($key)) { - $definition['actAs'][$value] = []; - unset($definition['actAs'][$key]); - } - } - } - - // expand short "listeners" syntax - if (isset($definition['listeners'])) { - foreach ($definition['listeners'] as $key => $value) { - if (is_numeric($key)) { - $definition['listeners'][$value] = []; - unset($definition['listeners'][$key]); - } - } - } - - return $definition; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildDbTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildDbTask.class.php deleted file mode 100644 index c073081ae..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildDbTask.class.php +++ /dev/null @@ -1,73 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Creates database for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineBuildDbTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('database', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY, 'A specific database'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->aliases = ['doctrine:create-db']; - $this->namespace = 'doctrine'; - $this->name = 'build-db'; - $this->briefDescription = 'Creates database for current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-db|INFO] task creates one or more databases based on -configuration in [config/databases.yml|COMMENT]: - - [./symfony doctrine:build-db|INFO] - -You can specify what databases to create by providing their names: - - [./symfony doctrine:build-db slave1 slave2|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $databases = $this->getDoctrineDatabases($databaseManager, count($arguments['database']) ? $arguments['database'] : null); - - $environment = $this->configuration instanceof sfApplicationConfiguration ? $this->configuration->getEnvironment() : 'all'; - - foreach ($databases as $name => $database) { - $this->logSection('doctrine', sprintf('Creating "%s" environment "%s" database', $environment, $name)); - - try { - $database->getDoctrineConnection()->createDatabase(); - } catch (Exception $e) { - $this->logSection('doctrine', $e->getMessage(), null, 'ERROR'); - } - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php deleted file mode 100644 index fed0f611f..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license informationation, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Create filter form classes for the current model. - * - * @author Fabien Potencier - */ -class sfDoctrineBuildFiltersTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('model-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The model dir name', 'model'), - new sfCommandOption('filter-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The filter form dir name', 'filter'), - new sfCommandOption('generator-class', null, sfCommandOption::PARAMETER_REQUIRED, 'The generator class', 'sfDoctrineFormFilterGenerator'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build-filters'; - $this->briefDescription = 'Creates filter form classes for the current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-filters|INFO] task creates form filter classes from the schema: - - [./symfony doctrine:build-filters|INFO] - -This task creates form filter classes based on the model. The classes are -created in [lib/doctrine/filter|COMMENT]. - -This task never overrides custom classes in [lib/doctrine/filter|COMMENT]. -It only replaces base classes generated in [lib/doctrine/filter/base|COMMENT]. -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'generating filter form classes'); - $databaseManager = new sfDatabaseManager($this->configuration); - $generatorManager = new sfGeneratorManager($this->configuration); - $generatorManager->generate($options['generator-class'], [ - 'model_dir_name' => $options['model-dir-name'], - 'filter_dir_name' => $options['filter-dir-name'], - ]); - - $properties = parse_ini_file(sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'properties.ini', true); - - $constants = [ - 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', - 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', - ]; - - // customize php and yml files - $finder = sfFinder::type('file')->name('*.php'); - $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_lib_dir').'/filter/'), '##', '##', $constants); - - $this->reloadAutoload(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php deleted file mode 100644 index 1eae22868..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Create form classes for the current model. - * - * @author Fabien Potencier - */ -class sfDoctrineBuildFormsTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('model-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The model dir name', 'model'), - new sfCommandOption('form-dir-name', null, sfCommandOption::PARAMETER_REQUIRED, 'The form dir name', 'form'), - new sfCommandOption('generator-class', null, sfCommandOption::PARAMETER_REQUIRED, 'The generator class', 'sfDoctrineFormGenerator'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build-forms'; - $this->briefDescription = 'Creates form classes for the current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-forms|INFO] task creates form classes from the schema: - - [./symfony doctrine:build-forms|INFO] - -This task creates form classes based on the model. The classes are created -in [lib/doctrine/form|COMMENT]. - -This task never overrides custom classes in [lib/doctrine/form|COMMENT]. -It only replaces base classes generated in [lib/doctrine/form/base|COMMENT]. -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'generating form classes'); - $databaseManager = new sfDatabaseManager($this->configuration); - $generatorManager = new sfGeneratorManager($this->configuration); - $generatorManager->generate($options['generator-class'], [ - 'model_dir_name' => $options['model-dir-name'], - 'form_dir_name' => $options['form-dir-name'], - ]); - - $properties = parse_ini_file(sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'properties.ini', true); - - $constants = [ - 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', - 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', - ]; - - // customize php and yml files - $finder = sfFinder::type('file')->name('*.php'); - $this->getFilesystem()->replaceTokens($finder->in(sfConfig::get('sf_lib_dir').'/form/'), '##', '##', $constants); - - // check for base form class - if (!class_exists('BaseForm')) { - $file = sfConfig::get('sf_lib_dir').'/'.$options['form-dir-name'].'/BaseForm.class.php'; - $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').'/task/generator/skeleton/project/lib/form/BaseForm.class.php', $file); - $this->getFilesystem()->replaceTokens($file, '##', '##', $constants); - } - - $this->reloadAutoload(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php deleted file mode 100644 index 60a81779d..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php +++ /dev/null @@ -1,121 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Create classes for the current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineBuildModelTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build-model'; - $this->briefDescription = 'Creates classes for the current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-model|INFO] task creates model classes from the schema: - - [./symfony doctrine:build-model|INFO] - -The task read the schema information in [config/doctrine/*.yml|COMMENT] -from the project and all enabled plugins. - -The model classes files are created in [lib/model/doctrine|COMMENT]. - -This task never overrides custom classes in [lib/model/doctrine|COMMENT]. -It only replaces files in [lib/model/doctrine/base|COMMENT]. -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'generating model classes'); - - $config = $this->getCliConfig(); - $builderOptions = $this->configuration->getPluginConfiguration('sfDoctrinePlugin')->getModelBuilderOptions(); - - $stubFinder = sfFinder::type('file')->prune('base')->name('*'.$builderOptions['suffix']); - $before = $stubFinder->in($config['models_path']); - - $schema = $this->prepareSchemaFile($config['yaml_schema_path']); - - $import = new Doctrine_Import_Schema(); - $import->setOptions($builderOptions); - $import->importSchema($schema, 'yml', $config['models_path']); - - // markup base classes with magic methods - foreach (sfYaml::load($schema) as $model => $definition) { - $file = sprintf('%s%s/%s/Base%s%s', $config['models_path'], isset($definition['package']) ? '/'.substr($definition['package'], 0, strpos($definition['package'], '.')) : '', $builderOptions['baseClassesDirectory'], $model, $builderOptions['suffix']); - $code = file_get_contents($file); - - // introspect the model without loading the class - if (preg_match_all('/@property (\w+) \$(\w+)/', $code, $matches, PREG_SET_ORDER)) { - $properties = []; - foreach ($matches as $match) { - $properties[$match[2]] = $match[1]; - } - - $typePad = max(array_map('strlen', array_merge(array_values($properties), [$model]))); - $namePad = max(array_map('strlen', array_keys(array_map(['sfInflector', 'camelize'], $properties)))); - $setters = []; - $getters = []; - - foreach ($properties as $name => $type) { - $camelized = sfInflector::camelize($name); - $collection = 'Doctrine_Collection' == $type; - - $getters[] = sprintf('@method %-'.$typePad.'s %s%-'.($namePad + 2).'s Returns the current record\'s "%s" %s', $type, 'get', $camelized.'()', $name, $collection ? 'collection' : 'value'); - $setters[] = sprintf('@method %-'.$typePad.'s %s%-'.($namePad + 2).'s Sets the current record\'s "%s" %s', $model, 'set', $camelized.'()', $name, $collection ? 'collection' : 'value'); - } - - // use the last match as a search string - $code = str_replace($match[0], $match[0].PHP_EOL.' * '.PHP_EOL.' * '.implode(PHP_EOL.' * ', array_merge($getters, $setters)), $code); - file_put_contents($file, $code); - } - } - - $properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true); - $tokens = [ - '##PACKAGE##' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', - '##SUBPACKAGE##' => 'model', - '##NAME##' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', - ' <##EMAIL##>' => '', - "{\n\n}" => "{\n}\n", - ]; - - // cleanup new stub classes - $after = $stubFinder->in($config['models_path']); - $this->getFilesystem()->replaceTokens(array_diff($after, $before), '', '', $tokens); - - // cleanup base classes - $baseFinder = sfFinder::type('file')->name('Base*'.$builderOptions['suffix']); - $baseDirFinder = sfFinder::type('dir')->name('base'); - $this->getFilesystem()->replaceTokens($baseFinder->in($baseDirFinder->in($config['models_path'])), '', '', $tokens); - - $this->reloadAutoload(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSchemaTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSchemaTask.class.php deleted file mode 100644 index 83876652a..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSchemaTask.class.php +++ /dev/null @@ -1,55 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Creates a schema.yml from an existing database. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineBuildSchemaTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build-schema'; - $this->briefDescription = 'Creates a schema from an existing database'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-schema|INFO] task introspects a database to create a schema: - - [./symfony doctrine:build-schema|INFO] - -The task creates a yml file in [config/doctrine|COMMENT] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'generating yaml schema from database'); - - $databaseManager = new sfDatabaseManager($this->configuration); - $this->callDoctrineCli('generate-yaml-db'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSqlTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSqlTask.class.php deleted file mode 100644 index a0775011c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildSqlTask.class.php +++ /dev/null @@ -1,62 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Create SQL for the current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineBuildSqlTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build-sql'; - $this->briefDescription = 'Creates SQL for the current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build-sql|INFO] task creates SQL statements for table creation: - - [./symfony doctrine:build-sql|INFO] - -The generated SQL is optimized for the database configured in [config/databases.yml|COMMENT]: - - [doctrine.database = mysql|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'generating sql for models'); - - $path = sfConfig::get('sf_data_dir').'/sql'; - if (!is_dir($path)) { - $this->getFilesystem()->mkdirs($path); - } - - $databaseManager = new sfDatabaseManager($this->configuration); - $this->callDoctrineCli('generate-sql'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php deleted file mode 100644 index c4093f96c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildTask.class.php +++ /dev/null @@ -1,276 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generates code based on your schema. - * - * @author Kris Wallsmith - */ -class sfDoctrineBuildTask extends sfDoctrineBaseTask -{ - public const BUILD_MODEL = 1; - public const BUILD_FORMS = 2; - public const BUILD_FILTERS = 4; - public const BUILD_SQL = 8; - public const BUILD_DB = 16; - // model, forms - public const OPTION_MODEL = 1; - public const OPTION_FORMS = 3; - // model, filters - public const OPTION_FILTERS = 5; - // model, sql - public const OPTION_SQL = 9; - // model, sql, db - public const OPTION_DB = 25; - // model, forms, filters - public const OPTION_ALL_CLASSES = 7; - // model, forms, filters, sql, db - public const OPTION_ALL = 31; - - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Whether to force dropping of the database'), - new sfCommandOption('all', null, sfCommandOption::PARAMETER_NONE, 'Build everything and reset the database'), - new sfCommandOption('all-classes', null, sfCommandOption::PARAMETER_NONE, 'Build all classes'), - new sfCommandOption('model', null, sfCommandOption::PARAMETER_NONE, 'Build model classes'), - new sfCommandOption('forms', null, sfCommandOption::PARAMETER_NONE, 'Build form classes'), - new sfCommandOption('filters', null, sfCommandOption::PARAMETER_NONE, 'Build filter classes'), - new sfCommandOption('sql', null, sfCommandOption::PARAMETER_NONE, 'Build SQL'), - new sfCommandOption('db', null, sfCommandOption::PARAMETER_NONE, 'Drop, create, and either insert SQL or migrate the database'), - new sfCommandOption('and-migrate', null, sfCommandOption::PARAMETER_NONE, 'Migrate the database'), - new sfCommandOption('and-load', null, sfCommandOption::PARAMETER_OPTIONAL | sfCommandOption::IS_ARRAY, 'Load fixture data'), - new sfCommandOption('and-append', null, sfCommandOption::PARAMETER_OPTIONAL | sfCommandOption::IS_ARRAY, 'Append fixture data'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'build'; - - $this->briefDescription = 'Generate code based on your schema'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:build|INFO] task generates code based on your schema: - - [./symfony doctrine:build|INFO] - -You must specify what you would like built. For instance, if you want model -and form classes built use the [--model|COMMENT] and [--forms|COMMENT] options: - - [./symfony doctrine:build --model --forms|INFO] - -You can use the [--all|COMMENT] shortcut option if you would like all classes and -SQL files generated and the database rebuilt: - - [./symfony doctrine:build --all|INFO] - -This is equivalent to running the following tasks: - - [./symfony doctrine:drop-db|INFO] - [./symfony doctrine:build-db|INFO] - [./symfony doctrine:build-model|INFO] - [./symfony doctrine:build-forms|INFO] - [./symfony doctrine:build-filters|INFO] - [./symfony doctrine:build-sql|INFO] - [./symfony doctrine:insert-sql|INFO] - -You can also generate only class files by using the [--all-classes|COMMENT] shortcut -option. When this option is used alone, the database will not be modified. - - [./symfony doctrine:build --all-classes|INFO] - -The [--and-migrate|COMMENT] option will run any pending migrations once the builds -are complete: - - [./symfony doctrine:build --db --and-migrate|INFO] - -The [--and-load|COMMENT] option will load data from the project and plugin -[data/fixtures/|COMMENT] directories: - - [./symfony doctrine:build --db --and-migrate --and-load|INFO] - -To specify what fixtures are loaded, add a parameter to the [--and-load|COMMENT] option: - - [./symfony doctrine:build --all --and-load="data/fixtures/dev/"|INFO] - -To append fixture data without erasing any records from the database, include -the [--and-append|COMMENT] option: - - [./symfony doctrine:build --all --and-append|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - if (!$mode = $this->calculateMode($options)) { - throw new InvalidArgumentException(sprintf("You must include one or more of the following build options:\n--%s\n\nSee this task's help page for more information:\n\n php symfony help doctrine:build", join(', --', array_keys($this->getBuildOptions())))); - } - - if (self::BUILD_DB == (self::BUILD_DB & $mode)) { - $task = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run([], ['no-confirmation' => $options['no-confirmation']]); - - if ($ret) { - return $ret; - } - - $task = new sfDoctrineBuildDbTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - - // :insert-sql (or :migrate) will also be run, below - } - - if (self::BUILD_MODEL == (self::BUILD_MODEL & $mode)) { - $task = new sfDoctrineBuildModelTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } - - if (self::BUILD_FORMS == (self::BUILD_FORMS & $mode)) { - $task = new sfDoctrineBuildFormsTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } - - if (self::BUILD_FILTERS == (self::BUILD_FILTERS & $mode)) { - $task = new sfDoctrineBuildFiltersTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } - - if (self::BUILD_SQL == (self::BUILD_SQL & $mode)) { - $task = new sfDoctrineBuildSqlTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } - - if ($options['and-migrate']) { - $task = new sfDoctrineMigrateTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } elseif (self::BUILD_DB == (self::BUILD_DB & $mode)) { - $task = new sfDoctrineInsertSqlTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - $ret = $task->run(); - - if ($ret) { - return $ret; - } - } - - if (count($options['and-load']) || count($options['and-append'])) { - $task = new sfDoctrineDataLoadTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - - if (count($options['and-load'])) { - $ret = $task->run([ - 'dir_or_file' => in_array([], $options['and-load'], true) ? null : $options['and-load'], - ]); - - if ($ret) { - return $ret; - } - } - - if (count($options['and-append'])) { - $ret = $task->run([ - 'dir_or_file' => in_array([], $options['and-append'], true) ? null : $options['and-append'], - ], [ - 'append' => true, - ]); - - if ($ret) { - return $ret; - } - } - } - } - - /** - * Calculates a bit mode based on the supplied options. - * - * @param array $options - * - * @return int - */ - protected function calculateMode($options = []) - { - $mode = 0; - foreach ($this->getBuildOptions() as $name => $value) { - if (isset($options[$name]) && true === $options[$name]) { - $mode = $mode | $value; - } - } - - return $mode; - } - - /** - * Returns an array of valid build options. - * - * @return array An array of option names and their mode - */ - protected function getBuildOptions() - { - $options = []; - foreach ($this->options as $option) { - if (defined($constant = __CLASS__.'::OPTION_'.str_replace('-', '_', strtoupper($option->getName())))) { - $options[$option->getName()] = constant($constant); - } - } - - return $options; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCleanModelFilesTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCleanModelFilesTask.class.php deleted file mode 100644 index 6f8f11842..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCleanModelFilesTask.class.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Delete all generated model classes for models which no longer exist in your YAML schema. - * - * @author Jonathan H. Wage - */ -class sfDoctrineCleanModelFilesTask extends sfDoctrineBaseTask -{ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'), - ]); - - $this->aliases = ['doctrine:clean']; - $this->namespace = 'doctrine'; - $this->name = 'clean-model-files'; - $this->briefDescription = 'Delete all generated model classes for models which no longer exist in your YAML schema'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:clean-model-files|INFO] task deletes model classes that are not -represented in project or plugin schema.yml files: - - [./symfony doctrine:clean-model-files|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $config = $this->getCliConfig(); - $changed = false; - - $deleteModelFiles = new sfDoctrineDeleteModelFilesTask($this->dispatcher, $this->formatter); - $deleteModelFiles->setCommandApplication($this->commandApplication); - $deleteModelFiles->setConfiguration($this->configuration); - - $yamlSchema = $this->getYamlSchema($config['yaml_schema_path']); - - // remove any models present in the filesystem but not in the yaml schema - if ($modelsToRemove = array_diff($this->getFileModels($config['models_path']), array_keys($yamlSchema))) { - $deleteModelFiles->run($modelsToRemove, ['no-confirmation' => $options['no-confirmation']]); - $changed = true; - } - - // remove form classes whose generation is disabled - foreach ($yamlSchema as $model => $definition) { - if (isset($definition['options']['symfony']['form']) && !$definition['options']['symfony']['form'] && class_exists($model.'Form')) { - $deleteModelFiles->run([$model], ['suffix' => ['Form'], 'no-confirmation' => $options['no-confirmation']]); - $changed = true; - } - - if (isset($definition['options']['symfony']['filter']) && !$definition['options']['symfony']['filter'] && class_exists($model.'FormFilter')) { - $deleteModelFiles->run([$model], ['suffix' => ['FormFilter'], 'no-confirmation' => $options['no-confirmation']]); - $changed = true; - } - } - - if ($changed) { - $this->reloadAutoload(); - } else { - $this->logSection('doctrine', 'Could not find any files that need to be removed'); - } - } - - /** - * Returns models defined in YAML. - * - * @return array - */ - protected function getYamlModels($yamlSchemaPath) - { - return array_keys($this->getYamlSchema($yamlSchemaPath)); - } - - /** - * Returns the schema as defined in YAML. - * - * @return array - */ - protected function getYamlSchema($yamlSchemaPath) - { - return (array) sfYaml::load($this->prepareSchemaFile($yamlSchemaPath)); - } - - /** - * Returns models that have class files. - * - * @return array - */ - protected function getFileModels($modelsPath) - { - Doctrine_Core::loadModels($modelsPath); - - return Doctrine_Core::getLoadedModels(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php deleted file mode 100644 index 861a7e080..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCompileTask.class.php +++ /dev/null @@ -1,75 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Compile Doctrine. - * - * @author Jerome Tamarelle - */ -class sfDoctrineCompileTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('database', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY, 'A specific database'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Whether to force dropping of the database'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'compile'; - $this->briefDescription = 'Compile doctrine into the cache directory'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:compile|INFO] task generated a compiled Doctrine file: - - [./symfony doctrine:compile|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - $compiledFile = sfConfig::get('sf_cache_dir').'/doctrine.compiled.php'; - - if (file_exists($compiledFile)) { - $this->logSection('error', $compiledFile.' already exists', null, 'ERROR'); - $this->logBlock('Run symfony:cache-clear first', 'INFO'); - - return; - } - - $drivers = []; - foreach ($databaseManager->getNames() as $name) { - $drivers[] = strtolower($databaseManager->getDatabase($name)->getDoctrineConnection()->getDriverName()); - } - $drivers = array_unique($drivers); - - $this->logSection('compile', 'Included drivers: '.implode(', ', $drivers)); - - Doctrine_Core::compile($compiledFile, $drivers); - - $this->logSection('file+', $compiledFile); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php deleted file mode 100644 index b5b3571b2..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * Configures the database connection. - * - * @author Fabien Potencier - */ -class sfDoctrineConfigureDatabaseTask extends sfBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('dsn', sfCommandArgument::REQUIRED, 'The database dsn'), - new sfCommandArgument('username', sfCommandArgument::OPTIONAL, 'The database username', 'root'), - new sfCommandArgument('password', sfCommandArgument::OPTIONAL, 'The database password'), - ]); - - $this->addOptions([ - new sfCommandOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'The environment', 'all'), - new sfCommandOption('name', null, sfCommandOption::PARAMETER_OPTIONAL, 'The connection name', 'doctrine'), - new sfCommandOption('class', null, sfCommandOption::PARAMETER_OPTIONAL, 'The database class name', 'sfDoctrineDatabase'), - new sfCommandOption('app', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', null), - ]); - - $this->namespace = 'configure'; - $this->name = 'database'; - - $this->briefDescription = 'Configure database DSN'; - - $this->detailedDescription = <<<'EOF' -The [configure:database|INFO] task configures the database DSN -for a project: - - [./symfony configure:database mysql:host=localhost;dbname=example root mYsEcret|INFO] - -By default, the task change the configuration for all environment. If you want -to change the dsn for a specific environment, use the [env|COMMENT] option: - - [./symfony configure:database --env=dev mysql:host=localhost;dbname=example_dev root mYsEcret|INFO] - -To change the configuration for a specific application, use the [app|COMMENT] option: - - [./symfony configure:database --app=frontend mysql:host=localhost;dbname=example root mYsEcret|INFO] - -You can also specify the connection name and the database class name: - - [./symfony configure:database --name=main --class=ProjectDatabase mysql:host=localhost;dbname=example root mYsEcret|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - // update databases.yml - if (null !== $options['app']) { - $file = sfConfig::get('sf_apps_dir').'/'.$options['app'].'/config/databases.yml'; - } else { - $file = sfConfig::get('sf_config_dir').'/databases.yml'; - } - - $config = file_exists($file) ? sfYaml::load($file) : []; - - $config[$options['env']][$options['name']] = [ - 'class' => $options['class'], - 'param' => array_merge(isset($config[$options['env']][$options['name']]['param']) ? $config[$options['env']][$options['name']]['param'] : [], ['dsn' => $arguments['dsn'], 'username' => $arguments['username'], 'password' => $arguments['password']]), - ]; - - file_put_contents($file, sfYaml::dump($config, 4)); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCreateModelTablesTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCreateModelTablesTask.class.php deleted file mode 100644 index c5416d35c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineCreateModelTablesTask.class.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Create tables for specified list of models. - * - * @author Jonathan H. Wage - */ -class sfDoctrineCreateModelTables extends sfDoctrineBaseTask -{ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('models', sfCommandArgument::IS_ARRAY, 'The list of models', []), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', 'frontend'), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('skip-build', null, sfCommandOption::PARAMETER_NONE, 'Skip the doctrine:build-model task.'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'create-model-tables'; - $this->briefDescription = 'Drop and recreate tables for specified models.'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:create-model-tables|INFO] Drop and recreate tables for specified models: - - [./symfony doctrine:create-model-tables User|INFO] -EOF; - } - - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - if (!$options['skip-build']) { - $buildModel = new sfDoctrineBuildModelTask($this->dispatcher, $this->formatter); - $buildModel->setCommandApplication($this->commandApplication); - $buildModel->setConfiguration($this->configuration); - $buildModel->run(); - } - - $connections = []; - $models = $arguments['models']; - foreach ($models as $key => $model) { - $model = trim($model); - $conn = Doctrine_Core::getTable($model)->getConnection(); - $connections[$conn->getName()][] = $model; - } - - foreach ($connections as $name => $models) { - $this->logSection('doctrine', 'dropping model tables for connection "'.$name.'"'); - - $conn = Doctrine_Manager::getInstance()->getConnection($name); - $models = $conn->unitOfWork->buildFlushTree($models); - $models = array_reverse($models); - - foreach ($models as $model) { - $tableName = Doctrine_Core::getTable($model)->getOption('tableName'); - - $this->logSection('doctrine', 'dropping table "'.$tableName.'"'); - - try { - $conn->export->dropTable($tableName); - } catch (Exception $e) { - $this->logSection('doctrine', 'dropping table failed: '.$e->getMessage()); - } - } - - $this->logSection('doctrine', 'recreating tables for models'); - - Doctrine_Core::createTablesFromArray($models); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataDumpTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataDumpTask.class.php deleted file mode 100644 index e51309309..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataDumpTask.class.php +++ /dev/null @@ -1,85 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Dumps data to the fixtures directory. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineDataDumpTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('target', sfCommandArgument::OPTIONAL, 'The target filename'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'data-dump'; - $this->briefDescription = 'Dumps data to the fixtures directory'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:data-dump|INFO] task dumps database data: - - [./symfony doctrine:data-dump|INFO] - -The task dumps the database data in [data/fixtures/%target%|COMMENT]. - -The dump file is in the YML format and can be reimported by using -the [doctrine:data-load|INFO] task. - - [./symfony doctrine:data-load|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - $args = [ - 'data_fixtures_path' => $config['data_fixtures_path'][0], - ]; - - if (!is_dir($args['data_fixtures_path'])) { - $this->getFilesystem()->mkdirs($args['data_fixtures_path']); - } - - if ($arguments['target']) { - $filename = $arguments['target']; - - if (!sfToolkit::isPathAbsolute($filename)) { - $filename = $args['data_fixtures_path'].'/'.$filename; - } - - $this->getFilesystem()->mkdirs(dirname($filename)); - - $args['data_fixtures_path'] = $filename; - } - - $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $args['data_fixtures_path'])); - $this->callDoctrineCli('dump-data', $args); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataLoadTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataLoadTask.class.php deleted file mode 100644 index 0348a9302..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDataLoadTask.class.php +++ /dev/null @@ -1,86 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Loads YAML fixture data. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineDataLoadTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('dir_or_file', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY, 'Directory or file to load'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('append', null, sfCommandOption::PARAMETER_NONE, 'Don\'t delete current data in the database'), - new sfCommandOption('charset', null, sfCommandOption::PARAMETER_OPTIONAL, 'Specify charset'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'data-load'; - $this->briefDescription = 'Loads YAML fixture data'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:data-load|INFO] task loads data fixtures into the database: - - [./symfony doctrine:data-load|INFO] - -The task loads data from all the files found in [data/fixtures/|COMMENT]. - -If you want to load data from specific files or directories, you can append -them as arguments: - - [./symfony doctrine:data-load data/fixtures/dev data/fixtures/users.yml|INFO] - -If you don't want the task to remove existing data in the database, -use the [--append|COMMENT] option: - - [./symfony doctrine:data-load --append|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - if (!count($arguments['dir_or_file'])) { - // pull default from CLI config array - $config = $this->getCliConfig(); - $arguments['dir_or_file'] = $config['data_fixtures_path']; - } - - $doctrineArguments = [ - 'data_fixtures_path' => $arguments['dir_or_file'], - 'append' => $options['append'], - 'charset' => $options['charset'], - ]; - - foreach ($arguments['dir_or_file'] as $target) { - $this->logSection('doctrine', sprintf('Loading data fixtures from "%s"', $target)); - } - - $this->callDoctrineCli('load-data', $doctrineArguments); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDeleteModelFilesTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDeleteModelFilesTask.class.php deleted file mode 100644 index b1955da6b..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDeleteModelFilesTask.class.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Delete all generated files associated with a Doctrine model. Forms, filters, etc. - * - * @author Jonathan H. Wage - */ -class sfDoctrineDeleteModelFilesTask extends sfDoctrineBaseTask -{ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('name', sfCommandArgument::REQUIRED | sfCommandArgument::IS_ARRAY, 'The name of the model you wish to delete all related files for.'), - ]); - - $this->addOptions([ - new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Do not ask for confirmation'), - new sfCommandOption('prefix', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Class prefix to remove'), - new sfCommandOption('suffix', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Class suffix to remove'), - new sfCommandOption('extension', null, sfCommandOption::PARAMETER_REQUIRED | sfCommandOption::IS_ARRAY, 'Filename extension to remove'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'delete-model-files'; - $this->briefDescription = 'Delete all the related auto generated files for a given model name.'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:delete-model-files|INFO] task deletes all files associated with certain -models: - - [./symfony doctrine:delete-model-files Article Author|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $paths = array_merge( - [ - sfConfig::get('sf_lib_dir').'/model/doctrine', - sfConfig::get('sf_lib_dir').'/form/doctrine', - sfConfig::get('sf_lib_dir').'/filter/doctrine', - ], - $this->configuration->getPluginSubPaths('/lib/model/doctrine'), - $this->configuration->getPluginSubPaths('/lib/form/doctrine'), - $this->configuration->getPluginSubPaths('/lib/filter/doctrine') - ); - - $prefixPattern = $this->valuesToRegex($options['prefix'] ? $options['prefix'] : ['', 'Base', 'Plugin']); - $suffixPattern = $this->valuesToRegex($options['suffix'] ? $options['suffix'] : ['', 'Table', 'Form', 'FormFilter']); - $extensionPattern = $this->valuesToRegex($options['extension'] ? $options['extension'] : ['.php', '.class.php']); - - $total = 0; - - foreach ($arguments['name'] as $modelName) { - $finder = sfFinder::type('file')->name('/^'.$prefixPattern.$modelName.$suffixPattern.$extensionPattern.'$/'); - $files = $finder->in($paths); - - if ($files) { - if (!$options['no-confirmation'] && !$this->askConfirmation(array_merge( - ['The following '.$modelName.' files will be deleted:', ''], - array_map(function ($v) { return ' - '.sfDebug::shortenFilePath($v); }, $files), - ['', 'Continue? (y/N)'] - ), 'QUESTION_LARGE', false)) { - $this->logSection('doctrine', 'Aborting delete of "'.$modelName.'" files'); - - continue; - } - - $this->logSection('doctrine', 'Deleting "'.$modelName.'" files'); - $this->getFilesystem()->remove($files); - - $total += count($files); - } else { - $this->logSection('doctrine', 'No files found for the model named "'.$modelName.'"'); - } - } - - $this->logSection('doctrine', 'Deleted a total of '.$total.' file(s)'); - } - - /** - * Converts an array of values to a regular expression pattern fragment. - * - * @param array $values An array of values for the pattern - * @param string $delimiter The regular expression delimiter - * - * @return string A regular expression fragment - */ - protected function valuesToRegex($values, $delimiter = '/') - { - if (false !== $pos = array_search('', $values)) { - $required = false; - unset($values[$pos]); - } else { - $required = true; - } - - if (count($values)) { - $regex = '('; - foreach ($values as $i => $value) { - $regex .= preg_quote($value, $delimiter); - if (isset($values[$i + 1])) { - $regex .= '|'; - } - } - $regex .= ')'; - - if (!$required) { - $regex .= '?'; - } - - return $regex; - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php deleted file mode 100644 index 66d717bfe..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php +++ /dev/null @@ -1,158 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Creates database for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineDqlTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('dql_query', sfCommandArgument::REQUIRED, 'The DQL query to execute', null), - new sfCommandArgument('parameter', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY, 'Query parameter'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('show-sql', null, sfCommandOption::PARAMETER_NONE, 'Show the sql that would be executed'), - new sfCommandOption('table', null, sfCommandOption::PARAMETER_NONE, 'Return results in table format'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'dql'; - $this->briefDescription = 'Execute a DQL query and view the results'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:dql|INFO] task executes a DQL query and displays the formatted -results: - - [./symfony doctrine:dql "FROM User"|INFO] - -You can show the SQL that would be executed by using the [--show-sql|COMMENT] option: - - [./symfony doctrine:dql --show-sql "FROM User"|INFO] - -Provide query parameters as additional arguments: - - [./symfony doctrine:dql "FROM User WHERE email LIKE ?" "%symfony-project.com"|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - $dql = $arguments['dql_query']; - - $q = Doctrine_Query::create() - ->parseDqlQuery($dql) - ; - - $this->logSection('doctrine', 'executing dql query'); - $this->log(sprintf('DQL: %s', $dql)); - - if ($options['show-sql']) { - $this->log(sprintf('SQL: %s', $q->getSqlQuery($arguments['parameter']))); - } - - $count = $q->count($arguments['parameter']); - - if ($count) { - if (!$options['table']) { - $results = $q->fetchArray($arguments['parameter']); - - $this->log([ - sprintf('found %s results', number_format($count)), - sfYaml::dump($results, 4), - ]); - } else { - $results = $q->execute($arguments['parameter'], Doctrine_Core::HYDRATE_SCALAR); - - $headers = []; - - // calculate lengths - foreach ($results as $result) { - foreach ($result as $field => $value) { - if (!isset($headers[$field])) { - $headers[$field] = 0; - } - - $headers[$field] = max($headers[$field], strlen($this->renderValue($value))); - } - } - - // print header - $hdr = '|'; - $div = '+'; - - foreach ($headers as $field => &$length) { - if ($length < strlen($field)) { - $length = strlen($field); - } - - $hdr .= ' '.str_pad($field, $length).' |'; - $div .= str_repeat('-', $length + 2).'+'; - } - - $this->log([$div, $hdr, $div]); - - // print results - foreach ($results as $result) { - $line = '|'; - foreach ($result as $field => $value) { - $line .= ' '.str_pad($this->renderValue($value), $headers[$field]).' |'; - } - $this->log($line); - } - - $this->log($div); - - // find profiler - if ($profiler = $q->getConnection()->getListener()->get('symfony_profiler')) { - $events = $profiler->getQueryExecutionEvents(); - $event = array_pop($events); - $this->log(sprintf('%s results (%s sec)', number_format($count), number_format($event->getElapsedSecs(), 2))); - } else { - $this->log(sprintf('%s results', number_format($count))); - } - - $this->log(''); - } - } else { - $this->logSection('doctrine', 'no results found'); - } - } - - /** - * Renders the supplied value. - * - * @param string|null $value - * - * @return string - */ - protected function renderValue($value) - { - return null === $value ? 'NULL' : $value; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDropDbTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDropDbTask.class.php deleted file mode 100644 index 079467c6e..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDropDbTask.class.php +++ /dev/null @@ -1,91 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Drops database for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineDropDbTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('database', sfCommandArgument::OPTIONAL | sfCommandArgument::IS_ARRAY, 'A specific database'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('no-confirmation', null, sfCommandOption::PARAMETER_NONE, 'Whether to force dropping of the database'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'drop-db'; - $this->briefDescription = 'Drops database for current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:drop-db|INFO] task drops one or more databases based on -configuration in [config/databases.yml|COMMENT]: - - [./symfony doctrine:drop-db|INFO] - -You will be prompted for confirmation before any databases are dropped unless -you provide the [--no-confirmation|COMMENT] option: - - [./symfony doctrine:drop-db --no-confirmation|INFO] - -You can specify what databases to drop by providing their names: - - [./symfony doctrine:drop-db slave1 slave2|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $databases = $this->getDoctrineDatabases($databaseManager, count($arguments['database']) ? $arguments['database'] : null); - - $environment = $this->configuration instanceof sfApplicationConfiguration ? $this->configuration->getEnvironment() : 'all'; - - if ( - !$options['no-confirmation'] - && !$this->askConfirmation(array_merge( - [sprintf('This command will remove all data in the following "%s" connection(s):', $environment), ''], - array_map(function ($v) { return ' - '.$v; }, array_keys($databases)), - ['', 'Are you sure you want to proceed? (y/N)'] - ), 'QUESTION_LARGE', false) - ) { - $this->logSection('doctrine', 'task aborted'); - - return 1; - } - - foreach ($databases as $name => $database) { - $this->logSection('doctrine', sprintf('Dropping "%s" database', $name)); - - try { - $database->getDoctrineConnection()->dropDatabase(); - } catch (Exception $e) { - $this->logSection('doctrine', $e->getMessage(), null, 'ERROR'); - } - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php deleted file mode 100644 index d027b64ef..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php +++ /dev/null @@ -1,201 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generates a Doctrine admin module. - * - * @author Fabien Potencier - */ -class sfDoctrineGenerateAdminTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), - new sfCommandArgument('route_or_model', sfCommandArgument::REQUIRED, 'The route name or the model class'), - ]); - - $this->addOptions([ - new sfCommandOption('module', null, sfCommandOption::PARAMETER_REQUIRED, 'The module name', null), - new sfCommandOption('theme', null, sfCommandOption::PARAMETER_REQUIRED, 'The theme name', 'admin'), - new sfCommandOption('singular', null, sfCommandOption::PARAMETER_REQUIRED, 'The singular name', null), - new sfCommandOption('plural', null, sfCommandOption::PARAMETER_REQUIRED, 'The plural name', null), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('actions-base-class', null, sfCommandOption::PARAMETER_REQUIRED, 'The base class for the actions', 'sfActions'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-admin'; - $this->briefDescription = 'Generates a Doctrine admin module'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-admin|INFO] task generates a Doctrine admin module: - - [./symfony doctrine:generate-admin frontend Article|INFO] - -The task creates a module in the [%frontend%|COMMENT] application for the -[%Article%|COMMENT] model. - -The task creates a route for you in the application [routing.yml|COMMENT]. - -You can also generate a Doctrine admin module by passing a route name: - - [./symfony doctrine:generate-admin frontend article|INFO] - -The task creates a module in the [%frontend%|COMMENT] application for the -[%article%|COMMENT] route definition found in [routing.yml|COMMENT]. - -For the filters and batch actions to work properly, you need to add -the [with_wildcard_routes|COMMENT] option to the route: - - article: - class: sfDoctrineRouteCollection - options: - model: Article - with_wildcard_routes: true -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - // get configuration for the given route - if (false !== ($route = $this->getRouteFromName($arguments['route_or_model']))) { - $arguments['route'] = $route; - $arguments['route_name'] = $arguments['route_or_model']; - - return $this->generateForRoute($arguments, $options); - } - - // is it a model class name - if (!class_exists($arguments['route_or_model'])) { - throw new sfCommandException(sprintf('The route "%s" does not exist and there is no "%s" class.', $arguments['route_or_model'], $arguments['route_or_model'])); - } - - $r = new ReflectionClass($arguments['route_or_model']); - if (!$r->isSubclassOf('Doctrine_Record')) { - throw new sfCommandException(sprintf('"%s" is not a Doctrine class.', $arguments['route_or_model'])); - } - - // create a route - $model = $arguments['route_or_model']; - $name = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $model)); - - if (isset($options['module'])) { - $route = $this->getRouteFromName($name); - if ($route && !$this->checkRoute($route, $model, $options['module'])) { - $name .= '_'.$options['module']; - } - } - - $routing = sfConfig::get('sf_app_config_dir').'/routing.yml'; - $content = file_get_contents($routing); - $routesArray = sfYaml::load($content); - - if (!isset($routesArray[$name])) { - $databaseManager = new sfDatabaseManager($this->configuration); - $primaryKey = Doctrine_Core::getTable($model)->getIdentifier(); - $module = $options['module'] ? $options['module'] : $name; - $content = sprintf(<<<'EOF' -%s: - class: sfDoctrineRouteCollection - options: - model: %s - module: %s - prefix_path: /%s - column: %s - with_wildcard_routes: true - - -EOF - , $name, $model, $module, isset($options['plural']) ? $options['plural'] : $module, $primaryKey).$content; - - $this->logSection('file+', $routing); - - if (false === file_put_contents($routing, $content)) { - throw new sfCommandException(sprintf('Unable to write to file, %s.', $routing)); - } - } - - $arguments['route'] = $this->getRouteFromName($name); - $arguments['route_name'] = $name; - - return $this->generateForRoute($arguments, $options); - } - - protected function generateForRoute($arguments, $options) - { - $routeOptions = $arguments['route']->getOptions(); - - if (!$arguments['route'] instanceof sfDoctrineRouteCollection) { - throw new sfCommandException(sprintf('The route "%s" is not a Doctrine collection route.', $arguments['route_name'])); - } - - $module = $routeOptions['module']; - $model = $routeOptions['model']; - - // execute the doctrine:generate-module task - $task = new sfDoctrineGenerateModuleTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - - $this->logSection('app', sprintf('Generating admin module "%s" for model "%s"', $module, $model)); - - return $task->run([$arguments['application'], $module, $model], [ - 'theme' => $options['theme'], - 'route-prefix' => $routeOptions['name'], - 'with-doctrine-route' => true, - 'generate-in-cache' => true, - 'non-verbose-templates' => true, - 'singular' => $options['singular'], - 'plural' => $options['plural'], - 'actions-base-class' => $options['actions-base-class'], - ]); - } - - protected function getRouteFromName($name) - { - $config = new sfRoutingConfigHandler(); - $routes = $config->evaluate($this->configuration->getConfigPaths('config/routing.yml')); - - if (isset($routes[$name])) { - return $routes[$name]; - } - - return false; - } - - /** - * Checks whether a route references a model and module. - * - * @param mixed $route A route collection - * @param string $model A model name - * @param string $module A module name - * - * @return bool - */ - protected function checkRoute($route, $model, $module) - { - if ($route instanceof sfDoctrineRouteCollection) { - $options = $route->getOptions(); - - return $model == $options['model'] && $module == $options['module']; - } - - return false; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationTask.class.php deleted file mode 100644 index 8c18df473..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationTask.class.php +++ /dev/null @@ -1,86 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Inserts SQL for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineGenerateMigrationTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('name', sfCommandArgument::REQUIRED, 'The name of the migration'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('editor-cmd', null, sfCommandOption::PARAMETER_REQUIRED, 'Open script with this command upon creation'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-migration'; - $this->briefDescription = 'Generate migration class'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-migration|INFO] task generates migration template - - [./symfony doctrine:generate-migration AddUserEmailColumn|INFO] - -You can provide an [--editor-cmd|COMMENT] option to open the new migration class in your -editor of choice upon creation: - - [./symfony doctrine:generate-migration AddUserEmailColumn --editor-cmd=mate|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - $this->logSection('doctrine', sprintf('generating migration class named "%s"', $arguments['name'])); - - if (!is_dir($config['migrations_path'])) { - $this->getFilesystem()->mkdirs($config['migrations_path']); - } - - $this->callDoctrineCli('generate-migration', ['name' => $arguments['name']]); - - $finder = sfFinder::type('file')->sort_by_name()->name('*.php'); - if ($files = $finder->in($config['migrations_path'])) { - $file = array_pop($files); - - $contents = file_get_contents($file); - $contents = strtr(sfToolkit::stripComments($contents), [ - "{\n\n" => "{\n", - "\n}" => "\n}\n", - ' ' => ' ', - ]); - file_put_contents($file, $contents); - - if (isset($options['editor-cmd'])) { - $this->getFilesystem()->execute($options['editor-cmd'].' '.escapeshellarg($file)); - } - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDbTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDbTask.class.php deleted file mode 100644 index 8cacee1df..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDbTask.class.php +++ /dev/null @@ -1,62 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generate migrations from database. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineGenerateMigrationsDbTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-migrations-db'; - $this->briefDescription = 'Generate migration classes from existing database connections'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-migrations-db|INFO] task generates migration classes from -existing database connections: - - [./symfony doctrine:generate-migrations-db|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - $this->logSection('doctrine', 'generating migration classes from database'); - - if (!is_dir($config['migrations_path'])) { - $this->getFilesystem()->mkdirs($config['migrations_path']); - } - - $this->callDoctrineCli('generate-migrations-db', [ - 'yaml_schema_path' => $this->prepareSchemaFile($config['yaml_schema_path']), - ]); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDiffTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDiffTask.class.php deleted file mode 100644 index 2f475af77..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsDiffTask.class.php +++ /dev/null @@ -1,64 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generate migration classes by producing a diff between your old and new schema. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineGenerateMigrationsDiffTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-migrations-diff'; - $this->briefDescription = 'Generate migration classes by producing a diff between your old and new schema.'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-migrations-diff|INFO] task generates migration classes by -producing a diff between your old and new schema. - - [./symfony doctrine:generate-migrations-diff|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - $this->logSection('doctrine', 'generating migration diff'); - - if (!is_dir($config['migrations_path'])) { - $this->getFilesystem()->mkdirs($config['migrations_path']); - } - - spl_autoload_register(['Doctrine_Core', 'modelsAutoload']); - - $this->callDoctrineCli('generate-migrations-diff', [ - 'yaml_schema_path' => $this->prepareSchemaFile($config['yaml_schema_path']), - ]); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsModelsTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsModelsTask.class.php deleted file mode 100644 index 4be5db308..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateMigrationsModelsTask.class.php +++ /dev/null @@ -1,60 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Inserts SQL for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineGenerateMigrationsModelsTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-migrations-models'; - $this->briefDescription = 'Generate migration classes from an existing set of models'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-migrations-models|INFO] task generates migration classes -from an existing set of models: - - [./symfony doctrine:generate-migrations-models|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - $this->logSection('doctrine', 'generating migration classes from models'); - - if (!is_dir($config['migrations_path'])) { - $this->getFilesystem()->mkdirs($config['migrations_path']); - } - - $this->callDoctrineCli('generate-migrations-models'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleForRouteTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleForRouteTask.class.php deleted file mode 100644 index b09c06b2f..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleForRouteTask.class.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generates a Doctrine module for a route definition. - * - * @author Fabien Potencier - */ -class sfDoctrineGenerateModuleForRouteTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), - new sfCommandArgument('route', sfCommandArgument::REQUIRED, 'The route name'), - ]); - - $this->addOptions([ - new sfCommandOption('theme', null, sfCommandOption::PARAMETER_REQUIRED, 'The theme name', 'default'), - new sfCommandOption('non-verbose-templates', null, sfCommandOption::PARAMETER_NONE, 'Generate non verbose templates'), - new sfCommandOption('singular', null, sfCommandOption::PARAMETER_REQUIRED, 'The singular name', null), - new sfCommandOption('plural', null, sfCommandOption::PARAMETER_REQUIRED, 'The plural name', null), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('actions-base-class', null, sfCommandOption::PARAMETER_REQUIRED, 'The base class for the actions', 'sfActions'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-module-for-route'; - $this->briefDescription = 'Generates a Doctrine module for a route definition'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-module-for-route|INFO] task generates a Doctrine module for a route definition: - - [./symfony doctrine:generate-module-for-route frontend article|INFO] - -The task creates a module in the [%frontend%|COMMENT] application for the -[%article%|COMMENT] route definition found in [routing.yml|COMMENT]. -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - // get configuration for the given route - $config = new sfRoutingConfigHandler(); - $routes = $config->evaluate($this->configuration->getConfigPaths('config/routing.yml')); - - if (!isset($routes[$arguments['route']])) { - throw new sfCommandException(sprintf('The route "%s" does not exist.', $arguments['route'])); - } - - $routeOptions = $routes[$arguments['route']]->getOptions(); - - if (!$routes[$arguments['route']] instanceof sfDoctrineRouteCollection) { - throw new sfCommandException(sprintf('The route "%s" is not a Doctrine collection route.', $arguments['route'])); - } - - $module = $routeOptions['module']; - $model = $routeOptions['model']; - - // execute the doctrine:generate-module task - $task = new sfDoctrineGenerateModuleTask($this->dispatcher, $this->formatter); - $task->setCommandApplication($this->commandApplication); - $task->setConfiguration($this->configuration); - - $this->logSection('app', sprintf('Generating module "%s" for model "%s"', $module, $model)); - - return $task->run([$arguments['application'], $module, $model], [ - 'theme' => $options['theme'], - 'route-prefix' => $routeOptions['name'], - 'with-doctrine-route' => true, - 'with-show' => $routeOptions['with_show'], - 'non-verbose-templates' => $options['non-verbose-templates'], - 'singular' => $options['singular'], - 'plural' => $options['plural'], - 'actions-base-class' => $options['actions-base-class'], - ]); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php deleted file mode 100644 index 4643f1452..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php +++ /dev/null @@ -1,210 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Generates a Doctrine module. - * - * @author Fabien Potencier - */ -class sfDoctrineGenerateModuleTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), - new sfCommandArgument('module', sfCommandArgument::REQUIRED, 'The module name'), - new sfCommandArgument('model', sfCommandArgument::REQUIRED, 'The model class name'), - ]); - - $this->addOptions([ - new sfCommandOption('theme', null, sfCommandOption::PARAMETER_REQUIRED, 'The theme name', 'default'), - new sfCommandOption('generate-in-cache', null, sfCommandOption::PARAMETER_NONE, 'Generate the module in cache'), - new sfCommandOption('non-verbose-templates', null, sfCommandOption::PARAMETER_NONE, 'Generate non verbose templates'), - new sfCommandOption('with-show', null, sfCommandOption::PARAMETER_NONE, 'Generate a show method'), - new sfCommandOption('singular', null, sfCommandOption::PARAMETER_REQUIRED, 'The singular name', null), - new sfCommandOption('plural', null, sfCommandOption::PARAMETER_REQUIRED, 'The plural name', null), - new sfCommandOption('route-prefix', null, sfCommandOption::PARAMETER_REQUIRED, 'The route prefix', null), - new sfCommandOption('with-doctrine-route', null, sfCommandOption::PARAMETER_NONE, 'Whether you will use a Doctrine route'), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('actions-base-class', null, sfCommandOption::PARAMETER_REQUIRED, 'The base class for the actions', 'sfActions'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'generate-module'; - $this->briefDescription = 'Generates a Doctrine module'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:generate-module|INFO] task generates a Doctrine module: - - [./symfony doctrine:generate-module frontend article Article|INFO] - -The task creates a [%module%|COMMENT] module in the [%application%|COMMENT] application -for the model class [%model%|COMMENT]. - -You can also create an empty module that inherits its actions and templates from -a runtime generated module in [%sf_app_cache_dir%/modules/auto%module%|COMMENT] by -using the [--generate-in-cache|COMMENT] option: - - [./symfony doctrine:generate-module --generate-in-cache frontend article Article|INFO] - -The generator can use a customized theme by using the [--theme|COMMENT] option: - - [./symfony doctrine:generate-module --theme="custom" frontend article Article|INFO] - -This way, you can create your very own module generator with your own conventions. - -You can also change the default actions base class (default to sfActions) of -the generated modules: - - [./symfony doctrine:generate-module --actions-base-class="ProjectActions" frontend article Article|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - $properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true); - - $this->constants = [ - 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony', - 'APP_NAME' => $arguments['application'], - 'MODULE_NAME' => $arguments['module'], - 'UC_MODULE_NAME' => ucfirst($arguments['module']), - 'MODEL_CLASS' => $arguments['model'], - 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here', - ]; - - $method = $options['generate-in-cache'] ? 'executeInit' : 'executeGenerate'; - - $this->{$method}($arguments, $options); - } - - protected function executeGenerate($arguments = [], $options = []) - { - // generate module - $tmpDir = sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.md5(uniqid(rand(), true)); - $generatorManager = new sfGeneratorManager($this->configuration, $tmpDir); - $generatorManager->generate('sfDoctrineGenerator', [ - 'model_class' => $arguments['model'], - 'moduleName' => $arguments['module'], - 'theme' => $options['theme'], - 'non_verbose_templates' => $options['non-verbose-templates'], - 'with_show' => $options['with-show'], - 'singular' => $options['singular'] ? $options['singular'] : sfInflector::underscore($arguments['model']), - 'plural' => $options['plural'] ? $options['plural'] : sfInflector::underscore($arguments['model'].'s'), - 'route_prefix' => $options['route-prefix'], - 'with_doctrine_route' => $options['with-doctrine-route'], - 'actions_base_class' => $options['actions-base-class'], - ]); - - $moduleDir = sfConfig::get('sf_app_module_dir').'/'.$arguments['module']; - - // copy our generated module - $this->getFilesystem()->mirror($tmpDir.DIRECTORY_SEPARATOR.'auto'.ucfirst($arguments['module']), $moduleDir, sfFinder::type('any')); - - if (!$options['with-show']) { - $this->getFilesystem()->remove($moduleDir.'/templates/showSuccess.php'); - } - - // change module name - $finder = sfFinder::type('file')->name('*.php'); - $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '', '', ['auto'.ucfirst($arguments['module']) => $arguments['module']]); - - // customize php and yml files - $finder = sfFinder::type('file')->name('*.php', '*.yml'); - $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); - - // create basic test - $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'task'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'skeleton'.DIRECTORY_SEPARATOR.'module'.DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR.'actionsTest.php', sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php'); - - // customize test file - $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); - - // delete temp files - $this->getFilesystem()->remove(sfFinder::type('any')->in($tmpDir)); - } - - protected function executeInit($arguments = [], $options = []) - { - $moduleDir = sfConfig::get('sf_app_module_dir').'/'.$arguments['module']; - - // create basic application structure - $finder = sfFinder::type('any')->discard('.sf'); - $dirs = $this->configuration->getGeneratorSkeletonDirs('sfDoctrineModule', $options['theme']); - - foreach ($dirs as $dir) { - if (is_dir($dir)) { - $this->getFilesystem()->mirror($dir, $moduleDir, $finder); - - break; - } - } - - // move configuration file - if (file_exists($config = $moduleDir.'/lib/configuration.php')) { - if (file_exists($target = $moduleDir.'/lib/'.$arguments['module'].'GeneratorConfiguration.class.php')) { - $this->getFilesystem()->remove($config); - } else { - $this->getFilesystem()->rename($config, $target); - } - } - - // move helper file - if (file_exists($config = $moduleDir.'/lib/helper.php')) { - if (file_exists($target = $moduleDir.'/lib/'.$arguments['module'].'GeneratorHelper.class.php')) { - $this->getFilesystem()->remove($config); - } else { - $this->getFilesystem()->rename($config, $target); - } - } - - // create basic test - $this->getFilesystem()->copy(sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'task'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'skeleton'.DIRECTORY_SEPARATOR.'module'.DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR.'actionsTest.php', sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php'); - - // customize test file - $this->getFilesystem()->replaceTokens(sfConfig::get('sf_test_dir').DIRECTORY_SEPARATOR.'functional'.DIRECTORY_SEPARATOR.$arguments['application'].DIRECTORY_SEPARATOR.$arguments['module'].'ActionsTest.php', '##', '##', $this->constants); - - // customize php and yml files - $finder = sfFinder::type('file')->name('*.php', '*.yml'); - $this->constants['CONFIG'] = sprintf( - <<<'EOF' - model_class: %s - theme: %s - non_verbose_templates: %s - with_show: %s - singular: %s - plural: %s - route_prefix: %s - with_doctrine_route: %s - actions_base_class: %s -EOF - , - $arguments['model'], - $options['theme'], - $options['non-verbose-templates'] ? 'true' : 'false', - $options['with-show'] ? 'true' : 'false', - $options['singular'] ? $options['singular'] : '~', - $options['plural'] ? $options['plural'] : '~', - $options['route-prefix'] ? $options['route-prefix'] : '~', - $options['with-doctrine-route'] ? 'true' : 'false', - $options['actions-base-class'] - ); - $this->getFilesystem()->replaceTokens($finder->in($moduleDir), '##', '##', $this->constants); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineInsertSqlTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineInsertSqlTask.class.php deleted file mode 100644 index d6a05c82b..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineInsertSqlTask.class.php +++ /dev/null @@ -1,61 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Inserts SQL for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineInsertSqlTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'insert-sql'; - $this->briefDescription = 'Inserts SQL for current model'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:insert-sql|INFO] task creates database tables: - - [./symfony doctrine:insert-sql|INFO] - -The task connects to the database and creates tables for all the -[lib/model/doctrine/*.class.php|COMMENT] files. -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $this->logSection('doctrine', 'creating tables'); - - $databaseManager = new sfDatabaseManager($this->configuration); - $config = $this->getCliConfig(); - - Doctrine_Core::loadModels($config['models_path'], Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - Doctrine_Core::createTablesFromArray(Doctrine_Core::getLoadedModels()); - - $this->logSection('doctrine', 'created tables successfully'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php deleted file mode 100644 index facbc1e9f..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineMigrateTask.class.php +++ /dev/null @@ -1,127 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -require_once dirname(__FILE__).'/sfDoctrineBaseTask.class.php'; - -/** - * Inserts SQL for current model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfDoctrineMigrateTask extends sfDoctrineBaseTask -{ - /** - * @see sfTask - */ - protected function configure() - { - $this->addArguments([ - new sfCommandArgument('version', sfCommandArgument::OPTIONAL, 'The version to migrate to'), - ]); - - $this->addOptions([ - new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application name', true), - new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), - new sfCommandOption('up', null, sfCommandOption::PARAMETER_NONE, 'Migrate up one version'), - new sfCommandOption('down', null, sfCommandOption::PARAMETER_NONE, 'Migrate down one version'), - new sfCommandOption('dry-run', null, sfCommandOption::PARAMETER_NONE, 'Do not persist migrations'), - ]); - - $this->namespace = 'doctrine'; - $this->name = 'migrate'; - $this->briefDescription = 'Migrates database to current/specified version'; - - $this->detailedDescription = <<<'EOF' -The [doctrine:migrate|INFO] task migrates the database: - - [./symfony doctrine:migrate|INFO] - -Provide a version argument to migrate to a specific version: - - [./symfony doctrine:migrate 10|INFO] - -To migration up or down one migration, use the [--up|COMMENT] or [--down|COMMENT] options: - - [./symfony doctrine:migrate --down|INFO] - -If your database supports rolling back DDL statements, you can run migrations -in dry-run mode using the [--dry-run|COMMENT] option: - - [./symfony doctrine:migrate --dry-run|INFO] -EOF; - } - - /** - * @see sfTask - */ - protected function execute($arguments = [], $options = []) - { - $databaseManager = new sfDatabaseManager($this->configuration); - - $config = $this->getCliConfig(); - $migration = new Doctrine_Migration($config['migrations_path']); - $from = $migration->getCurrentVersion(); - - if (is_numeric($arguments['version'])) { - $version = $arguments['version']; - } elseif ($options['up']) { - $version = $from + 1; - } elseif ($options['down']) { - $version = $from - 1; - } else { - $version = $migration->getLatestVersion(); - } - - if ($from == $version) { - $this->logSection('doctrine', sprintf('Already at migration version %s', $version)); - - return; - } - - $this->logSection('doctrine', sprintf('Migrating from version %s to %s%s', $from, $version, $options['dry-run'] ? ' (dry run)' : '')); - - try { - $migration_classes = $migration->getMigrationClasses(); - if ($version < $from) { - for ($i = (int) $from - 1; $i >= (int) $version; --$i) { - $this->logSection('doctrine', 'executing migration : '.$i.', class: '.$migration_classes[$i]); - $migration->migrate($i, $options['dry-run']); - } - } else { - for ($i = (int) $from + 1; $i <= (int) $version; ++$i) { - $this->logSection('doctrine', 'executing migration : '.$i.', class: '.$migration_classes[$i]); - $migration->migrate($i, $options['dry-run']); - } - } - } catch (Exception $e) { - } - - // render errors - if ($migration->hasErrors()) { - if ($this->commandApplication && $this->commandApplication->withTrace()) { - $this->logSection('doctrine', 'The following errors occurred:'); - foreach ($migration->getErrors() as $error) { - $this->commandApplication->renderException($error); - } - } else { - $this->logBlock(array_merge( - ['The following errors occurred:', ''], - array_map(function ($e) { return ' - '.$e->getMessage(); }, $migration->getErrors()) - ), 'ERROR_LARGE'); - } - - return 1; - } - - $this->logSection('doctrine', 'Migration complete'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php deleted file mode 100644 index 0fd637bc4..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/test/sfTesterDoctrine.class.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfTesterDoctrine implements tests for Doctrine classes. - * - * @author Fabien Potencier - */ -class sfTesterDoctrine extends sfTester -{ - /** - * Prepares the tester. - */ - public function prepare() - { - } - - /** - * Initializes the tester. - */ - public function initialize() - { - } - - /** - * Tests a model. - * - * @param string $model The model class name - * @param array|Doctrine_Query $query A Doctrine_Query object or an array of conditions - * @param string $value The value to test - * - * @return sfTester|sfTestFunctionalBase - */ - public function check($model, $query, $value = true) - { - if (null === $query) { - $query = Doctrine_Core::getTable($model) - ->createQuery('a') - ; - } - - if (is_array($query)) { - $conditions = $query; - $query = $query = Doctrine_Core::getTable($model) - ->createQuery('a') - ; - foreach ($conditions as $column => $condition) { - $column = Doctrine_Core::getTable($model)->getFieldName($column); - - if (null === $condition) { - $query->andWhere('a.'.$column.' IS NULL'); - - continue; - } - - $operator = '='; - if (strlen($condition) && '!' == substr($condition, 0, 1)) { - $operator = false !== strpos($condition, '%') ? 'NOT LIKE' : '!='; - $condition = substr($condition, 1); - } elseif (false !== strpos($condition, '%')) { - $operator = 'LIKE'; - } - - $query->andWhere('a.'.$column.' '.$operator.' ?', $condition); - } - } - - $objects = $query->execute(); - - if (false === $value) { - $this->tester->is(count($objects), 0, sprintf('no %s object that matches the criteria has been found', $model)); - } elseif (true === $value) { - $this->tester->cmp_ok(count($objects), '>', 0, sprintf('%s objects that matches the criteria have been found', $model)); - } elseif (is_int($value)) { - $this->tester->is(count($objects), $value, sprintf('"%s" %s objects have been found', $value, $model)); - } else { - throw new InvalidArgumentException('The "check()" method does not takes this kind of argument.'); - } - - return $this->getObjectToReturn(); - } - - /** - * Outputs some debug information about queries run during the current request. - * - * @param int|string $limit Either an integer to return the last many queries, a regular expression or a substring to search for - */ - public function debug($limit = null) - { - if (!$databaseManager = $this->browser->getContext()->getDatabaseManager()) { - throw new LogicConnection('The current context does not include a database manager.'); - } - - $events = []; - foreach ($databaseManager->getNames() as $name) { - $database = $databaseManager->getDatabase($name); - if ($database instanceof sfDoctrineDatabase && $profiler = $database->getProfiler()) { - foreach ($profiler->getQueryExecutionEvents() as $event) { - $events[$event->getSequence()] = $event; - } - } - } - - // sequence events - ksort($events); - - if (is_integer($limit)) { - $events = array_slice($events, $limit * -1); - } elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $limit, $match)) { - if ('!' == $match[1]) { - $pattern = substr($limit, 1); - $match = false; - } else { - $pattern = $limit; - $match = true; - } - } elseif ($limit) { - $substring = $limit; - } - - echo "\nDumping SQL executed in the current context:\n\n"; - - foreach ($events as $event) { - if ( - (!isset($pattern) && !isset($substring)) - || (isset($pattern) && $match == preg_match($pattern, $event->getQuery())) - || (isset($substring) && false !== stripos($event->getQuery(), $substring)) - ) { - $conn = $event->getInvoker() instanceof Doctrine_Connection ? $event->getInvoker() : $event->getInvoker()->getConnection(); - - echo $event->getQuery()."\n"; - echo ' Parameters: '.sfYaml::dump(sfDoctrineConnectionProfiler::fixParams($event->getParams()), 0)."\n"; - echo ' Connection: '.$conn->getName()."\n"; - echo ' Time: '.number_format($event->getElapsedSecs(), 2)."s\n\n"; - } - } - - exit(1); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineChoice.class.php b/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineChoice.class.php deleted file mode 100644 index bb26ad6ac..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineChoice.class.php +++ /dev/null @@ -1,113 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfValidatorDoctrineChoice validates that the value is one of the rows of a table. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfValidatorDoctrineChoice extends sfValidatorBase -{ - /** - * Configures the current validator. - * - * Available options: - * - * * model: The model class (required) - * * query: A query to use when retrieving objects - * * column: The column name (null by default which means we use the primary key) - * must be in field name format - * * multiple: true if the select tag must allow multiple selections - * * min: The minimum number of values that need to be selected (this option is only active if multiple is true) - * * max: The maximum number of values that need to be selected (this option is only active if multiple is true) - * - * @see sfValidatorBase - */ - protected function configure($options = [], $messages = []) - { - $this->addRequiredOption('model'); - $this->addOption('query', null); - $this->addOption('column', null); - $this->addOption('multiple', false); - $this->addOption('min'); - $this->addOption('max'); - - $this->addMessage('min', 'At least %min% values must be selected (%count% values selected).'); - $this->addMessage('max', 'At most %max% values must be selected (%count% values selected).'); - } - - /** - * @see sfValidatorBase - */ - protected function doClean($value) - { - if ($query = $this->getOption('query')) { - $query = clone $query; - } else { - $query = Doctrine_Core::getTable($this->getOption('model'))->createQuery(); - } - - if ($this->getOption('multiple')) { - if (!is_array($value)) { - $value = [$value]; - } - - if (isset($value[0]) && '' === $value[0]) { - unset($value[0]); - } - - $count = count($value); - - if ($this->hasOption('min') && $count < $this->getOption('min')) { - throw new sfValidatorError($this, 'min', ['count' => $count, 'min' => $this->getOption('min')]); - } - - if ($this->hasOption('max') && $count > $this->getOption('max')) { - throw new sfValidatorError($this, 'max', ['count' => $count, 'max' => $this->getOption('max')]); - } - - $query->andWhereIn(sprintf('%s.%s', $query->getRootAlias(), $this->getColumn()), $value); - - if ($query->count() != count($value)) { - throw new sfValidatorError($this, 'invalid', ['value' => $value]); - } - } else { - $query->andWhere(sprintf('%s.%s = ?', $query->getRootAlias(), $this->getColumn()), $value); - - if (!$query->count()) { - throw new sfValidatorError($this, 'invalid', ['value' => $value]); - } - } - - return $value; - } - - /** - * Returns the column to use for comparison. - * - * The primary key is used by default. - * - * @return string The column name - */ - protected function getColumn() - { - $table = Doctrine_Core::getTable($this->getOption('model')); - if ($this->getOption('column')) { - $columnName = $this->getOption('column'); - } else { - $identifier = (array) $table->getIdentifier(); - $columnName = current($identifier); - } - - return $table->getColumnName($columnName); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineUnique.class.php b/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineUnique.class.php deleted file mode 100644 index acd9ed074..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/validator/sfValidatorDoctrineUnique.class.php +++ /dev/null @@ -1,150 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfValidatorDoctrineUnique validates that the uniqueness of a column. - * - * Warning: sfValidatorDoctrineUnique is susceptible to race conditions. - * To avoid this issue, wrap the validation process and the model saving - * inside a transaction. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfValidatorDoctrineUnique extends sfValidatorSchema -{ - /** - * Constructor. - * - * @param array An array of options - * @param array An array of error messages - * - * @see sfValidatorSchema - */ - public function __construct($options = [], $messages = []) - { - parent::__construct(null, $options, $messages); - } - - /** - * Configures the current validator. - * - * Available options: - * - * * model: The model class (required) - * * column: The unique column name in Doctrine field name format (required) - * If the uniquess is for several columns, you can pass an array of field names - * * primary_key: The primary key column name in Doctrine field name format (optional, will be introspected if not provided) - * You can also pass an array if the table has several primary keys - * * connection: The Doctrine connection to use (null by default) - * * throw_global_error: Whether to throw a global error (false by default) or an error tied to the first field related to the column option array - * - * @see sfValidatorBase - */ - protected function configure($options = [], $messages = []) - { - $this->addRequiredOption('model'); - $this->addRequiredOption('column'); - $this->addOption('primary_key', null); - $this->addOption('connection', null); - $this->addOption('throw_global_error', false); - - $this->setMessage('invalid', 'An object with the same "%column%" already exist.'); - } - - /** - * @see sfValidatorBase - */ - protected function doClean($values) - { - $originalValues = $values; - $table = Doctrine_Core::getTable($this->getOption('model')); - if (!is_array($this->getOption('column'))) { - $this->setOption('column', [$this->getOption('column')]); - } - - // if $values isn't an array, make it one - if (!is_array($values)) { - // use first column for key - $columns = $this->getOption('column'); - $values = [$columns[0] => $values]; - } - - $q = Doctrine_Core::getTable($this->getOption('model'))->createQuery('a'); - foreach ($this->getOption('column') as $column) { - $colName = $table->getColumnName($column); - if (!array_key_exists($column, $values)) { - // one of the column has be removed from the form - return $originalValues; - } - - $q->addWhere('a.'.$colName.' = ?', $values[$column]); - } - - $object = $q->fetchOne(); - - // if no object or if we're updating the object, it's ok - if (!$object || $this->isUpdate($object, $values)) { - return $originalValues; - } - - $error = new sfValidatorError($this, 'invalid', ['column' => implode(', ', $this->getOption('column'))]); - - if ($this->getOption('throw_global_error')) { - throw $error; - } - - $columns = $this->getOption('column'); - - $errorSchema = new sfValidatorErrorSchema($this); - $errorSchema->addError($error, $columns[0]); - - throw $errorSchema; - } - - /** - * Returns whether the object is being updated. - * - * @param BaseObject A Doctrine object - * @param array An array of values - * @param bool true if the object is being updated, false otherwise - */ - protected function isUpdate(Doctrine_Record $object, $values) - { - // check each primary key column - foreach ($this->getPrimaryKeys() as $column) { - if (!isset($values[$column]) || $object->{$column} != $values[$column]) { - return false; - } - } - - return true; - } - - /** - * Returns the primary keys for the model. - * - * @return array An array of primary keys - */ - protected function getPrimaryKeys() - { - if (null === $this->getOption('primary_key')) { - $primaryKeys = Doctrine_Core::getTable($this->getOption('model'))->getIdentifier(); - $this->setOption('primary_key', $primaryKeys); - } - - if (!is_array($this->getOption('primary_key'))) { - $this->setOption('primary_key', [$this->getOption('primary_key')]); - } - - return $this->getOption('primary_key'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine b/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine deleted file mode 160000 index f8ea8b76c..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f8ea8b76cb3f932a4a21aa146c0ebc27939ccc04 diff --git a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineArrayChoice.class.php b/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineArrayChoice.class.php deleted file mode 100644 index 4f02ae219..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineArrayChoice.class.php +++ /dev/null @@ -1,78 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfWidgetFormDoctrineArrayChoice represents a choice widget for a model and table_method. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfWidgetFormDoctrineArrayChoice extends sfWidgetFormChoice -{ - /** - * @see sfWidget - */ - public function __construct($options = [], $attributes = []) - { - $options['choices'] = []; - - parent::__construct($options, $attributes); - } - - /** - * Returns the choices builded by the table method of the model. - * - * @return array An array of choices - */ - public function getChoices() - { - $choices = []; - if (false !== $this->getOption('add_empty')) { - $choices[''] = true === $this->getOption('add_empty') ? '' : $this->translate($this->getOption('add_empty')); - } - - $tableMethod = $this->getOption('table_method'); - $table = Doctrine_Core::getTable($this->getOption('model')); - - if (null !== $params = $this->getOption('table_method_params')) { - $choices += call_user_func_array([$table, $tableMethod], (array) $params); - } else { - $choices += $table->{$tableMethod}(); - } - - return $choices; - } - - /** - * Constructor. - * - * Available options: - * - * * model: The model class (required) - * * table_method: A method to return a formatted array of key => value (required) - * * table_method_params: An array of parameters to pass to the table_method - * * add_empty: Whether to add a first empty value or not (false by default) - * If the option is not a Boolean, the value will be used as the text value - * * multiple: true if the select tag must allow multiple selections (false by default) - * - * @see sfWidgetFormChoice - */ - protected function configure($options = [], $attributes = []) - { - $this->addRequiredOption('model'); - $this->addRequiredOption('table_method'); - $this->addOption('table_method_params', null); - $this->addOption('add_empty', false); - $this->addOption('multiple', false); - - parent::configure($options, $attributes); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php b/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php deleted file mode 100644 index 9753a23fd..000000000 --- a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php +++ /dev/null @@ -1,106 +0,0 @@ - - * (c) Jonathan H. Wage - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfWidgetFormDoctrineChoice represents a choice widget for a model. - * - * @author Fabien Potencier - * @author Jonathan H. Wage - */ -class sfWidgetFormDoctrineChoice extends sfWidgetFormChoice -{ - /** - * @see sfWidget - */ - public function __construct($options = [], $attributes = []) - { - $options['choices'] = []; - - parent::__construct($options, $attributes); - } - - /** - * Returns the choices associated to the model. - * - * @return array An array of choices - */ - public function getChoices() - { - $choices = []; - if (false !== $this->getOption('add_empty')) { - $choices[''] = true === $this->getOption('add_empty') ? '' : $this->translate($this->getOption('add_empty')); - } - - if (null === $this->getOption('table_method')) { - $query = null === $this->getOption('query') ? Doctrine_Core::getTable($this->getOption('model'))->createQuery() : $this->getOption('query'); - if ($order = $this->getOption('order_by')) { - $query->addOrderBy($order[0].' '.$order[1]); - } - $objects = $query->execute(); - } else { - $tableMethod = $this->getOption('table_method'); - $results = Doctrine_Core::getTable($this->getOption('model'))->{$tableMethod}(); - - if ($results instanceof Doctrine_Query) { - $objects = $results->execute(); - } elseif ($results instanceof Doctrine_Collection) { - $objects = $results; - } elseif ($results instanceof Doctrine_Record) { - $objects = new Doctrine_Collection($this->getOption('model')); - $objects[] = $results; - } else { - $objects = []; - } - } - - $method = $this->getOption('method'); - $keyMethod = $this->getOption('key_method'); - - foreach ($objects as $object) { - $choices[$object->{$keyMethod}()] = $object->{$method}(); - } - - return $choices; - } - - /** - * Constructor. - * - * Available options: - * - * * model: The model class (required) - * * add_empty: Whether to add a first empty value or not (false by default) - * If the option is not a Boolean, the value will be used as the text value - * * method: The method to use to display object values (__toString by default) - * * key_method: The method to use to display the object keys (getPrimaryKey by default) - * * order_by: An array composed of two fields: - * * The column to order by the results (must be in the PhpName format) - * * asc or desc - * * query: A query to use when retrieving objects - * * multiple: true if the select tag must allow multiple selections - * * table_method: A method to return either a query, collection or single object - * - * @see sfWidgetFormSelect - */ - protected function configure($options = [], $attributes = []) - { - $this->addRequiredOption('model'); - $this->addOption('add_empty', false); - $this->addOption('method', '__toString'); - $this->addOption('key_method', 'getPrimaryKey'); - $this->addOption('order_by', null); - $this->addOption('query', null); - $this->addOption('multiple', false); - $this->addOption('table_method', null); - - parent::configure($options, $attributes); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/bin/coverage.php b/lib/plugins/sfDoctrinePlugin/test/bin/coverage.php deleted file mode 100644 index f3f3b3321..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/bin/coverage.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -define('SYMFONY_LIB_DIR', realpath(dirname(__FILE__).'/../../../..')); - -require SYMFONY_LIB_DIR.'/vendor/lime/lime.php'; - -require SYMFONY_LIB_DIR.'/util/sfFinder.class.php'; - -$h = new lime_harness(); -$h->base_dir = realpath(dirname(__FILE__).'/..'); - -// unit tests -$h->register_glob($h->base_dir.'/unit/*/*Test.php'); -$h->register_glob($h->base_dir.'/unit/*/*/*Test.php'); - -// functional tests -$h->register_glob($h->base_dir.'/functional/*Test.php'); -$h->register_glob($h->base_dir.'/functional/*/*Test.php'); - -$c = new lime_coverage($h); -$c->extension = '.class.php'; -$c->verbose = false; -$c->base_dir = realpath(dirname(__FILE__).'/../lib'); - -$finder = sfFinder::type('file')->name('*.php')->prune('vendor')->prune('test')->prune('data'); -$c->register($finder->in($c->base_dir)); -$c->run(); diff --git a/lib/plugins/sfDoctrinePlugin/test/bin/prove.php b/lib/plugins/sfDoctrinePlugin/test/bin/prove.php deleted file mode 100644 index 01c963780..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/bin/prove.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -define('SYMFONY_LIB_DIR', realpath(dirname(__FILE__).'/../../../..')); - -require SYMFONY_LIB_DIR.'/vendor/lime/lime.php'; - -require SYMFONY_LIB_DIR.'/util/sfFinder.class.php'; - -$h = new lime_harness(); -$h->base_dir = realpath(dirname(__FILE__).'/..'); - -$h->register(sfFinder::type('file')->prune('fixtures')->name('*Test.php')->in([ - // unit tests - $h->base_dir.'/unit', - // functional tests - $h->base_dir.'/functional', -])); - -exit($h->run() ? 0 : 1); diff --git a/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php b/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php deleted file mode 100644 index 046c1da15..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include dirname(__FILE__).'/../../../../../test/bootstrap/unit.php'; - -if (!isset($root_dir)) { - $root_dir = realpath(dirname(__FILE__).sprintf('/../%s/fixtures', isset($type) ? $type : 'functional')); -} - -include $root_dir.'/config/ProjectConfiguration.class.php'; -$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); -sfContext::createInstance($configuration); - -// remove all cache -sf_functional_test_shutdown(); -register_shutdown_function('sf_functional_test_shutdown'); - -$configuration->initializeDoctrine(); -if (isset($fixtures)) { - $configuration->loadFixtures($fixtures); -} - -function sf_functional_test_shutdown_cleanup() -{ - sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir')); - sfToolkit::clearDirectory(sfConfig::get('sf_log_dir')); - $databases = glob(sfConfig::get('sf_data_dir').'/*.sqlite'); - foreach ($databases as $database) { - unlink($database); - } -} - -function sf_functional_test_shutdown() -{ - // try/catch needed due to http://bugs.php.net/bug.php?id=33598 - try { - sf_functional_test_shutdown_cleanup(); - } catch (Exception $e) { - echo $e.PHP_EOL; - } -} - -return true; diff --git a/lib/plugins/sfDoctrinePlugin/test/bootstrap/unit.php b/lib/plugins/sfDoctrinePlugin/test/bootstrap/unit.php deleted file mode 100644 index 8514daad2..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/bootstrap/unit.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include dirname(__FILE__).'/../../../../../test/bootstrap/unit.php'; - -include dirname(__FILE__).'/../../../../autoload/sfSimpleAutoload.class.php'; -$autoload = sfSimpleAutoload::getInstance(sys_get_temp_dir().DIRECTORY_SEPARATOR.sprintf('sf_autoload_unit_doctrine_%s.data', md5(__FILE__))); -$autoload->addDirectory(realpath(dirname(__FILE__).'/../../lib')); -$autoload->register(); - -$_test_dir = realpath(dirname(__FILE__).'/..'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/ActionRedirectTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/ActionRedirectTest.php deleted file mode 100644 index 16e76d095..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/ActionRedirectTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; -$fixtures = 'fixtures'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$browser = new sfTestFunctional(new sfBrowser()); - -$browser->get('/articles/redirectToShow') - ->with('response')->begin() - ->isRedirected() - ->end() - ->followRedirect() - ->with('request')->begin() - ->isParameter('module', 'articles') - ->isParameter('action', 'show') - ->end() -; diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenBrowser.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenBrowser.class.php deleted file mode 100644 index 1385e55b5..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenBrowser.class.php +++ /dev/null @@ -1,278 +0,0 @@ - 'articles', - 'Author' => 'authors', - 'Subscription' => 'subscriptions', - 'User' => 'users']; - - public function __construct() - { - parent::__construct(); - $this->setTester('doctrine', 'sfTesterDoctrine'); - - $this->_generateAdminGenModules(); - } - - public function __destruct() - { - $this->_cleanupAdminGenModules(); - } - - public function runTests() - { - $this->info('Run sfDoctrinePlugin Admin Generator Tests'); - - $methods = get_class_methods($this); - foreach ($methods as $method) { - if ('_test' == substr($method, 0, 5)) { - $this->{$method}(); - } - } - } - - protected function _testValidSort() - { - $this->info('Test valid sort parameter'); - - $this->get('/users?sort=username'); - - $matches = 0; - foreach ($this->_getQueryExecutionEvents() as $event) { - if (false !== strpos($event->getQuery(), 'ORDER BY u.username asc')) { - ++$matches; - } - } - - $this->test()->is($matches, 1); - } - - protected function _testInvalidSort() - { - $this->info('Test invalid sort parameter'); - - $this->get('/users?sort=INVALID'); - - // there should be no queries that match "INVALID" - foreach ($this->_getQueryExecutionEvents() as $event) { - $this->test()->unlike($event->getQuery(), '/INVALID/'); - } - } - - protected function _testValidSortType() - { - $this->info('Test valid sort_type parameter'); - - foreach (['asc', 'desc', 'ASC', 'DESC'] as $sortType) { - $this->get('/users?sort=username&sort_type='.$sortType); - - $matches = 0; - foreach ($this->_getQueryExecutionEvents() as $event) { - if (false !== strpos($event->getQuery(), 'ORDER BY u.username '.$sortType)) { - ++$matches; - } - } - - $this->test()->is($matches, 1); - } - } - - protected function _testInvalidSortType() - { - $this->info('Test invalid sort_type parameter'); - - $this->get('/users?sort=username&sort_type=INVALID'); - - // there should be no queries that match "INVALID" - foreach ($this->_getQueryExecutionEvents() as $event) { - $this->test()->unlike($event->getQuery(), '/INVALID/'); - } - } - - protected function _testSanityCheck() - { - $this->info('Admin Generator Sanity Checks'); - - foreach ($this->_modules as $model => $module) { - $this->_runAdminGenModuleSanityCheck($model, $module); - } - } - - protected function _testAdminGenTableMethod() - { - $this-> - get('/my_articles')-> - with('response')->isStatusCode('200'); - } - - protected function _testArticleI18nEmbedded() - { - $this->info('Testing "articles" module embeds I18n'); - - $info = ['author_id' => 1, 'is_on_homepage' => false, 'en' => ['title' => 'Test English title', 'body' => 'Test English body'], 'fr' => ['title' => 'Test French title', 'body' => 'Test French body'], 'created_at' => ['month' => '1', 'day' => '12', 'year' => '2009', 'hour' => '10', 'minute' => '03'], 'updated_at' => ['month' => '1', 'day' => '12', 'year' => '2009', 'hour' => '10', 'minute' => '03']]; - - $this-> - get('/articles/new')-> - with('response')->begin()-> - matches('/En/')-> - matches('/Fr/')-> - matches('/Title/')-> - matches('/Body/')-> - matches('/Slug/')-> - matches('/Jonathan H. Wage/')-> - matches('/Fabien POTENCIER/')-> - end()-> - with('request')->begin()-> - isParameter('module', 'articles')-> - isParameter('action', 'new')-> - end()-> - click('Save', ['article' => $info])-> - with('response')->begin()-> - isRedirected()-> - followRedirect()-> - end()-> - with('doctrine')->begin()-> - check('Article', ['is_on_homepage' => $info['is_on_homepage']])-> - check('ArticleTranslation', ['lang' => 'fr', 'title' => 'Test French title'])-> - check('ArticleTranslation', ['lang' => 'en', 'title' => 'Test English title'])-> - end(); - } - - protected function _testEnumDropdown() - { - $this->info('Test enum column type uses a dropdown as the widget'); - - $this-> - get('/subscriptions/new')-> - with('response')->begin()-> - checkElement('select', '/^New\R?Active\R?Pending\R?Expired\R?$/m')-> - end(); - } - - protected function _testUserEmbedsProfileForm() - { - $this->info('Test user form embeds the profile form'); - - $this-> - get('/users/new')-> - with('response')->begin()-> - matches('/Profile/')-> - matches('/First name/')-> - matches('/Last name/')-> - end(); - - $this->info('Test the Profile form saves and attached to user properly'); - - $userInfo = [ - 'user' => [ - 'username' => 'test', - 'password' => 'test', - 'groups_list' => [1, 2], - 'permissions_list' => [3, 4], - 'Profile' => [ - 'first_name' => 'Test', - 'last_name' => 'Test', - ], - ], - ]; - - $this->click('Save', $userInfo); - - $user = Doctrine_Core::getTable('User')->findOneByUsername($userInfo['user']['username']); - $userInfo['user']['Profile']['user_id'] = $user->id; - - $this-> - with('response')->begin()-> - isRedirected()-> - followRedirect()-> - end()-> - with('doctrine')->begin()-> - check('User', ['username' => $userInfo['user']['username']])-> - check('Profile', $userInfo['user']['Profile'])-> - check('UserGroup', ['user_id' => $user->id, 'group_id' => $user->Groups[0]->id])-> - check('UserGroup', ['user_id' => $user->id, 'group_id' => $user->Groups[1]->id])-> - check('UserPermission', ['user_id' => $user->id, 'permission_id' => $user->Permissions[0]->id])-> - check('UserPermission', ['user_id' => $user->id, 'permission_id' => $user->Permissions[1]->id])-> - end(); - - unset($userInfo['user']['Profile']['user_id']); - $tester = $this->get('/users/new')-> - click('Save', $userInfo)-> - with('form')->begin(); - $tester->hasErrors(); - $form = $tester->getForm(); - $this->test()->is((string) $form->getErrorSchema(), 'username [An object with the same "username" already exist.]', 'Check username gives unique error'); - $tester->end(); - } - - protected function _runAdminGenModuleSanityCheck($model, $module) - { - $this->info('Running admin gen sanity check for module "'.$module.'"'); - $record = Doctrine_Core::getTable($model) - ->createQuery('a') - ->fetchOne() - ; - - $this-> - info('Sanity check on "'.$module.'" module')-> - getAndCheck($module, 'index', '/'.$module)-> - get('/'.$module.'/'.$record->getId().'/edit'); - - $this - ->click('Save')-> - with('response')->begin()-> - isRedirected()-> - followRedirect()-> - end() - ; - } - - protected function _generateAdminGenModule($model, $module) - { - $this->info('Generating admin gen module "'.$module.'"'); - $task = new sfDoctrineGenerateAdminTask($this->getContext()->getEventDispatcher(), new sfFormatter()); - $task->run(['application' => 'backend', 'route_or_model' => $model]); - } - - protected function _generateAdminGenModules() - { - // $task = new sfDoctrineBuildAllReloadTask($this->getContext()->getEventDispatcher(), new sfFormatter()); - // $task->run(array(), array('--no-confirmation')); - - // Generate the admin generator modules - foreach ($this->_modules as $model => $module) { - $this->_generateAdminGenModule($model, $module); - } - } - - protected function _cleanupAdminGenModules() - { - $fs = new sfFilesystem($this->getContext()->getEventDispatcher(), new sfFormatter()); - foreach ($this->_modules as $module) { - $this->info('Removing admin gen module "'.$module.'"'); - $fs->execute('rm -rf '.sfConfig::get('sf_app_module_dir').'/'.$module); - } - $fs->execute('rm -rf '.sfConfig::get('sf_test_dir').'/functional/backend'); - $fs->execute('rm -rf '.sfConfig::get('sf_data_dir').'/*.sqlite'); - } - - protected function _getQueryExecutionEvents() - { - $events = []; - - $databaseManager = $this->browser->getContext()->getDatabaseManager(); - foreach ($databaseManager->getNames() as $name) { - $database = $databaseManager->getDatabase($name); - if ($database instanceof sfDoctrineDatabase && $profiler = $database->getProfiler()) { - foreach ($profiler->getQueryExecutionEvents() as $event) { - $events[$event->getSequence()] = $event; - } - } - } - - ksort($events); - - return array_values($events); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenTest.php deleted file mode 100644 index 6728f62e0..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/AdminGenTest.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'backend'; -$fixtures = 'fixtures'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -require_once dirname(__FILE__).'/AdminGenBrowser.class.php'; - -$b = new AdminGenBrowser(); -$b->runTests(); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/EnvironmentSetupTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/EnvironmentSetupTest.php deleted file mode 100644 index 804898925..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/EnvironmentSetupTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; -$fixtures = 'fixtures/fixtures.yml'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(12); - -// Make sure Author records were populated properly -$q = Doctrine_Query::create() - ->from('Author a') -; -$results = $q->fetchArray(); - -$t->is(count($results), 2); -$t->is($results[0]['name'], 'Jonathan H. Wage'); -$t->is($results[1]['name'], 'Fabien POTENCIER'); - -// Make sure data fixtures were loaded -$q = Doctrine_Query::create() - ->from('Article a') - ->leftJoin('a.Translation t') -; - -$articles = $q->fetchArray(); -$t->is($articles[0]['Translation']['en']['title'], 'English Title'); - -$manager = Doctrine_Manager::getInstance(); -$conn1 = $manager->getConnection('doctrine1'); -$conn2 = $manager->getConnection('doctrine2'); -$conn3 = $manager->getConnection('doctrine3'); - -// Make sure all connections are created properly from databases.yml -$t->is(count($manager), 3); -$t->is($conn1->getOption('dsn'), 'sqlite:'.str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')).'/database1.sqlite'); -$t->is($conn2->getOption('dsn'), 'sqlite:'.str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')).'/database2.sqlite'); -$t->is($conn3->getOption('dsn'), 'sqlite:'.str_replace(DIRECTORY_SEPARATOR, '/', sfConfig::get('sf_data_dir')).'/database3.sqlite'); - -// Set globally by ProjectConfiguration::configureDoctrine() -$t->is($manager->getAttribute(Doctrine_Core::ATTR_VALIDATE), true); - -// We disable validation for the doctrine2 connection in ProjectConfiguration::configureDoctrineConnectionDoctrine2() -$t->is($conn2->getAttribute(Doctrine_Core::ATTR_VALIDATE), false); - -// We set export attribute on the connection in databases.yml -$t->is($conn3->getAttribute(Doctrine_Core::ATTR_EXPORT), Doctrine_Core::EXPORT_TABLES); - -$article = new ReflectionClass('Article'); -$parent = new ReflectionClass('myDoctrineRecord'); -$t->is($article->isSubclassOf($parent), true); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/FormGeneratorTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/FormGeneratorTest.php deleted file mode 100644 index 052f51b73..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/FormGeneratorTest.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'backend'; -$fixtures = 'fixtures'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(41); - -$t->diag("Test that these models don't generate forms or filters classes"); -$noFormsOrFilters = ['UserGroup', 'UserPermission', 'GroupPermission']; -foreach ($noFormsOrFilters as $model) { - $t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/'.$model.'Form.class.php'), false); - $t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/base/Base'.$model.'Form.class.php'), false); - $t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/'.$model.'FormFilter.class.php'), false); - $t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/base/Base'.$model.'FormFilter.class.php'), false); -} - -$t->diag('FormGeneratorTest model should generate forms but not filters'); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/FormGeneratorTestForm.class.php'), true); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/base/BaseFormGeneratorTestForm.class.php'), true); - -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/FormGeneratorTestFormFilter.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/base/BaseFormGeneratorTestFormFilter.class.php'), false); - -$t->diag('FormGeneratorTest2 model should generate filters but not forms'); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/FormGeneratorTest2Form.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/base/BaseFormGeneratorTest2Form.class.php'), false); - -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/FormGeneratorTest2FormFilter.class.php'), true); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/base/BaseFormGeneratorTest2FormFilter.class.php'), true); - -$t->diag('FormGeneratorTest3 model should not generate forms or filters'); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/FormGeneratorTest3Form.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/base/BaseFormGeneratorTest3Form.class.php'), false); - -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/FormGeneratorTest3FormFilter.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/base/BaseFormGeneratorTest3FormFilter.class.php'), false); - -$t->diag('FormGeneratorTest3Translation not generate forms or filters'); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/FormGeneratorTest3TranslationForm.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/form/doctrine/base/BaseFormGeneratorTest3TranslationForm.class.php'), false); - -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/FormGeneratorTest3TranslationFormFilter.class.php'), false); -$t->is(file_exists(sfConfig::get('sf_lib_dir').'/filter/doctrine/base/BaseFormGeneratorTest3TranslationFormFilter.class.php'), false); - -$t->diag('Check form generator generates forms with correct inheritance'); -$test = new AuthorInheritanceForm(); -$t->is(is_subclass_of($test, 'AuthorForm'), true); - -$test = new AuthorInheritanceFormFilter(); -$t->is(is_subclass_of($test, 'AuthorFormFilter'), true); - -$t->diag('Check form generator adds columns to concrete inheritance forms'); -$test = new AuthorForm(); -$t->ok(!isset($test['additional'])); - -$test = new AuthorInheritanceConcreteForm(); -$t->ok(isset($test['additional'])); - -$test = new AuthorFormFilter(); -$t->ok(!isset($test['additional'])); -$t->ok(!array_key_exists('additional', $test->getFields())); - -$test = new AuthorInheritanceConcreteFormFilter(); -$t->ok(isset($test['additional'])); -$t->ok(array_key_exists('additional', $test->getFields())); - -$t->diag('Check form generator respects relations tweaked by inheritance'); -$test = new BlogArticleForm(); -$t->is($test->getWidget('author_id')->getOption('model'), 'BlogAuthor'); -$t->is($test->getValidator('author_id')->getOption('model'), 'BlogAuthor'); - -$test = new BlogArticleFormFilter(); -$t->is($test->getWidget('author_id')->getOption('model'), 'BlogAuthor'); -$t->is($test->getValidator('author_id')->getOption('model'), 'BlogAuthor'); - -$t->diag('Check enum primary keys'); - -try { - $test = new ResourceTypeForm(); - $t->pass('enum primary key widgets work'); -} catch (InvalidArgumentException $e) { - $t->fail('enum primary key widgets work'); - $t->diag(' '.$e->getMessage()); -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/FormTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/FormTest.php deleted file mode 100644 index b8a3eb1bc..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/FormTest.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(17); - -// test for ticket #4935 -$user = new User(); -$profile = $user->getProfile(); - -$userForm = new UserForm($user); -$profileForm = new ProfileForm($profile); -unset($profileForm['id'], $profileForm['user_id']); - -$userForm->embedForm('Profile', $profileForm); - -$data = ['username' => 'jwage', - 'password' => 'changeme', - 'Profile' => [ - 'first_name' => 'Jonathan', - 'last_name' => 'Wage', - ]]; - -$userForm->bind($data); -$userForm->save(); - -$t->is($user->getId() > 0, true); -$t->is($user->getId(), $profile->getUserId()); -$t->is($user->getUsername(), 'jwage'); -$t->is($profile->getFirstName(), 'Jonathan'); - -$userCount = Doctrine_Query::create() - ->from('User u') - ->count() -; - -$t->is($userCount, 1); - -$profileCount = Doctrine_Query::create() - ->from('Profile p') - ->count() -; - -$t->is($profileCount, 1); - -$widget = new sfWidgetFormDoctrineChoice(['model' => 'User']); -$t->is($widget->getChoices(), [1 => 1]); - -$widget = new sfWidgetFormDoctrineChoice(['model' => 'User', 'key_method' => 'getUsername', 'method' => 'getPassword']); -$t->is($widget->getChoices(), ['jwage' => '4cb9c8a8048fd02294477fcb1a41191a']); - -$widget = new sfWidgetFormDoctrineChoice(['model' => 'User', 'key_method' => 'getUsername', 'method' => 'getPassword']); -$t->is($widget->getChoices(), ['jwage' => '4cb9c8a8048fd02294477fcb1a41191a']); - -$methods = [ - 'widgetChoiceTableMethod1', - 'widgetChoiceTableMethod2', - 'widgetChoiceTableMethod3', -]; - -foreach ($methods as $method) { - $widget = new sfWidgetFormDoctrineChoice(['model' => 'User', 'table_method' => $method]); - $t->is($widget->getChoices(), [1 => 1]); -} - -$widget = new sfWidgetFormDoctrineChoice(['model' => 'User', 'table_method' => 'widgetChoiceTableMethod4']); -$t->is($widget->getChoices(), []); - -$user = new User(); -$user->Groups[]->name = 'User Group 1'; -$user->Groups[]->name = 'User Group 2'; - -class UserGroupForm extends GroupForm -{ - public function configure() - { - parent::configure(); - $this->useFields(['name']); - } -} - -$userForm = new UserForm($user); -$userForm->embedRelation('Groups', 'UserGroupForm'); - -$data = [ - 'username' => 'jonwage', - 'password' => 'changeme', - 'Groups' => [ - 0 => [ - 'name' => 'New User Group 1 Name', - ], - 1 => [ - 'name' => 'New User Group 2 Name', - ], - ], -]; - -$userForm->bind($data); -$t->is($userForm->isValid(), true); - -if ($userForm->isValid()) { - $userForm->save(); -} - -$t->is($user->Groups[0]->name, 'New User Group 1 Name'); -$t->is($user->Groups[1]->name, 'New User Group 2 Name'); - -$form = new DefaultValueTestForm(); -$validatorSchema = $form->getValidatorSchema(); -$t->is($validatorSchema['name']->getOption('required'), false); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/I18nTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/I18nTest.php deleted file mode 100644 index 8c78eca99..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/I18nTest.php +++ /dev/null @@ -1,232 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(13); - -$article = new Article(); -$article->title = 'test'; -$t->is($article->Translation['en']->title, 'test'); - -sfContext::getInstance()->getUser()->setCulture('fr'); -$article->title = 'fr test'; -$t->is($article->Translation['fr']->title, 'fr test'); - -$t->is($article->getTitle(), $article->title); -$article->setTitle('test'); -$t->is($article->getTitle(), 'test'); - -$article->setTestColumn('test'); -$t->is($article->getTestColumn(), 'test'); -$t->is($article->Translation['fr']['test_column'], 'test'); - -$article->free(true); - -class MyArticleForm extends ArticleForm -{ - public function configure() - { - parent::configure(); - - $this->embedI18n(['en', 'fr']); - - $authorForm = new AuthorForm($this->object->Author); - unset($authorForm['id']); - - $this->embedForm('Author', $authorForm); - - unset($this['author_id']); - } -} - -$article = new Article(); -$articleForm = new MyArticleForm($article); - -$data = [ - 'is_on_homepage' => 1, - 'Author' => [ - 'name' => 'i18n author test', - 'type' => null], - 'en' => [ - 'title' => 'english title', - 'body' => 'english body'], - 'fr' => [ - 'title' => 'french title', - 'body' => 'french body'], - 'created_at' => time(), - 'updated_at' => time(), -]; - -$articleForm->bind($data); -$t->is($articleForm->isValid(), true); - -$data = $articleForm->getValues(); - -$values = [ - 'is_on_homepage' => true, - 'Author' => [ - 'name' => 'i18n author test', - 'type' => null, - ], - 'en' => [ - 'title' => 'english title', - 'body' => 'english body', - 'test_column' => '', - 'slug' => '', - ], - 'fr' => [ - 'title' => 'french title', - 'body' => 'french body', - 'test_column' => '', - 'slug' => '', - ], - 'id' => null, - 'type' => null, - 'views' => null, - 'created_at' => $data['created_at'], - 'updated_at' => $data['updated_at'], -]; - -$t->is($articleForm->getValues(), $values); - -$articleForm->save(); - -$expected = [ - 'id' => $article->id, - 'author_id' => $article->Author->id, - 'is_on_homepage' => true, - 'type' => null, - 'views' => null, - 'created_at' => $article->created_at, - 'updated_at' => $article->updated_at, - 'Translation' => [ - 'en' => [ - 'id' => $article->id, - 'title' => 'english title', - 'body' => 'english body', - 'test_column' => '', - 'lang' => 'en', - 'slug' => 'english-title', - ], - 'fr' => [ - 'id' => $article->id, - 'title' => 'french title', - 'body' => 'french body', - 'test_column' => '', - 'lang' => 'fr', - 'slug' => 'french-title', - ], - ], - 'Author' => [ - 'id' => $article->Author->id, - 'name' => 'i18n author test', - 'type' => null, - ], -]; - -$t->is($article->toArray(true), $expected); - -$articleForm = new MyArticleForm($article); - -$expected = [ - 'id' => $article->id, - 'author_id' => $article->author_id, - 'is_on_homepage' => true, - 'type' => null, - 'views' => null, - 'created_at' => $article->created_at, - 'updated_at' => $article->updated_at, - 'en' => [ - 'id' => $article->id, - 'title' => 'english title', - 'body' => 'english body', - 'test_column' => '', - 'lang' => 'en', - 'slug' => 'english-title', - ], - 'fr' => [ - 'id' => $article->id, - 'title' => 'french title', - 'body' => 'french body', - 'test_column' => '', - 'lang' => 'fr', - 'slug' => 'french-title', - ], - 'Author' => [ - 'id' => $article->Author->id, - 'name' => 'i18n author test', - 'type' => null, - ], -]; - -$t->is($articleForm->getDefaults(), $expected); - -// Bug #7486 -$data = [ - 'id' => $article->id, - 'is_on_homepage' => true, - 'type' => null, - 'created_at' => $article->created_at, - 'updated_at' => $article->updated_at, - 'en' => [ - 'id' => $article->id, - 'title' => 'english title', - 'body' => 'english body', - 'test_column' => '', - 'lang' => 'en', - 'slug' => 'english-title', - ], - 'fr' => [ - 'id' => $article->id, - 'title' => 'french title', - 'body' => 'french body', - 'test_column' => '', - 'lang' => 'fr', - 'slug' => 'french-title', - ], - 'Author' => [ - 'name' => 'i18n author test', - 'type' => null, - ], -]; - -$articleForm->bind($data); -$t->is($articleForm->isValid(), true); - -$article = new Article(); -$articleForm = new MyArticleForm($article); - -$data = [ - 'is_on_homepage' => 1, - 'Author' => [ - 'name' => 'i18n author test', - 'type' => null], - 'en' => [ - 'title' => 'english title', - 'body' => 'english body'], - 'fr' => [ - 'title' => 'french title', - 'body' => 'french body'], - 'created_at' => time(), - 'updated_at' => time(), -]; - -$articleForm->bind($data); -$t->is($articleForm->isValid(), false); -// END: Bug #7486 - -$article = new Article(); -sfContext::getInstance()->getUser()->setCulture('en'); -$article->title = 'test'; -sfContext::getInstance()->getUser()->setCulture('fr'); -$t->is($article->title, 'test'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/PagerTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/PagerTest.php deleted file mode 100644 index 840dcf127..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/PagerTest.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(23); - -$total = 50; -for ($i = 0; $i < $total; ++$i) { - $author = new Author(); - $author->name = 'Author #'.$i; - $author->save(); -} - -$numPerPage = 25; -$pager = new sfDoctrinePager('Author', $numPerPage); -$pager->setTableMethod('testTableMethod'); -$pager->setPage(1); -$pager->init(); - -$t->is($pager->getQuery()->getSqlQuery(), 'SELECT a.id AS a__id, a.name AS a__name, a.type AS a__type FROM author a WHERE (a.id > 0) LIMIT 25'); -$t->ok($pager->isFirstPage()); - -$pager->setPage(2); -$pager->init(); - -$t->is($pager->getQuery()->getSqlQuery(), 'SELECT a.id AS a__id, a.name AS a__name, a.type AS a__type FROM author a WHERE (a.id > 0) LIMIT 25 OFFSET 25'); -$t->is($pager->getQuery()->count(), $total); -$t->ok($pager->isLastPage()); - -$results = $pager->getResults(); - -$t->is(gettype($results), 'object'); -$t->is(get_class($results), 'Doctrine_Collection'); -$t->is(count($results), $numPerPage); -$t->is($pager->getCountQuery()->count(), $total); - -$pager = new sfDoctrinePager('Author', $numPerPage); -$pager->setTableMethod('testTableMethod'); -$pager->setPage(1); -$pager->init(); - -$results = $pager->getResults(Doctrine_Core::HYDRATE_ARRAY); - -$t->is(gettype($results), 'array'); -$t->is(count($results), $numPerPage); - -$pager = new sfDoctrinePager('Author', $numPerPage); -$pager->setTableMethod('testTableMethod2'); -$pager->setQuery(Doctrine_Query::create()->from('Author a')->where('a.id < 9999999')); -$pager->setPage(1); -$pager->init(); - -$t->is($pager->getQuery()->getSqlQuery(), 'SELECT a.id AS a__id, a.name AS a__name, a.type AS a__type FROM author a WHERE (a.id < 9999999 AND a.id > 0) LIMIT 25'); - -$pager = new sfDoctrinePager('Author', $numPerPage); -$pager->setQuery(Doctrine_Query::create()->from('Author a')->where('a.id < 9999999')); -$pager->setPage(1); -$pager->init(); - -$t->is($pager->getQuery()->getSqlQuery(), 'SELECT a.id AS a__id, a.name AS a__name, a.type AS a__type FROM author a WHERE (a.id < 9999999) LIMIT 25'); - -// pager interface -$t->diag('iterator interface'); - -$pager = new sfDoctrinePager('Author', 10); -$pager->init(); -foreach ($pager as $author) { - $t->isa_ok($author, 'Author'); -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/RouteTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/RouteTest.php deleted file mode 100644 index 729c5719b..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/RouteTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'backend'; -$fixtures = 'fixtures'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$tests = [ - '/doctrine/route/test1' => '/Article/', - '/doctrine/route/test2' => '/Article/', - '/doctrine/route/test3' => '/Doctrine_Collection/', - '/doctrine/route/test4' => '/Doctrine_Collection/', - '/doctrine/route/test5/1/some_fake_value' => '/Article/', - '/doctrine/route/test6/english-title/some_fake_value' => '/Article/', - '/doctrine/route/test7/some_fake_value' => '/Doctrine_Collection/', - '/doctrine/route/test9/1/english-title/English+Title/test' => '/Article/', - '/doctrine/route/test10/1/test' => '/Doctrine_Collection/', -]; - -$b = new sfTestBrowser(); -foreach ($tests as $url => $check) { - $b-> - get($url)-> - with('response')->begin()-> - isStatusCode('200')-> - matches($check)-> - end(); -} - -$article = Doctrine_Core::getTable('Article')->find(1); - -$routes = [ - 'doctrine_route_test5' => [ - 'url' => '/index.php/doctrine/route/test5/1/test-english-title', - 'params' => $article, - ], - 'doctrine_route_test6' => [ - 'url' => '/index.php/doctrine/route/test6/english-title/test-english-title', - 'params' => $article, - ], - 'doctrine_route_test7' => [ - 'url' => '/index.php/doctrine/route/test7/w00t', - 'params' => ['testing_non_column' => 'w00t'], - ], - 'doctrine_route_test8' => [ - 'url' => '/index.php/doctrine/route/test8/1/english-title/English+Title/test', - 'params' => [ - 'id' => $article->id, - 'slug' => $article->slug, - 'title' => $article->title, - 'testing_non_column2' => 'test', - ], - ], -]; - -foreach ($routes as $route => $check) { - $url = url_for2($route, $check['params']); - $b->test()->is($url, $check['url'], 'Check "'.$route.'" generates correct url'); -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/SchemaMergeTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/SchemaMergeTest.php deleted file mode 100644 index a34cde26e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/SchemaMergeTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(3); - -$table = Doctrine_Core::getTable('Setting'); - -// columns -$t->diag('columns'); - -$t->is_deeply($table->getColumnDefinition('name'), [ - 'type' => 'string', - 'length' => 255, - 'notnull' => true, -], 'the short "type" syntax is expanded'); - -$t->is_deeply($table->getColumnDefinition('weight'), [ - 'type' => 'float', - 'length' => 4, - 'scale' => 4, -], 'the short "type(length, scale)" syntax is expanded'); - -// actAs -$t->diag('actAs'); - -$options = $table->getTemplate('Timestampable')->getOptions(); -$t->is($options['updated']['disabled'], true, 'the short "actAs" syntax is expanded'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/5269Test.php b/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/5269Test.php deleted file mode 100644 index d5c66b34b..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/5269Test.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../../bootstrap/functional.php'; - -$t = new lime_test(1); - -class TestUserForm extends UserForm -{ - public function configure() - { - parent::configure(); - unset($this['test']); - } -} - -$user = new User(); -$user->username = 'nullvaluetest'; -$user->password = 'changeme'; -$user->test = 'test'; -$user->save(); -$user->free(); -unset($user); - -$user = Doctrine_Core::getTable('User')->findOneByUsername('nullvaluetest'); -$userForm = new TestUserForm($user); -$userForm->bind(['id' => $user->id, 'username' => 'nullvaluetest', 'password' => 'changeme2']); -if ($userForm->isValid()) { - $userForm->save(); -} - -$user->free(); -unset($user); - -$user = Doctrine_Core::getTable('User')->findOneByUsername('nullvaluetest'); -$t->is($user->toArray(), ['id' => 1, 'username' => 'nullvaluetest', 'password' => 'b0660f0b8b989971524762330aea5449', 'test' => 'test']); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/7774Test.php b/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/7774Test.php deleted file mode 100644 index e7d594adc..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/Ticket/7774Test.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../../bootstrap/functional.php'; -if (!is_link(sfConfig::get('sf_config_dir').'/doctrine/linked_schema.yml')) { - return; -} - -$t = new lime_test(1); - -$t->is(class_exists('ModelFromLinkedSchema'), true, 'models from symlinked schema files are built'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/UniqueTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/UniqueTest.php deleted file mode 100644 index 31b51084a..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/UniqueTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(2); - -$data = [ - 'unique_test1' => 'test', - 'unique_test2' => 'test', - 'unique_test3' => 'test', - 'unique_test4' => 'test', -]; - -$uniqueTestForm = new UniqueTestForm(); -$uniqueTestForm->bind($data); -$uniqueTestForm->save(); - -$uniqueTestForm = new UniqueTestForm(); -$uniqueTestForm->bind($data); -$t->is($uniqueTestForm->isValid(), false); -$t->is((string) $uniqueTestForm->getErrorSchema(), 'unique_test1 [An object with the same "unique_test1" already exist. An object with the same "unique_test1, unique_test2" already exist.] unique_test4 [An object with the same "unique_test4" already exist.]'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/UploadTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/UploadTest.php deleted file mode 100644 index 44e832a21..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/UploadTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$browser = new sfTestFunctional(new sfBrowser(), null, [ - 'doctrine' => 'sfTesterDoctrine', -]); - -$browser - ->get('/attachment/index') - ->setField('attachment[file_path]', sfConfig::get('sf_config_dir').'/databases.yml') - ->click('submit') - ->with('response')->begin() - ->checkElement('h1:contains("ok")') - ->end() - ->with('doctrine')->check('Attachment', [ - 'file_path' => AttachmentForm::TEST_GENERATED_FILENAME, - ], 1) -; - -$browser->test()->is(file_exists(sfConfig::get('sf_cache_dir').'/'.AttachmentForm::TEST_GENERATED_FILENAME), true, 'uploaded file is named correctly'); - -$browser - ->get('/attachment/editable?id=1') - ->setField('attachment[file_path_delete]', 1) - ->click('submit') - ->with('response')->begin() - ->checkElement('h1', 'ok') - ->end() - ->with('doctrine')->check('Attachment', [ - 'file_path' => AttachmentForm::TEST_GENERATED_FILENAME, - ], false) -; - -$browser->test()->is(file_exists(sfConfig::get('sf_cache_dir').'/'.AttachmentForm::TEST_GENERATED_FILENAME), false, 'uploaded file is removed'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/app.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/app.yml deleted file mode 100644 index 1899f5faa..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/app.yml +++ /dev/null @@ -1,2 +0,0 @@ -# default values -#all: diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php deleted file mode 100644 index 36be3be8f..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/backendConfiguration.class.php +++ /dev/null @@ -1,8 +0,0 @@ - - web_debug: true - cache: false - no_script_name: false - etag: false - -test: - .settings: - error_reporting: - cache: false - web_debug: false - no_script_name: false - etag: false - -all: - .settings: - # Form security secret (CSRF protection) - csrf_secret: false # Unique secret to enable CSRF protection or false to disable - - # Output escaping settings - escaping_strategy: false # Determines how variables are made available to templates. Accepted values: true, false. - escaping_method: ESC_SPECIALCHARS # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES, and ESC_SPECIALCHARS. diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/view.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/view.yml deleted file mode 100644 index f633321ff..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/config/view.yml +++ /dev/null @@ -1,17 +0,0 @@ -default: - http_metas: - content-type: text/html - - metas: - #title: symfony project - #description: symfony project - #keywords: symfony, project - #language: en - #robots: index, follow - - stylesheets: [main.css] - - javascripts: [] - - has_layout: true - layout: layout diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/lib/myUser.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/lib/myUser.class.php deleted file mode 100644 index 4c793028e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/lib/myUser.class.php +++ /dev/null @@ -1,5 +0,0 @@ -object = $this->getRoute()->getObjects(); - } catch (Exception $e) { - try { - $this->object = $this->getRoute()->getObject(); - } catch (Exception $e) { - return sfView::NONE; - } - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/modules/doctrine_route_test/templates/indexSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/modules/doctrine_route_test/templates/indexSuccess.php deleted file mode 100644 index 2db6f320e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/backend/modules/doctrine_route_test/templates/indexSuccess.php +++ /dev/null @@ -1,3 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/app.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/app.yml deleted file mode 100644 index 1899f5faa..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/app.yml +++ /dev/null @@ -1,2 +0,0 @@ -# default values -#all: diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/cache.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/cache.yml deleted file mode 100644 index c120397aa..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/cache.yml +++ /dev/null @@ -1,4 +0,0 @@ -default: - enabled: false - with_layout: false - lifetime: 86400 diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/factories.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/factories.yml deleted file mode 100644 index fcbdb194a..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/factories.yml +++ /dev/null @@ -1,17 +0,0 @@ -prod: - logger: - class: sfNoLogger - param: - level: err - loggers: ~ - -test: - storage: - class: sfSessionTestStorage - param: - session_path: %SF_TEST_CACHE_DIR%/sessions - - response: - class: sfWebResponse - param: - send_http_headers: false diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/filters.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/filters.yml deleted file mode 100644 index 0cbf8a7a4..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/filters.yml +++ /dev/null @@ -1,8 +0,0 @@ -rendering: ~ -security: ~ - -# insert your own filters here - -cache: ~ - -execution: ~ diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/frontendConfiguration.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/frontendConfiguration.class.php deleted file mode 100644 index 8e52a8c98..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/frontendConfiguration.class.php +++ /dev/null @@ -1,8 +0,0 @@ - - web_debug: true - cache: false - no_script_name: false - etag: false - -test: - .settings: - error_reporting: - cache: false - web_debug: false - no_script_name: false - etag: false - -all: - .settings: - # Form security secret (CSRF protection) - csrf_secret: false # Unique secret to enable CSRF protection or false to disable - - # Output escaping settings - escaping_strategy: false # Determines how variables are made available to templates. Accepted values: true, false. - escaping_method: ESC_SPECIALCHARS # Function or helper used for escaping. Accepted values: ESC_RAW, ESC_ENTITIES, ESC_JS, ESC_JS_NO_ENTITIES, and ESC_SPECIALCHARS. diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/view.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/view.yml deleted file mode 100644 index ba06e3ef7..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/config/view.yml +++ /dev/null @@ -1,17 +0,0 @@ -default: - http_metas: - content-type: text/html - - metas: - #title: symfony project - #description: symfony project - #keywords: symfony, project - #language: en - robots: index, follow - - stylesheets: [main] - - javascripts: [] - - has_layout: true - layout: layout diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/lib/myUser.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/lib/myUser.class.php deleted file mode 100644 index 4c793028e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/lib/myUser.class.php +++ /dev/null @@ -1,5 +0,0 @@ -articleList = $this->getArticleTable()->findAll(); - } - - public function executeRedirectToShow() - { - $this->redirect('article', Doctrine_Core::getTable('Article')->createQuery()->fetchOne()); - } - - public function executeShow() - { - $this->article = $this->getRoute()->getObject(); - } - - public function executeCreate() - { - $this->form = new ArticleForm(); - - $this->setTemplate('edit'); - } - - public function executeEdit($request) - { - $this->form = $this->getArticleForm($request->getParameter('id')); - } - - public function executeUpdate($request) - { - $this->forward404Unless($request->isMethod(sfRequest::POST)); - - $this->form = $this->getArticleForm($request->getParameter('id')); - - $this->form->bind($request->getParameter('article')); - if ($this->form->isValid()) { - $article = $this->form->save(); - - $this->redirect('articles/edit?id='.$article->get('id')); - } - - $this->setTemplate('edit'); - } - - public function executeDelete($request) - { - $this->forward404Unless($article = $this->getArticleById($request->getParameter('id'))); - - $article->delete(); - - $this->redirect('articles/index'); - } - - private function getArticleTable() - { - return Doctrine_Core::getTable('Article'); - } - - private function getArticleById($id) - { - return $this->getArticleTable()->find($id); - } - - private function getArticleForm($id) - { - $article = $this->getArticleById($id); - - if ($article instanceof Article) { - return new ArticleForm($article); - } - - return new ArticleForm(); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/editSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/editSuccess.php deleted file mode 100644 index f2a94c235..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/editSuccess.php +++ /dev/null @@ -1,58 +0,0 @@ -getObject(); ?> -

    isNew() ? 'New' : 'Edit'; ?> Articles

    - -
    isMultipart() and print 'enctype="multipart/form-data" '; ?>> - - - - - - - - renderGlobalErrors(); ?> - - - - - - - - - - - - - - - - - - - - - -
    -  Back to list - isNew()) { ?> -  get('id'), ['post' => true, 'confirm' => 'Are you sure?']); ?> - - -
    - renderError(); ?> - -
    - renderError(); ?> - -
    - renderError(); ?> - -
    - renderError(); ?> - -
    - renderError(); ?> - - - -
    -
    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/indexSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/indexSuccess.php deleted file mode 100644 index e8187ba10..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/indexSuccess.php +++ /dev/null @@ -1,24 +0,0 @@ -

    Articles List

    - - - - - - - - - - - - - - - - - - - - -
    IdAuthorCreated atUpdated at
    getid(); ?>getAuthor(); ?>getcreated_at(); ?>getupdated_at(); ?>
    - -Create diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/showSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/showSuccess.php deleted file mode 100644 index 76cb5cd33..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/articles/templates/showSuccess.php +++ /dev/null @@ -1 +0,0 @@ -

    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/actions/actions.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/actions/actions.class.php deleted file mode 100644 index 6bcb1d27a..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/actions/actions.class.php +++ /dev/null @@ -1,51 +0,0 @@ -form = new AttachmentForm(); - unset($this->form['id']); - - if ( - $request->isMethod('post') - && $this->form->bindAndSave( - $request->getParameter($this->form->getName()), - $request->getFiles($this->form->getName()) - ) - ) { - return sfView::SUCCESS; - } - - return sfView::INPUT; - } - - public function executeEditable(sfWebRequest $request) - { - $attachment = Doctrine_Core::getTable('Attachment')->find($request['id']); - $this->forward404Unless($attachment, 'Attachment not found'); - - $this->form = new AttachmentForm($attachment); - if ( - $request->isMethod('post') - && $this->form->bindAndSave( - $request->getParameter($this->form->getName()), - $request->getFiles($this->form->getName()) - ) - ) { - return sfView::SUCCESS; - } - - return sfView::INPUT; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableInput.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableInput.php deleted file mode 100644 index 21c76a69d..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableInput.php +++ /dev/null @@ -1,6 +0,0 @@ -
    - - -
    -

    -
    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableSuccess.php deleted file mode 100644 index f7b3f204f..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/editableSuccess.php +++ /dev/null @@ -1 +0,0 @@ -

    ok

    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexInput.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexInput.php deleted file mode 100644 index 23059eeb3..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexInput.php +++ /dev/null @@ -1,6 +0,0 @@ -
    - - -
    -

    -
    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexSuccess.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexSuccess.php deleted file mode 100644 index f7b3f204f..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/modules/attachment/templates/indexSuccess.php +++ /dev/null @@ -1 +0,0 @@ -

    ok

    diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/templates/layout.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/templates/layout.php deleted file mode 100644 index 93cf1cb21..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/apps/frontend/templates/layout.php +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/ProjectConfiguration.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/ProjectConfiguration.class.php deleted file mode 100644 index da05c0d51..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/ProjectConfiguration.class.php +++ /dev/null @@ -1,65 +0,0 @@ -enableAllPluginsExcept(); - - $this->dispatcher->connect('doctrine.configure', [$this, 'configureDoctrine']); - $this->dispatcher->connect('doctrine.configure_connection', [$this, 'configureDoctrineConnection']); - $this->dispatcher->connect('doctrine.filter_model_builder_options', [$this, 'configureDoctrineModelBuilder']); - } - - public function initializeDoctrine() - { - chdir(sfConfig::get('sf_root_dir')); - - $task = new sfDoctrineBuildTask($this->dispatcher, new sfFormatter()); - $task->setConfiguration($this); - $task->run([], [ - 'no-confirmation' => true, - 'db' => true, - 'model' => true, - 'forms' => true, - 'filters' => true, - ]); - } - - public function loadFixtures($fixtures) - { - $path = sfConfig::get('sf_data_dir').'/'.$fixtures; - if (!file_exists($path)) { - throw new sfException('Invalid data fixtures file'); - } - chdir(sfConfig::get('sf_root_dir')); - $task = new sfDoctrineDataLoadTask($this->dispatcher, new sfFormatter()); - $task->setConfiguration($this); - $task->run([$path]); - } - - public function configureDoctrine(sfEvent $event) - { - $manager = $event->getSubject(); - $manager->setAttribute(Doctrine_Core::ATTR_VALIDATE, true); - } - - public function configureDoctrineModelBuilder(sfEvent $event, $options) - { - $options['baseClassName'] = 'myDoctrineRecord'; - - return $options; - } - - public function configureDoctrineConnection(sfEvent $event) - { - $parameters = $event->getParameters(); - - if ('doctrine2' === $parameters['connection']->getName()) { - $parameters['connection']->setAttribute(Doctrine_Core::ATTR_VALIDATE, false); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/databases.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/databases.yml deleted file mode 100644 index 387ad6dc4..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/databases.yml +++ /dev/null @@ -1,15 +0,0 @@ -all: - doctrine1: - class: sfDoctrineDatabase - param: - dsn: sqlite:///%SF_DATA_DIR%/database1.sqlite - doctrine2: - class: sfDoctrineDatabase - param: - dsn: sqlite:///%SF_DATA_DIR%/database2.sqlite - doctrine3: - class: sfDoctrineDatabase - param: - dsn: sqlite:///%SF_DATA_DIR%/database3.sqlite - attributes: - export: tables \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/linked_schema.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/linked_schema.yml deleted file mode 120000 index 65d4f1106..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/linked_schema.yml +++ /dev/null @@ -1 +0,0 @@ -../../data/linked_schema.yml \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/schema.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/schema.yml deleted file mode 100644 index 25723c322..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/doctrine/schema.yml +++ /dev/null @@ -1,233 +0,0 @@ ---- -Article: - actAs: - I18n: - fields: [title, body, test_column] - actAs: - Sluggable: - fields: [title] - uniqueBy: [lang, title] - Timestampable: - columns: - author_id: integer - is_on_homepage: boolean - title: - type: string(255) - unique: true - body: string(255) - test_column: string(255) - views: integer - relations: - Author: - foreignAlias: Articles - -BlogArticle: - inheritance: - extends: Article - type: column_aggregation - relations: - Author: - class: BlogAuthor - foreignAlias: Articles - -CamelCase: - columns: - article_id: integer - testCamelCase: string(255) - relations: - Article: - foreignAlias: camelCase - -Author: - columns: - name: string(255) - -AuthorInheritance: - inheritance: - extends: Author - type: column_aggregation - -BlogAuthor: - inheritance: - extends: Author - type: column_aggregation - -AuthorInheritanceConcrete: - inheritance: - extends: Author - columns: - additional: string(255) - -Subscription: - connection: doctrine2 - columns: - name: string(255) - status: - type: enum - values: [New, Active, Pending, Expired] - -User: - columns: - username: - type: string(255) - unique: true - password: string(255) - test: string(255) - relations: - Groups: - class: Group - refClass: UserGroup - foreignAlias: Users - Permissions: - class: Permission - refClass: UserPermission - foreignAlias: Users - -UniqueTest: - columns: - unique_test1: - type: string(255) - unique: true - unique_test2: string(255) - unique_test3: string(255) - unique_test4: string(255) - indexes: - unique_test: - fields: [unique_test1, unique_test2] - type: unique - unique_test2: - fields: - unique_test4: - sorting: ASC - length: 10 - type: unique - -Profile: - columns: - user_id: integer - first_name: string(255) - last_name: string(255) - relations: - User: - foreignType: one - -Group: - tableName: groups - columns: - name: string(255) - relations: - Permissions: - class: Permission - refClass: GroupPermission - foreignAlias: Groups - -Permission: - columns: - name: string(255) - -UserGroup: - options: - symfony: - form: false - filter: false - columns: - user_id: - type: integer - primary: true - group_id: - type: integer - primary: true - -UserPermission: - options: - symfony: - form: false - filter: false - columns: - user_id: - type: integer - primary: true - permission_id: - type: integer - primary: true - -GroupPermission: - options: - symfony: - form: false - filter: false - columns: - group_id: - type: integer - primary: true - permission_id: - type: integer - primary: true - -FormGeneratorTest: - options: - symfony: - form: true - filter: false - columns: - name: string(255) - -FormGeneratorTest2: - options: - symfony: - form: false - filter: true - columns: - name: string(255) - -FormGeneratorTest3: - options: - symfony: - form: false - filter: false - actAs: - I18n: - fields: [name] - columns: - name: string(255) - -DefaultValueTest: - columns: - name: - type: string(255) - notnull: true - default: '' - -Attachment: - columns: - file_path: string(255) - -ModelWithNumberInColumn: - options: - symfony: - form: false - filter: false - columns: - column_1: string(255) - column2: string(255) - column__3: string(255) - -ResourceType: - columns: - id: - type: enum - values: [type1, type2, type3] - primary: true - name: string(255) - -# tests merge from plugin schema -Setting: - actAs: - Timestampable: - updated: - disabled: true - columns: - name: - notnull: true - weight: - scale: 4 diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/properties.ini b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/properties.ini deleted file mode 100644 index db143e23e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/properties.ini +++ /dev/null @@ -1,2 +0,0 @@ -[symfony] - name=symfony12 diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/rsync_exclude.txt b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/rsync_exclude.txt deleted file mode 100644 index 2d99665d9..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/rsync_exclude.txt +++ /dev/null @@ -1,5 +0,0 @@ -.svn -/web/uploads/* -/cache/* -/log/* -/web/*_dev.php diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/schema.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/config/schema.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/fixtures.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/fixtures.yml deleted file mode 100644 index 954a5e550..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/fixtures.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -Article: - Article_1: - Author: jwage - is_on_homepage: false - Translation: - en: - title: English Title - body: English Body - fr: - title: French Title - body: French Body - Article_2: - Author: fabpot - Translation: - en: - title: English Title 2 - body: English Body 2 - fr: - title: French Title 2 - body: French Body 2 - -Author: - jwage: - name: Jonathan H. Wage - fabpot: - name: Fabien POTENCIER - -Subscription: - Subscription_1: - name: Subscription #1 - -User: - User_1: - username: jwage - password: changeme - Profile: - first_name: Jonathan - last_name: Wage - Groups: [Group_1] - Permissions: [Permission_3] - -Group: - Group_1: - name: Group 1 - Permissions: [Permission_1, Permission_2] - Group_2: - name: Group 2 - Permissions: [Permission_3, Permission_4] - -Permission: - Permission_1: - name: Permission 1 - Permission_2: - name: Permission 2 - Permission_3: - name: Permission 3 - Permission_4: - name: Permission 4 \ No newline at end of file diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/pager.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/pager.yml deleted file mode 100644 index ce7b0850e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/fixtures/pager.yml +++ /dev/null @@ -1,6 +0,0 @@ -Article: - # # - article: - title: "Article " - is_on_homepage: - # # diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/linked_schema.yml b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/linked_schema.yml deleted file mode 100755 index 3e77f02bd..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/linked_schema.yml +++ /dev/null @@ -1,7 +0,0 @@ -ModelFromLinkedSchema: - options: - symfony: - form: false - filter: false - columns: - name: string(255) diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/sql/schema.sql b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/sql/schema.sql deleted file mode 100644 index 7691a6205..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/data/sql/schema.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE article (id INTEGER PRIMARY KEY AUTOINCREMENT, author_id INTEGER, is_on_homepage INTEGER, views INTEGER, type VARCHAR(255), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL); -CREATE TABLE attachment (id INTEGER PRIMARY KEY AUTOINCREMENT, file_path VARCHAR(255)); -CREATE TABLE author (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), type VARCHAR(255)); -CREATE TABLE author_inheritance_concrete (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), type VARCHAR(255), additional VARCHAR(255)); -CREATE TABLE camel_case (id INTEGER PRIMARY KEY AUTOINCREMENT, article_id INTEGER, testcamelcase VARCHAR(255)); -CREATE TABLE default_value_test (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) DEFAULT '' NOT NULL); -CREATE TABLE form_generator_test (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255)); -CREATE TABLE form_generator_test2 (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255)); -CREATE TABLE form_generator_test3 (id INTEGER PRIMARY KEY AUTOINCREMENT); -CREATE TABLE groups (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255)); -CREATE TABLE group_permission (group_id INTEGER, permission_id INTEGER, PRIMARY KEY(group_id, permission_id)); -CREATE TABLE model_from_linked_schema (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255)); -CREATE TABLE model_with_number_in_column (id INTEGER PRIMARY KEY AUTOINCREMENT, column_1 VARCHAR(255), column2 VARCHAR(255), column__3 VARCHAR(255)); -CREATE TABLE permission (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255)); -CREATE TABLE profile (id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER, first_name VARCHAR(255), last_name VARCHAR(255)); -CREATE TABLE resource_type (id VARCHAR(255), name VARCHAR(255), PRIMARY KEY(id)); -CREATE TABLE setting (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) NOT NULL, value TEXT, weight DOUBLE, created_at DATETIME NOT NULL); -CREATE TABLE unique_test (id INTEGER PRIMARY KEY AUTOINCREMENT, unique_test1 VARCHAR(255) UNIQUE, unique_test2 VARCHAR(255), unique_test3 VARCHAR(255), unique_test4 VARCHAR(255)); -CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(255) UNIQUE, password VARCHAR(255), test VARCHAR(255)); -CREATE TABLE user_group (user_id INTEGER, group_id INTEGER, PRIMARY KEY(user_id, group_id)); -CREATE TABLE user_permission (user_id INTEGER, permission_id INTEGER, PRIMARY KEY(user_id, permission_id)); -CREATE INDEX article_type_idx ON article (type); -CREATE INDEX author_type_idx ON author (type); -CREATE INDEX author_type_idx ON author_inheritance_concrete (type); -CREATE UNIQUE INDEX unique_test_idx ON unique_test (unique_test1, unique_test2); -CREATE UNIQUE INDEX unique_test2_idx ON unique_test (unique_test4 ASC); -CREATE TABLE subscription (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255), status VARCHAR(255)); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/filter/doctrine/ArticleFormFilter.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/filter/doctrine/ArticleFormFilter.class.php deleted file mode 100644 index 2c6e4709b..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/filter/doctrine/ArticleFormFilter.class.php +++ /dev/null @@ -1,11 +0,0 @@ -embedI18n(['en', 'fr']); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/ArticleTranslationForm.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/ArticleTranslationForm.class.php deleted file mode 100644 index 8992dc5c7..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/ArticleTranslationForm.class.php +++ /dev/null @@ -1,11 +0,0 @@ -widgetSchema['file_path'] = new sfWidgetFormInputFileEditable([ - 'file_src' => sfConfig::get('sf_cache_dir').'/'.$this->getObject()->file_path, - 'edit_mode' => !$this->isNew(), - ]); - $this->validatorSchema['file_path'] = new sfValidatorFile([ - 'path' => sfConfig::get('sf_cache_dir'), - 'mime_type_guessers' => [], - 'required' => false, - ]); - $this->validatorSchema['file_path_delete'] = new sfValidatorBoolean(); - } - - protected function generateFilePathFilename() - { - return self::TEST_GENERATED_FILENAME; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AuthorForm.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AuthorForm.class.php deleted file mode 100644 index 40e2b1dba..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/form/doctrine/AuthorForm.class.php +++ /dev/null @@ -1,11 +0,0 @@ -object->getProfile()); - unset($profileForm['id'], $profileForm['user_id']); - - $this->embedForm('Profile', $profileForm); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Article.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Article.class.php deleted file mode 100644 index 84c8098c0..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Article.class.php +++ /dev/null @@ -1,12 +0,0 @@ -slug; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/ArticleTable.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/ArticleTable.class.php deleted file mode 100644 index 2073bc204..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/ArticleTable.class.php +++ /dev/null @@ -1,79 +0,0 @@ -execute(); - } - - public function retrieveArticle2(array $parameters) - { - $query = $this->createQuery('a'); - - return $query->execute(); - } - - public function retrieveArticle3(array $parameters) - { - $query = $this->createQuery('a'); - - return $query->execute(); - } - - public function retrieveArticle4(array $parameters) - { - $query = $this->createQuery('a'); - - return $query->fetchOne(); - } - - public function routeTest9(array $parameters) - { - return Doctrine_Query::create() - ->from('Article a') - ->where('a.id = ?', $parameters['id']) - ->limit(1) - ->execute() - ; - } - - public function routeTest10(Doctrine_Query $q) - { - $q->orWhere($q->getRootAlias().'.is_on_homepage = ?', 0); - - return $q->fetchOne(); - } - - public function testAdminGenTableMethod(Doctrine_Query $q) - { - return $q; - } - - public function getNewQuery() - { - return $this->createQuery()->select('title, body'); - } - - public function addOnHomepage(?Doctrine_Query $q = null) - { - if (is_null($q)) { - $q = $this->createQuery('a'); - } - $alias = $q->getRootAlias(); - - return $q->addWhere($alias.'.is_on_homepage = 1'); - } - - public function filterSuppliedQuery($query) - { - $query->select('title, body'); - } - - public function filterSuppliedQueryAndReturn($query) - { - return $query->select('title, body'); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Attachment.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Attachment.class.php deleted file mode 100644 index 9429d328c..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/Attachment.class.php +++ /dev/null @@ -1,12 +0,0 @@ -exists()) { - $author = Doctrine_Core::getTable('Author')->findOneByName(trim($name)); - if ($author) { - $this->assignIdentifier($author->identifier()); - } else { - return $this->_set('name', $name); - } - } else { - return $this->_set('name', $name); - } - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritance.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritance.class.php deleted file mode 100644 index 712c5f008..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritance.class.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -class AuthorInheritance extends BaseAuthorInheritance -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcrete.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcrete.class.php deleted file mode 100644 index 137837490..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcrete.class.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -class AuthorInheritanceConcrete extends BaseAuthorInheritanceConcrete -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcreteTable.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcreteTable.class.php deleted file mode 100644 index 24d7647d8..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/AuthorInheritanceConcreteTable.class.php +++ /dev/null @@ -1,5 +0,0 @@ -createQuery('a') - ->where('a.id > 0') - ; - } - - public function testTableMethod2(Doctrine_Query $q) - { - $q->addWhere('a.id > 0'); - - return $q; - } - - public function getChoices($limit = null) - { - $q = $this->createQuery('a'); - if (null !== $limit) { - $q->limit($limit); - } - $choices = []; - - foreach ($q->fetchArray() as $author) { - $choices[$author['id']] = $author['name']; - } - - return $choices; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/BlogArticle.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/BlogArticle.class.php deleted file mode 100644 index f9ee0479e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/BlogArticle.class.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -class CamelCase extends BaseCamelCase -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/CamelCaseTable.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/CamelCaseTable.class.php deleted file mode 100644 index 1b19bd7a3..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/CamelCaseTable.class.php +++ /dev/null @@ -1,5 +0,0 @@ - - * - * @internal - * - * @coversNothing - */ -class DefaultValueTest extends BaseDefaultValueTest -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/DefaultValueTestTable.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/DefaultValueTestTable.class.php deleted file mode 100644 index 5ff964b04..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/DefaultValueTestTable.class.php +++ /dev/null @@ -1,5 +0,0 @@ - - * - * @internal - * - * @coversNothing - */ -class FormGeneratorTest extends BaseFormGeneratorTest -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2.class.php deleted file mode 100644 index c9407450e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2.class.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -class FormGeneratorTest2 extends BaseFormGeneratorTest2 -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2Table.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2Table.class.php deleted file mode 100644 index 9ad271589..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/FormGeneratorTest2Table.class.php +++ /dev/null @@ -1,5 +0,0 @@ -_set('password', md5($password)); - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/UserGroup.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/UserGroup.class.php deleted file mode 100644 index 5253c65af..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/model/doctrine/UserGroup.class.php +++ /dev/null @@ -1,8 +0,0 @@ -createQuery('u'); - } - - public function widgetChoiceTableMethod2() - { - return $this->widgetChoiceTableMethod1() - ->execute() - ; - } - - public function widgetChoiceTableMethod3() - { - return $this->widgetChoiceTableMethod1() - ->fetchOne() - ; - } - - public function widgetChoiceTableMethod4() - { - return $this->widgetChoiceTableMethod1() - ->where('1 = 0') - ->execute() - ; - } -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/myDoctrineRecord.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/myDoctrineRecord.class.php deleted file mode 100644 index e4c7f680f..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/lib/myDoctrineRecord.class.php +++ /dev/null @@ -1,5 +0,0 @@ - - */ -abstract class PluginSetting extends BaseSetting -{ -} diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/plugins/SettingsPlugin/lib/model/doctrine/PluginSettingTable.class.php b/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/plugins/SettingsPlugin/lib/model/doctrine/PluginSettingTable.class.php deleted file mode 100644 index c8272056c..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/fixtures/plugins/SettingsPlugin/lib/model/doctrine/PluginSettingTable.class.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -chdir(dirname(__FILE__)); -require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php'); -$configuration = new ProjectConfiguration(); -include($configuration->getSymfonyLibDir().'/command/cli.php'); diff --git a/lib/plugins/sfDoctrinePlugin/test/functional/sfDoctrineRecordTest.php b/lib/plugins/sfDoctrinePlugin/test/functional/sfDoctrineRecordTest.php deleted file mode 100644 index 31f52561b..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/functional/sfDoctrineRecordTest.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -$app = 'frontend'; -$fixtures = 'fixtures/fixtures.yml'; - -require_once dirname(__FILE__).'/../bootstrap/functional.php'; - -$t = new lime_test(22); - -$authors = Doctrine_Core::getTable('Author')->findAll(); -$t->is(count($authors), 2); - -$author = new Author(); - -// Accessor overriding -$author->setName('Jonathan H. Wage'); -$author->save(); - -// Propel style accessors with column name -$t->is($author->getName(), $author->name); - -// Propel style accessors for id -// Also check new author was not created since Jonathan H. Wage exists in fixtures/fixtures.yml -$t->is($author->getId(), 1); - -// Make sure we still have only 2 authors -$authors = Doctrine_Core::getTable('Author')->findAll(); -$t->is(count($authors), 2); - -$article = new Article(); -$article->title = 'test'; - -// __toString() automatic column finder -$t->is((string) $article, 'test'); - -// Different style accessors -$t->is($article->getAuthor_id(), $article->author_id); -$t->is($article->getAuthorId(), $article->author_id); -$t->is($article->getauthorId(), $article->author_id); -$t->is($article->getAuthorID(), $article->author_id); -$t->is($article->getauthor_id(), $article->author_id); - -// Camel case columns -$camelCase = new CamelCase(); -$camelCase->testCamelCase = 'camel'; -$camelCase->setTestCamelCase('camel'); - -$t->is($camelCase->getTestCamelCase(), 'camel'); -$t->is($camelCase->gettestCamelCase(), 'camel'); -$t->is($camelCase->gettestcamelcase(), 'camel'); -$t->is($camelCase->gettest_camel_case(), 'camel'); -$t->is($camelCase->getTest_camel_case(), 'camel'); - -// Propel style accessors work with relationships -$article->setAuthor($author); -$t->is($article->Author, $author); -$t->is($article->getAuthor(), $author); - -// Camel case with relationships -$t->is($article->getCamelCase()->getTable()->getOption('name'), 'CamelCase'); - -// Test getDateTimeObject() -$dateTime = $article->getDateTimeObject('created_at'); -$t->is($dateTime, null); - -try { - $article->getDateTimeObject('author_id'); - $t->fail(); -} catch (sfException $e) { - $t->pass(); -} - -$article->setDateTimeObject('created_at', new DateTime('1985-09-01')); -$t->is($article->getDateTimeObject('created_at')->format('m/d/Y'), '09/01/1985'); - -$article->setDateTimeObject('created_at', null); -$dateTime = $article->getDateTimeObject('created_at'); -$t->is($dateTime, null); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormDoctrineTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormDoctrineTest.php deleted file mode 100644 index 1ec7fe7a7..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormDoctrineTest.php +++ /dev/null @@ -1,98 +0,0 @@ -__construct() -$t->diag('->__construct()'); - -class NumericFieldForm extends ArticleForm -{ - public function configure() - { - $this->widgetSchema[1] = new sfWidgetFormInputText(); - $this->validatorSchema[1] = new sfValidatorPass(); - $this->setDefault(1, '==DEFAULT_VALUE=='); - } -} - -$form = new NumericFieldForm(); -$defaults = $form->getDefaults(); -$t->is($defaults[1], '==DEFAULT_VALUE==', '->__construct() allows ->configure() to set defaults on numeric fields'); - -class DefaultValuesForm extends AuthorForm -{ - public function configure() - { - $this->setDefault('name', 'John Doe'); - } -} - -$author = new Author(); -$form = new DefaultValuesForm($author); -$t->is($form->getDefault('name'), 'John Doe', '->__construct() uses form defaults for new objects'); - -$author = new Author(); -$author->name = 'Jacques Doe'; -$author->save(); -$form = new DefaultValuesForm($author); -$t->is($form->getDefault('name'), 'Jacques Doe', '->__construct() uses object value as a default for existing objects'); -$author->delete(); - -// ->embedRelation() -$t->diag('->embedRelation()'); - -class myArticleForm extends ArticleForm -{ -} - -$table = Doctrine_Core::getTable('Author'); -$form = new AuthorForm($table->create([ - 'Articles' => [ - ['title' => 'Article 1'], - ['title' => 'Article 2'], - ['title' => 'Article 3'], - ], -])); - -$form->embedRelation('Articles'); -$embeddedForms = $form->getEmbeddedForms(); - -$t->ok(isset($form['Articles']), '->embedRelation() embeds forms'); -$t->is(count($embeddedForms['Articles']), 3, '->embedRelation() embeds one form for each related object'); - -$form->embedRelation('Articles', 'myArticleForm', [['test' => true]]); -$embeddedForms = $form->getEmbeddedForms(); -$moreEmbeddedForms = $embeddedForms['Articles']->getEmbeddedForms(); -$t->isa_ok($moreEmbeddedForms[0], 'myArticleForm', '->embedRelation() accepts a form class argument'); -$t->ok($moreEmbeddedForms[0]->getOption('test'), '->embedRelation() accepts a form arguments argument'); - -$form = new AuthorForm($table->create([ - 'Articles' => [ - ['title' => 'Article 1'], - ['title' => 'Article 2'], - ], -])); -$form->embedRelation('Articles as author_articles'); -$t->is(isset($form['author_articles']), true, '->embedRelation() embeds using an alias'); -$t->is(count($form['author_articles']), 2, '->embedRelation() embeds one form for each related object using an alias'); - -$form = new AuthorForm($table->create([ - 'Articles' => [ - ['title' => 'Article 1'], - ['title' => 'Article 2'], - ], -])); -$form->embedRelation('Articles AS author_articles'); -$t->is(isset($form['author_articles']), true, '->embedRelation() embeds using an alias with a case insensitive separator'); - -$form = new ArticleForm(Doctrine_Core::getTable('Article')->create([ - 'Author' => ['name' => 'John Doe'], -])); -$form->embedRelation('Author'); -$t->is(isset($form['Author']), true, '->embedRelation() embeds a ONE type relation'); -$t->is(isset($form['Author']['name']), true, '->embedRelation() embeds a ONE type relation'); -$t->is($form['Author']['name']->getValue(), 'John Doe', '->embedRelation() uses values from the related object'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormFilterDoctrineTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormFilterDoctrineTest.php deleted file mode 100644 index a5de02957..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/form/sfFormFilterDoctrineTest.php +++ /dev/null @@ -1,131 +0,0 @@ -setWidgets([ - 'name' => new sfWidgetFormInputText(), - 'nomethod_bc' => new sfWidgetFormInputText(), - 'nomethod' => new sfWidgetFormInputText(), - 'author_id' => new sfWidgetFormInputText(), - ]); - - $this->setValidators([ - 'name' => new sfValidatorPass(), - 'nomethod_bc' => new sfValidatorPass(), - 'nomethod' => new sfValidatorPass(), - 'author_id' => new sfValidatorPass(), - ]); - } - - public function addNameColumnQuery($query, $field, $value) - { - $this->processedFields[] = $field; - } - - public function getFields() - { - return array_merge(parent::getFields(), [ - 'body' => 'Invalid', - 'nomethod_bc' => 'Text', - 'author_id' => 'Number', - ]); - } -} - -$t->diag('->getQuery()'); - -$filter = new ArticleFormFilter(); -$filter->bind([]); -$t->isa_ok($filter->getQuery(), 'Doctrine_Query', '->getQuery() returns a Doctrine_Query object'); - -$query = Doctrine_Query::create()->select('title, body'); - -$filter = new ArticleFormFilter([], ['query' => $query]); -$filter->bind([]); -$t->is_deeply($filter->getQuery()->getDqlPart('select'), ['title, body'], '->getQuery() uses the query option'); -$t->ok($filter->getQuery() !== $query, '->getQuery() clones the query option'); - -// BC with symfony 1.2 -$filter = new TestFormFilter(); -$filter->bind(['nomethod_bc' => 'nomethod_bc']); - -try { - $filter->getQuery(); - $t->fail('->getQuery() throws an exception if a field that is not a real column is specified in getFields() but a column method does not exist'); -} catch (Exception $e) { - $t->pass('->getQuery() throws an exception if a field that is not a real column is specified in getFields() but a column method does not exist'); -} - -// BC with symfony 1.2 -$filter = new TestFormFilter(); -$filter->bind(['body' => 'body']); - -try { - $filter->getQuery(); - $t->fail('->getQuery() throws an exception if a field is a real column and neither a column nor type method exists'); -} catch (Exception $e) { - $t->pass('->getQuery() throws an exception if a field is a real column and neither a column nor type method exists'); -} - -// BC with symfony 1.2 -$filter = new TestFormFilter(); -$filter->bind(['nomethod' => 'nomethod']); - -try { - $filter->getQuery(); - $t->pass('->getQuery() does not throw an exception when a value without a query method is passed'); -} catch (Exception $e) { - $t->fail('->getQuery() does not throw an exception when a value without a query method is passed'); -} - -// new in symfony 1.3 -$filter = new TestFormFilter(); -$filter->bind(['name' => 'Kris Wallsmith']); -$filter->getQuery(); -$t->is_deeply($filter->processedFields, ['name'], '->getQuery() processes fields not specified in getFields()'); - -// pass 0 to number filter -$filter = new TestFormFilter(); -$filter->bind(['author_id' => ['text' => 0]]); -$query = $filter->getQuery(); -$t->is(trim($query->getDql()), 'FROM Article r WHERE r.author_id = ?', '->getQuery() filters by a 0 number'); -$t->is($query->getFlattenedParams(), [0], '->getQuery() filters by a 0 number'); - -$filter = new ArticleFormFilter(); -$filter->bind(['type' => ['is_empty' => '1', 'text' => '']]); -$query = $filter->getQuery(); -$t->is(trim($query->getDql()), 'FROM Article r WHERE (r.type IS NULL OR r.type = ?)', '->getQuery() tests for null or empty text fields'); -$t->is($query->getFlattenedParams(), [''], '->getQuery() tests for null or empty text fields'); - -$filter = new ArticleFormFilter(); -$filter->bind(['views' => ['is_empty' => '1', 'text' => '']]); -$query = $filter->getQuery(); -$t->is(trim($query->getDql()), 'FROM Article r WHERE (r.views IS NULL OR r.views = ?)', '->getQuery() tests for null or empty number fields'); -$t->is($query->getFlattenedParams(), [''], '->getQuery() tests for null or empty number fields'); - -$t->diag('->setTableMethod()'); - -$filter = new ArticleFormFilter(); -$filter->setTableMethod('getNewQuery'); -$filter->bind([]); -$t->is_deeply($filter->getQuery()->getDqlPart('select'), ['title, body'], '->setTableMethod() specifies a method that can return a new query'); - -$filter = new ArticleFormFilter(); -$filter->setTableMethod('filterSuppliedQuery'); -$filter->bind([]); -$t->is_deeply($filter->getQuery()->getDqlPart('select'), ['title, body'], '->setTableMethod() specifies a method that can modify the supplied query'); - -$filter = new ArticleFormFilter(); -$filter->setTableMethod('filterSuppliedQueryAndReturn'); -$filter->bind([]); -$t->is_deeply($filter->getQuery()->getDqlPart('select'), ['title, body'], '->setTableMethod() specifies a method that can modify and return the supplied query'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/pager/sfDoctrinePagerTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/pager/sfDoctrinePagerTest.php deleted file mode 100644 index 55c91293f..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/pager/sfDoctrinePagerTest.php +++ /dev/null @@ -1,61 +0,0 @@ -getResults() -$t->diag('->getResults()'); - -$query = Doctrine_Core::getTable('Article')->createQuery(); -$query->setHydrationMode(Doctrine_Core::HYDRATE_NONE); -$pager = new sfDoctrinePager('Article', 10); -$pager->setQuery($query); -$pager->init(); -$t->isa_ok($pager->getResults(), 'array', '->getResults() uses the hydration mode set on the query'); - -// ->getNbResults() -$t->diag('->getNbResults()'); - -$pager = new sfDoctrinePager('Article', 10); -$pager->init(); -$count = Doctrine_Core::getTable('Article')->createQuery()->count(); -$t->is($pager->getNbResults(), $count, '->getNbResults() returns the number of results'); - -// Countable interface -$t->diag('Countable interface'); - -$pager = new sfDoctrinePager('Article', 10); -$pager->init(); -$t->is(count($pager), $pager->getNbResults(), '"Countable" interface returns the total number of objects'); - -// Iterator interface -$t->diag('Iterator interface'); - -$pager = new sfDoctrinePager('Article', 10); -$pager->init(); -$normal = 0; -$iterated = 0; -foreach ($pager->getResults() as $object) { - ++$normal; -} -foreach ($pager as $object) { - ++$iterated; -} -$t->is($iterated, $normal, '"Iterator" interface loops over objects in the current pager'); - -// ->setTableMethod() -$t->diag('->setTableMethod()'); -$pager = new sfDoctrinePager('Article', 10); -$pager->setTableMethod('addOnHomepage'); -$pager->init(); -$t->is($pager->getNbResults(), count(Doctrine_Core::getTable('Article')->findByIsOnHomepage('1')), '->setTableMethod() update the query'); - -// Serialization test for defect #7987 -$t->diag('Serialization'); -$pager = unserialize(serialize($pager)); -$pager->init(); -$t->is($pager->getNbResults(), count(Doctrine_Core::getTable('Article')->findByIsOnHomepage('1')), 'serialization preserves TableMethod functionality'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/record/sfDoctrineRecordTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/record/sfDoctrineRecordTest.php deleted file mode 100644 index 52d19518e..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/record/sfDoctrineRecordTest.php +++ /dev/null @@ -1,79 +0,0 @@ -__construct() -$t->diag('->__construct()'); - -function is_symfony_i18n_filter($filter) -{ - return $filter instanceof sfDoctrineRecordI18nFilter; -} - -$table = Doctrine_Core::getTable('Article'); -new Article(); -$t->is(count(array_filter($table->getFilters(), 'is_symfony_i18n_filter')), 1, '->__construct() adds i18n filter'); -new Article(); -$t->is(count(array_filter($table->getFilters(), 'is_symfony_i18n_filter')), 1, '->__construct() adds i18n filter once'); - -// ->serialize() ->unserialize() -$t->diag('->serialize() ->unserialize()'); - -$before = new Author(); -$before->name = 'test'; -$serialized = serialize($before); -$after = unserialize($serialized); -$t->is($after->name, 'test', '->unserialize() maintains field values'); - -$conn = Doctrine_Manager::getInstance()->getConnectionForComponent('Author'); -$before = new Author(); -$before->name = 'test'; -$serialized = serialize($before); -$conn->clear(); -$conn->evictTables(); -$after = unserialize($serialized); -$t->is($after->name, 'test', '->unserialize() maintains field values upon reset'); - -$before = new Article(); -$before->title = 'test'; -$serialized = serialize($before); -$after = unserialize($serialized); -$t->is($after->title, 'test', '->unserialize() maintains field values on I18n records'); - -$conn = Doctrine_Manager::getInstance()->getConnectionForComponent('Article'); -$before = new Article(); -$before->title = 'test'; -$serialized = serialize($before); -$conn->clear(); -$conn->evictTables(); -$after = unserialize($serialized); -$t->is($after->title, 'test', '->unserialize() maintains field values on I18n records upon reset'); - -$article = new Article(); - -try { - $article->setAuthor(new stdClass()); -} catch (Exception $e) { - $t->is($e->getMessage(), 'Couldn\'t call Doctrine_Core::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references.', 'Making sure proper exception message is thrown'); -} - -$article = new Article(); -$article->title = 'testing this out'; -$serialized = serialize($article); -$article = unserialize($serialized); - -$t->is($article->getTitle(), 'testing this out', 'Making sure getTitle() is still accessible after unserializing'); - -try { - $test = new ModelWithNumberInColumn(); - $test->getColumn_1(); - $test->getColumn_2(); - $test->getColumn__3(); - $t->pass('Make sure __call() handles fields with *_(n) in the field name'); -} catch (Exception $e) { - $t->fail('__call() failed in sfDoctrineRecord'); -} diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineColumnTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineColumnTest.php deleted file mode 100644 index 8f6e2e845..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineColumnTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include dirname(__FILE__).'/../bootstrap/unit.php'; - -$t = new lime_test(23); - -$conn = Doctrine_Manager::connection(new Doctrine_Adapter_Mock('mysql')); - -/** - * @internal - * - * @coversNothing - */ -class Test extends sfDoctrineRecord -{ - public function setUp() - { - $this->hasMany('TestRelation as TestRelations', ['local' => 'id', 'foreign' => 'test_id']); - } - - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 255, ['notblank' => true]); - $this->hasColumn('test as TEST', 'string', 255); - $this->hasColumn('email', 'string', 255, ['email' => true, 'notnull' => true]); - } -} - -class TestRelation extends sfDoctrineRecord -{ - public function setUp() - { - $this->hasOne('Test', ['local' => 'test_id', 'foreign' => 'id']); - } - - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 255); - $this->hasColumn('test_id', 'integer'); - } -} - -$column = new sfDoctrineColumn('name', Doctrine_Core::getTable('Test')); -$t->is($column->getName(), 'name'); -$t->is($column->getFieldName(), 'name'); -$t->is($column->getPhpName(), 'name'); -$t->is($column->isNotNull(), true); - -$column = new sfDoctrineColumn('test', Doctrine_Core::getTable('Test')); -$t->is($column->getName(), 'test'); -$t->is($column->getFieldName(), 'TEST'); -$t->is($column->getPhpName(), 'TEST'); - -$t->is($column->getDoctrineType(), 'string'); -$t->is($column->getType(), 'VARCHAR'); -$t->is($column->getLength(), 255); -$t->is($column->getSize(), 255); -$t->is($column->hasDefinitionKey('length'), true); -$t->is($column->getDefinitionKey('type'), 'string'); -$t->is($column->isNotNull(), false); - -// Is not null and has definition key -$column = new sfDoctrineColumn('email', Doctrine_Core::getTable('Test')); -$t->is($column->isNotNull(), true); -$t->is($column->hasDefinitionKey('email'), true); -$t->is($column->getDefinitionKey('email'), true); - -// Is primary key -$column = new sfDoctrineColumn('id', Doctrine_Core::getTable('Test')); -$t->is($column->isPrimaryKey(), true); - -// Relation/foreign key functions -$column = new sfDoctrineColumn('test_id', Doctrine_Core::getTable('TestRelation')); -$t->is($column->isForeignKey(), true); -$t->is($column->getForeignClassName(), 'Test'); -$t->is($column->getForeignTable()->getOption('name'), 'Test'); -$t->is($column->getTable()->getOption('name'), 'TestRelation'); - -// Array access -$t->is($column['type'], 'integer'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineDatabaseTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineDatabaseTest.php deleted file mode 100644 index c329aa7f7..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/sfDoctrineDatabaseTest.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -include dirname(__FILE__).'/../bootstrap/unit.php'; - -$t = new lime_test(4); - -class ProjectConfiguration extends sfProjectConfiguration -{ -} - -$configuration = new ProjectConfiguration(dirname(__FILE__).'/../../lib', new sfEventDispatcher()); - -$parameters = [ - 'name' => 'doctrine', - 'dsn' => 'sqlite::memory', - 'attributes' => [ - 'use_native_enum' => true, - 'validate' => 'all', - 'tblname_format' => 'test_%s', - ], -]; - -$p = new sfDoctrineDatabase($parameters); -$t->is($p->getDoctrineConnection()->getName(), 'doctrine', 'initialize() - creates a valid doctrine configuration from parameters'); -$t->is($p->getDoctrineConnection()->getAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM), true, 'initialize() - setups doctrine attributes - attribute value is not a string'); -$t->is($p->getDoctrineConnection()->getAttribute(Doctrine_Core::ATTR_VALIDATE), Doctrine_Core::VALIDATE_ALL, 'initialize() - setups doctrine attributes - attribute value is a string and constant exists'); -$t->is($p->getDoctrineConnection()->getAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT), $parameters['attributes']['tblname_format'], 'initialize() - setups doctrine attributes - attribute value is a string and constant not exists'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/validator/sfValidatorDoctrineChoiceTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/validator/sfValidatorDoctrineChoiceTest.php deleted file mode 100644 index 7cf5d2f77..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/validator/sfValidatorDoctrineChoiceTest.php +++ /dev/null @@ -1,19 +0,0 @@ -clean() -$t->diag('->clean()'); - -$query = Doctrine_Core::getTable('Author')->createQuery(); -$validator = new sfValidatorDoctrineChoice(['model' => 'Author', 'query' => $query]); - -$author = Doctrine_Core::getTable('Author')->createQuery()->limit(1)->fetchOne(); -$validator->clean($author->id); - -$t->is(trim($query->getDql()), 'FROM Author', '->clean() does not change the supplied query object'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineArrayChoiceTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineArrayChoiceTest.php deleted file mode 100644 index 67ce9d191..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineArrayChoiceTest.php +++ /dev/null @@ -1,19 +0,0 @@ -getChoices() -$t->diag('->getChoices()'); - -$validator = new sfWidgetFormDoctrineArrayChoice(['model' => 'Author', 'table_method' => 'getChoices']); - -$t->is_deeply($validator->getChoices(), [1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'], '->getChoices() returns choices'); - -$validator->setOption('table_method_params', [1]); - -$t->is_deeply($validator->getChoices(), [1 => 'Jonathan H. Wage'], '->getChoices() returns limited choices'); diff --git a/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineChoiceTest.php b/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineChoiceTest.php deleted file mode 100644 index 94f27af37..000000000 --- a/lib/plugins/sfDoctrinePlugin/test/unit/widget/sfWidgetFormDoctrineChoiceTest.php +++ /dev/null @@ -1,29 +0,0 @@ -getChoices() -$t->diag('->getChoices()'); - -$validator = new sfWidgetFormDoctrineChoice(['model' => 'Author']); - -$author = Doctrine_Core::getTable('Author')->createQuery()->limit(1)->fetchOne(); - -$t->is_deeply($validator->getChoices(), [1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'], '->getChoices() returns choices'); - -$validator->setOption('order_by', ['name', 'asc']); - -$t->cmp_ok($validator->getChoices(), '===', [2 => 'Fabien POTENCIER', 1 => 'Jonathan H. Wage'], '->getChoices() returns ordered choices'); - -$validator->setOption('table_method', 'testTableMethod'); - -$t->is_deeply($validator->getChoices(), [1 => 'Jonathan H. Wage', 2 => 'Fabien POTENCIER'], '->getChoices() returns choices for given "table_method" option'); - -$validator = new sfWidgetFormDoctrineChoice(['model' => 'Author', 'query' => Doctrine_Core::getTable('Author')->createQuery()->limit(1)]); - -$t->is_deeply($validator->getChoices(), [1 => 'Jonathan H. Wage'], '->getChoices() returns choices for given "query" option'); diff --git a/lib/plugins/sfDoctrinePlugin/web/css/default.css b/lib/plugins/sfDoctrinePlugin/web/css/default.css deleted file mode 100644 index 7abcfd8d6..000000000 --- a/lib/plugins/sfDoctrinePlugin/web/css/default.css +++ /dev/null @@ -1,271 +0,0 @@ -#sf_admin_container a -{ - color: #464646; - text-decoration: none; -} - -#sf_admin_container a:hover -{ - color: #000; - text-decoration: underline; -} - -#sf_admin_container h1 -{ - margin: 0; - padding: 0; - margin-bottom: 20px; -} - -#sf_admin_container th -{ - background-color: #e7eef6; - white-space: nowrap; -} - -#sf_admin_container td, #sf_admin_container th -{ - border: 0; - border-bottom: 1px solid #ddd; - border-top: 1px solid #ddd; - text-align: left; - vertical-align: top; -} - -#sf_admin_container tr -{ - background-color: #fff; - border-left: 1px solid #ddd; - border-right: 1px solid #ddd; -} - -#sf_admin_container ul.error_list -{ - margin: 0; - margin-bottom: 7px; - color: #d33; - border: none; - background-color: #f33; -} - -#sf_admin_container ul.error_list li -{ - padding: 4px; - padding-left: 25px; - list-style: none; - color: #fff; - background: url(../images/error.png) no-repeat 4px 4px; -} - -#sf_admin_container tr:hover -{ - background-color: #ffe; -} - -#sf_admin_container input, #sf_admin_container textarea -{ - width: auto; -} - -#sf_admin_container .radio_list, #sf_admin_container .checkbox_list -{ - margin: 0; -} - -#sf_admin_container .radio_list li, #sf_admin_container .checkbox_list li -{ - list-style: none; - display: inline; -} - -#sf_admin_container .double_list_select, #sf_admin_container .double_list_select-selected -{ - width: 12em; -} - -#sf_admin_container .double_list_label -{ - font-weight: bold; -} - -#sf_admin_container tfoot td -{ - margin: 0; - list-style: none; - text-align: right; -} - -#sf_admin_container thead img, #sf_admin_container tfoot img -{ - vertical-align: middle; -} - -#sf_admin_bar -{ - float: right; - margin-left: 20px; -} - -.sf_admin_pagination -{ - float: right; -} - -#sf_admin_container ul.sf_admin_td_actions -{ - margin: 0; - padding: 0; - list-style-type: none; -} - -#sf_admin_container ul.sf_admin_td_actions li -{ - list-style-type: none; - display: inline; - margin-right: 10px; - font-size: 90%; -} - -#sf_admin_container ul.sf_admin_actions -{ - margin: 10px 0; - list-style-type: none; -} - -#sf_admin_container ul.sf_admin_actions li -{ - list-style-type: none; - display: inline; - margin-right: 10px; -} - -#sf_admin_container ul.sf_admin_actions li a, -#sf_admin_container ul.sf_admin_td_actions li a -{ - padding-left: 20px; - background: url(../images/default.png) no-repeat 0 0; -} - -#sf_admin_container ul li.sf_admin_action_new a -{ - background: url(../images/new.png) no-repeat 0 0; -} - -#sf_admin_container ul li.sf_admin_action_delete a -{ - background: url(../images/delete.png) no-repeat 0 0; -} - -#sf_admin_container ul li.sf_admin_action_list a -{ - background: url(../images/list.png) no-repeat 0 0; -} - -#sf_admin_container ul li.sf_admin_action_edit a -{ - background: url(../images/edit.png) no-repeat 0 0; -} - -#sf_admin_container .notice -{ - margin: 4px 0; - padding: 4px 4px 4px 30px; - background: url(../images/tick.png) no-repeat 10px 4px; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - background-color: #ffc; -} - -#sf_admin_container .error -{ - margin: 4px 0; - padding: 4px 4px 4px 30px; - background: url(../images/error.png) no-repeat 10px 4px; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - background-color: #f33; - color: #fff; -} - -#sf_admin_container .sf_admin_row_0 td -{ -} - -#sf_admin_container .sf_admin_row_1 td -{ -/* background-color: #eee;*/ -} - -#sf_admin_container fieldset h2 -{ - padding: 3px; - color: #333; - background-color: #ccf; - font-size: 11px; - margin: 0; -} - -#sf_admin_container fieldset -{ - margin-bottom: 3px; - border: 1px solid #ddd; - border-bottom: 0px; - background-color: #fff; -} - -#sf_admin_container fieldset.collapsed * { display:none; } -#sf_admin_container fieldset.collapsed h2, #sf_admin_container fieldset.collapsed { display:block !important; } -#sf_admin_container fieldset.collapsed .collapse-toggle { display: inline !important; } -#sf_admin_container fieldset.collapse h2 a.collapse-toggle { color:#ffc; } -#sf_admin_container fieldset.collapse h2 a.collapse-toggle:hover { text-decoration:underline; } - -#sf_admin_container label -{ - display: block; - padding: 0 1em 3px 0; - float: left; - text-align: left; - width: 8em; - color: #666; - font-weight: normal !important; -} - -#sf_admin_container ul label, #sf_admin_container td label -{ - display: inline; - float: none !important; -} - -#sf_admin_container .sf_admin_form_row -{ - clear: both; - padding: 10px; - border-bottom: 1px solid #ddd; -} - -#sf_admin_container .sf_admin_form_row .content -{ - padding-left: 9em; -} - -#sf_admin_container .help -{ - padding-left: 9em; - color: #aaa; -} - -#sf_admin_container td .help -{ - padding-left: 0; -} - -#sf_admin_container .errors input, #sf_admin_container .errors select -{ - border: 1px solid #f22; -} - -#sf_admin_container .sf_admin_list .sf_admin_boolean -{ - text-align: center; -} - diff --git a/lib/plugins/sfDoctrinePlugin/web/css/global.css b/lib/plugins/sfDoctrinePlugin/web/css/global.css deleted file mode 100644 index 9760cb288..000000000 --- a/lib/plugins/sfDoctrinePlugin/web/css/global.css +++ /dev/null @@ -1,34 +0,0 @@ -/* http://yui.yahooapis.com/2.6.0/build/reset/reset-min.css -Copyright (c) 2008, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.6.0 -*/ -html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}del,ins{text-decoration:none;} - -/* http://yui.yahooapis.com/2.6.0/build/fonts/fonts-min.css -Copyright (c) 2008, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.6.0 -*/ -body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea{font:99% arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;} - -/* http://yui.yahooapis.com/2.6.0/build/base/base-min.css -Copyright (c) 2008, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.6.0 -*/ -h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:bold;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;} em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}input[type=text],input[type=password],textarea{width:12.25em;*width:11.9em;} - -html -{ - background-color: #eee; -} - -body -{ - padding: 30px; - text-align: left; -} diff --git a/lib/plugins/sfDoctrinePlugin/web/images/asc.png b/lib/plugins/sfDoctrinePlugin/web/images/asc.png deleted file mode 100755 index 12ba77067..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/asc.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/default.png b/lib/plugins/sfDoctrinePlugin/web/images/default.png deleted file mode 100755 index 95b13aefd..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/default.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/delete.png b/lib/plugins/sfDoctrinePlugin/web/images/delete.png deleted file mode 100755 index c77980432..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/delete.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/desc.png b/lib/plugins/sfDoctrinePlugin/web/images/desc.png deleted file mode 100755 index f65b70363..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/desc.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/edit.png b/lib/plugins/sfDoctrinePlugin/web/images/edit.png deleted file mode 100755 index 4cc0c3ebb..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/edit.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/error.png b/lib/plugins/sfDoctrinePlugin/web/images/error.png deleted file mode 100755 index 6631294a5..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/error.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/first.png b/lib/plugins/sfDoctrinePlugin/web/images/first.png deleted file mode 100755 index 457651748..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/first.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/last.png b/lib/plugins/sfDoctrinePlugin/web/images/last.png deleted file mode 100755 index 0d5a621e1..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/last.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/list.png b/lib/plugins/sfDoctrinePlugin/web/images/list.png deleted file mode 100755 index 95b13aefd..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/list.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/new.png b/lib/plugins/sfDoctrinePlugin/web/images/new.png deleted file mode 100755 index d91b83597..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/new.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/next.png b/lib/plugins/sfDoctrinePlugin/web/images/next.png deleted file mode 100755 index d5bd836be..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/next.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/previous.png b/lib/plugins/sfDoctrinePlugin/web/images/previous.png deleted file mode 100755 index 4d089a7f8..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/previous.png and /dev/null differ diff --git a/lib/plugins/sfDoctrinePlugin/web/images/tick.png b/lib/plugins/sfDoctrinePlugin/web/images/tick.png deleted file mode 100755 index fdff93385..000000000 Binary files a/lib/plugins/sfDoctrinePlugin/web/images/tick.png and /dev/null differ diff --git a/lib/response/sfWebResponse.class.php b/lib/response/sfWebResponse.class.php index 69eb05d11..7462f0a9e 100644 --- a/lib/response/sfWebResponse.class.php +++ b/lib/response/sfWebResponse.class.php @@ -161,17 +161,18 @@ public function isHeaderOnly() /** * Sets a cookie. * - * @param string $name HTTP header name - * @param string $value Value for the cookie - * @param string $expire Cookie expiration period - * @param string $path Path - * @param string $domain Domain name - * @param bool $secure If secure - * @param bool $httpOnly If uses only HTTP + * @param string $name HTTP header name + * @param string $value Value for the cookie + * @param string $expire Cookie expiration period + * @param string $path Path + * @param string $domain Domain name + * @param bool $secure If secure + * @param bool $httpOnly If uses only HTTP + * @param string|bool $sameSite If non-false, also set the SameSite cookie parameter * * @throws sfException If fails to set the cookie */ - public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false) + public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false, $sameSite = false) { if (null !== $expire) { if (is_numeric($expire)) { @@ -192,6 +193,7 @@ public function setCookie($name, $value, $expire = null, $path = '/', $domain = 'domain' => $domain, 'secure' => $secure ? true : false, 'httpOnly' => $httpOnly, + 'sameSite' => $sameSite, ]; } @@ -358,7 +360,17 @@ public function sendHttpHeaders() foreach ($this->cookies as $cookie) { $expire = isset($cookie['expire']) ? $cookie['expire'] : 0; $domain = isset($cookie['domain']) ? $cookie['domain'] : ''; - setrawcookie($cookie['name'], $cookie['value'], $expire, $cookie['path'], $domain, $cookie['secure'], $cookie['httpOnly']); + $cookieOptions = [ + 'expires' => $expire, + 'path' => $cookie['path'], + 'domain' => $domain, + 'secure' => $cookie['secure'], + 'httponly' => $cookie['httpOnly'], + ]; + if (isset($cookie['sameSite']) && $cookie['sameSite'] !== false) { + $cookieOptions['samesite'] = $cookie['sameSite']; + } + setrawcookie($cookie['name'], $cookie['value'], $cookieOptions); if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Send cookie "%s": "%s"', $cookie['name'], $cookie['value'])])); diff --git a/lib/widget/sfWidgetFormSelectRadio.class.php b/lib/widget/sfWidgetFormSelectRadio.class.php index 94bf92353..0f8819fd0 100644 --- a/lib/widget/sfWidgetFormSelectRadio.class.php +++ b/lib/widget/sfWidgetFormSelectRadio.class.php @@ -36,7 +36,7 @@ public function render($name, $value = null, $attributes = [], $errors = []) $choices = $this->getChoices(); // with groups? - if (count($choices) && is_array(next($choices))) { + if (is_array(current($choices))) { $parts = []; foreach ($choices as $key => $option) { $parts[] = strtr($this->getOption('template'), ['%group%' => $key, '%options%' => $this->formatChoices($name, $value, $option, $attributes)]);