public function __construct(array $options = array()) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); if (!$this->_options['onlyOwnable']) { $this->_plugin = new Doctrine_Guardable($this->_options); } }
/** * Constructor for Locatable Template * * @param array $options * * @return void */ public function __construct(array $options = array()) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); if (!$this->_options['fields']) { throw new sfException('The Geolocatable Behavior requires the "fields" option to be set in your schema'); } }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $config = $this->getCliConfig(); $pluginSchemaDirectories = glob(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'doctrine'); $pluginSchemas = sfFinder::type('file')->name('*.yml')->in($pluginSchemaDirectories); $tmpPath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'tmp'; if (!file_exists($tmpPath)) { Doctrine_Lib::makeDirectories($tmpPath); } foreach ($pluginSchemas as $schema) { $schema = str_replace('/', DIRECTORY_SEPARATOR, $schema); $plugin = str_replace(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR, '', $schema); $e = explode(DIRECTORY_SEPARATOR, $plugin); $plugin = $e[0]; $name = basename($schema); $tmpSchemaPath = $tmpPath . DIRECTORY_SEPARATOR . $plugin . '-' . $name; $models = Doctrine_Parser::load($schema, 'yml'); if (!isset($models['package'])) { $models['package'] = $plugin . '.lib.model.doctrine'; } Doctrine_Parser::dump($models, 'yml', $tmpSchemaPath); } $import = new Doctrine_Import_Schema(); $import->setOption('generateBaseClasses', true); $import->setOption('generateTableClasses', true); $import->setOption('packagesPath', sfConfig::get('sf_plugins_dir')); $import->setOption('packagesPrefix', 'Plugin'); $import->setOption('suffix', '.class.php'); $import->setOption('baseClassesDirectory', 'generated'); $import->setOption('baseClassName', 'sfDoctrineRecord'); $import->importSchema(array($tmpPath, $config['yaml_schema_path']), 'yml', $config['models_path']); $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('doctrine', 'Generated models successfully')))); }
/** * __construct * * @param string $options * @return void */ public function __construct(array $options = array()) { $dispatcher = ProjectConfiguration::getActive()->getEventDispatcher(); $dispatcher->connect('commentable.add_commentable_class', array($this, 'getCommentables')); $options['generatePath'] = sfConfig::get('sf_lib_dir') . '/model/doctrine/sfCommentsPlugin'; $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); }
/** * Initialize the template * @return void */ public function setUp() { // TODO: cache compiled options since they do not change frequently $options = $this->options; // merge in special soft delete options if ($this->getInvoker()->getTable()->hasTemplate('SoftDelete')) { $options = Doctrine_Lib::arrayDeepMerge($options, $this->optionsWhenSoftDeleteIsEnabled); } // merge in options defined in the schema $options = Doctrine_Lib::arrayDeepMerge($options, $this->_options); // merge in default options for credentials foreach ($options['credentials'] as $credential => $cOptions) { $options['credentials'][$credential] = array_merge($this->credentialOptions, $cOptions); } // merge in default options for fields foreach ($options['fields'] as $fieldName => $fieldOptions) { $fieldOptions = array_merge($this->fieldOptions, $fieldOptions); if (!is_string($fieldOptions['view']) && !is_null($fieldOptions['view']) && $fieldOptions['view'] !== false) { throw new InvalidArgumentException(sprintf('view credential has an invalid type for field %s.', $fieldName)); } if (!is_string($fieldOptions['edit']) && !is_null($fieldOptions['edit']) && $fieldOptions['edit'] !== false) { throw new InvalidArgumentException(sprintf('edit credential has an invalid type for field %s.', $fieldName)); } if (!is_string($fieldOptions['create']) && !is_null($fieldOptions['create']) && $fieldOptions['create'] !== false) { throw new InvalidArgumentException(sprintf('create credential has an invalid type for field %s.', $fieldName)); } $options['fields'][$fieldName] = $fieldOptions; } $options['credentials'] = $this->copyRelationsToEachSide($options['credentials']); $this->options = $options; }
public function __construct(array $options = array()) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); if (!isset($this->_options['connection'])) { $this->_options['connection'] = Doctrine_Manager::connection(); } }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $this->logSection('doctrine', 'generating model classes'); $config = $this->getCliConfig(); $this->_checkForPackageParameter($config['yaml_schema_path']); $tmpPath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'tmp'; if (!file_exists($tmpPath)) { Doctrine_Lib::makeDirectories($tmpPath); } $plugins = $this->configuration->getPlugins(); foreach ($this->configuration->getAllPluginPaths() as $plugin => $path) { if (!in_array($plugin, $plugins)) { continue; } $schemas = sfFinder::type('file')->name('*.yml')->in($path . '/config/doctrine'); foreach ($schemas as $schema) { $tmpSchemaPath = $tmpPath . DIRECTORY_SEPARATOR . $plugin . '-' . basename($schema); $models = Doctrine_Parser::load($schema, 'yml'); if (!isset($models['package'])) { $models['package'] = $plugin . '.lib.model.doctrine'; $models['package_custom_path'] = $path . '/lib/model/doctrine'; } Doctrine_Parser::dump($models, 'yml', $tmpSchemaPath); } } $options = array('generateBaseClasses' => true, 'generateTableClasses' => true, 'packagesPath' => sfConfig::get('sf_plugins_dir'), 'packagesPrefix' => 'Plugin', 'suffix' => '.class.php', 'baseClassesDirectory' => 'base', 'baseClassName' => 'sfDoctrineRecord'); $options = array_merge($options, sfConfig::get('doctrine_model_builder_options', array())); $import = new Doctrine_Import_Schema(); $import->setOptions($options); $import->importSchema(array($tmpPath, $config['yaml_schema_path']), 'yml', $config['models_path']); }
/** * setOption * sets an option in order to allow flexible listener chaining * * @param mixed $name the name of the option to set * @param mixed $value the value of the option */ public function setOption($name, $value = null) { if (is_array($name)) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $name); } else { $this->_options[$name] = $value; } }
public function fill($name, $values = array()) { $formValues = Doctrine_Lib::arrayDeepMerge($this->getFormValues($name), $values); foreach ($formValues as $key => $value) { $this->setDefaultField($key, $value); } return $this->getObjectToReturn(); }
/** * __construct * * @param string $array * @return null */ public function __construct(array $options = array()) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->getOptions(), $options); $this->invokerNamespace = sprintf('%s/%s', __CLASS__, sfCacheTaggingToolkit::generateVersion()); $versionColumn = $this->getOption('versionColumn'); if (!is_string($versionColumn) || 0 >= strlen($versionColumn)) { throw new sfConfigurationException(sprintf('sfCacheTaggingPlugin: "%s" behaviors "versionColumn" ' . 'should be string and not empty, passed "%s"', sfCacheTaggingToolkit::TEMPLATE_NAME, (string) $versionColumn)); } }
/** * __construct * * @param array $options * @return void */ public function __construct(array $options) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); if (!isset($this->_options['analyzer'])) { $this->_options['analyzer'] = new Doctrine_Search_Analyzer_Standard(); } if (!isset($this->_options['connection'])) { $this->_options['connection'] = Doctrine_Manager::connection(); } }
public function testImport() { $this->dbh = new PDO('sqlite::memory:'); $this->dbh->exec('CREATE TABLE import_test_user (id INTEGER PRIMARY KEY, name TEXT)'); $this->conn = Doctrine_Manager::connection($this->dbh, 'tmp123'); $this->conn->import->importSchema('Import/_files', array('tmp123')); $this->assertTrue(file_exists('Import/_files/ImportTestUser.php')); $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php')); Doctrine_Lib::removeDirectories('Import/_files'); }
/** * __construct * * @param array $options * @return void */ public function __construct(array $options) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); if (!isset($this->_options['analyzer'])) { $this->_options['analyzer'] = 'Doctrine_Search_Analyzer_Standard'; } if (!isset($this->_options['analyzer_options'])) { $this->_options['analyzer_options'] = array(); } $this->_options['analyzer'] = new $this->_options['analyzer']($this->_options['analyzer_options']); }
/** * writeTableClassDefinition * * @return void */ public function writeTableClassDefinition(array $definition, $path, $options = array()) { $className = $definition['tableClassName']; $pos = strpos($className, "Model_"); $fileName = substr($className, $pos + 6) . $this->_suffix; $writePath = $path . DIRECTORY_SEPARATOR . $fileName; $content = $this->buildTableClassDefinition($className, $definition, $options); Doctrine_Lib::makeDirectories(dirname($writePath)); Doctrine_Core::loadModel($className, $writePath); if (!file_exists($writePath)) { file_put_contents($writePath, $content); } }
/** * @param array $options * * options can contain: * * - string thumb_dir The directory to create the thumbnails in (relative to the file's dirname) * - boolean on_demand Whether to create or not thumbnails on demand * - boolean on_save Whether to create or not thumbnails on save * - boolean strict Whether to allow other formats than those in 'formats' * - array formats Default formats to create for on_save * * the 'formats' array should contain a list of formats per-field: * * array( * 'media_id' => array('50x50') * 'cover_image' => array('100x50') * ) */ public function __construct(array $options = array()) { if (!class_exists('sfThumbnail')) { throw new sfException('You need the sfThumbnailPlugin installed to use this template'); } $app_config = array(); if (isset($options['config_key'])) { if (null === ($app_config = sfConfig::get('app_' . $options['config_key'], null))) { throw new sfException(sprintf('Could not find configuration in key "%s", maybe you forget a ".plugins" in your app.yml ?', $options['config_key'])); } } $this->options = Doctrine_Lib::arrayDeepMerge($this->options, $options, $app_config); }
public function testYmlImport() { $path = dirname(__FILE__) . '/import_builder_test'; $import = new Doctrine_Import_Schema(); $import->importSchema('schema.yml', 'yml', $path); if (!file_exists($path . '/SchemaTestUser.php')) { $this->fail(); } if (!file_exists($path . '/SchemaTestProfile.php')) { $this->fail(); } $this->assertEqual(Doctrine::getTable('AliasTest')->getFieldName('test_col'), 'test_col_alias'); Doctrine_Lib::removeDirectories($path); }
public function setRoutingValue(array $values) { $this->info('setting routing.yml config values'); $path = sfConfig::get('sf_app_dir') . '/config/routing.yml'; $config = Doctrine_Lib::arrayDeepMerge(sfYaml::load($path), $values); file_put_contents($path, sfYaml::dump($config)); sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir')); return $this; }
/** * Constructor for Markdown Template * * @param array $options * @return void * @author Brent Shaffer */ public function __construct(array $options = array()) { if (!isset($options['fields'])) { throw new sfException("Required parameter 'fields' not set in Doctrine Markdown"); } $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); // Set markdown field names if they are not set by the user foreach ($this->_options['fields'] as $key => $value) { if (is_int($key)) { unset($this->_options['fields'][$key]); $this->_options['fields'][$value . '_html'] = $value; } } }
public function testImportOfHieriarchyOfPluginGeneration() { $yml = <<<END --- WikiTest: actAs: I18n: fields: [title, content] actAs: Versionable: fields: [title, content] Searchable: fields: [title, content] Sluggable: fields: [title] columns: title: string(255) content: string END; file_put_contents('wiki.yml', $yml); $path = dirname(__FILE__) . '/tmp/import_builder_test'; $import = new Doctrine_Import_Schema(); $import->setOption('generateTableClasses', true); $import->importSchema('wiki.yml', 'yml', $path); // check that the plugin hierarchy will produce the right sql statements // this is almost an end-to-end testing :-) $models = Doctrine::loadModels($path, Doctrine::MODEL_LOADING_CONSERVATIVE); $sql = $this->conn->export->exportClassesSql(array('WikiTest')); $result = array( 0 => 'CREATE TABLE wiki_test_translation_version (id INTEGER, lang CHAR(2), title VARCHAR(255), content VARCHAR(2147483647), version INTEGER, PRIMARY KEY(id, lang, version))', 1 => 'CREATE TABLE wiki_test_translation_index (id INTEGER, lang CHAR(2), keyword VARCHAR(200), field VARCHAR(50), position INTEGER, PRIMARY KEY(id, lang, keyword, field, position))', 2 => 'CREATE TABLE wiki_test_translation (id INTEGER, title VARCHAR(255), content VARCHAR(2147483647), lang CHAR(2), version INTEGER, slug VARCHAR(255), PRIMARY KEY(id, lang))', 3 => 'CREATE TABLE wiki_test (id INTEGER PRIMARY KEY AUTOINCREMENT)', 4 => 'CREATE INDEX sluggable_idx ON wiki_test_translation (slug)', ); foreach($sql as $idx => $req) { $this->assertEqual($req, $result[$idx]); } Doctrine_Lib::removeDirectories($path); unlink('wiki.yml'); }
/** * Update the existing schema.yml file with any new tables that were passed * to the method. * * @param string $outputFile The full path of the current schema file * @param array $connections An associative array of connections and their * tables. See buildPHPModels * @param array $options Any options to be passed to * Doctrine_Import_Builder * @return type */ public function update($outputFile, array $connections = array(), array $options = array()) { try { $directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp_doctrine_models'; $options['generateBaseClasses'] = isset($options['generateBaseClasses']) ? $options['generateBaseClasses'] : false; $models = $this->buildPHPModels($directory, $connections, $options); if (empty($models) && !is_dir($directory)) { throw new Exception('No models generated from your databases'); } $this->generateYaml($outputFile, $directory, array(), Doctrine_Core::MODEL_LOADING_AGGRESSIVE); Doctrine_Lib::removeDirectories($directory); } catch (Exception $e) { throw new Exception(__METHOD__ . ':' . __LINE__ . '|' . $e->getMessage()); } return 0; }
public function testClassExistsAfterImport() { Doctrine_Core::setModelsDirectory(dirname(__FILE__) . '/DC95/models'); $import = new Doctrine_Import_Schema(); $import->setOptions(array('pearStyle' => true, 'baseClassesDirectory' => null, 'baseClassPrefix' => 'Base_', 'classPrefix' => 'DC95_', 'classPrefixFiles' => true)); $modelsPath = dirname(__FILE__) . '/DC95/models'; $import->importSchema(dirname(__FILE__) . '/DC95/schema.yml', 'yml', $modelsPath); /* $this->assertTrue(file_exists($modelsPath . '/DC95/Base/Article.php')); $this->assertTrue(file_exists($modelsPath . '/DC95/Base/Article/Category.php')); $this->assertTrue(file_exists($modelsPath . '/DC95/Article.php')); $this->assertTrue(file_exists($modelsPath . '/DC95/Article/Category.php')); */ Doctrine_Core::setModelsDirectory(null); Doctrine_Lib::removeDirectories(dirname(__FILE__) . '/DC95/models'); }
/** * Get array of configuration variables for the Doctrine cli * * @return array $config */ public function getCliConfig() { $pluginDirs = glob(sfConfig::get('sf_root_dir') . '/plugins/*/data'); $fixtures = sfFinder::type('dir')->name('fixtures')->in(array_merge(array(sfConfig::get('sf_data_dir')), $pluginDirs)); $models = sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'model' . DIRECTORY_SEPARATOR . 'doctrine'; $migrations = sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'migration' . DIRECTORY_SEPARATOR . 'doctrine'; $sql = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'sql'; $yaml = sfConfig::get('sf_config_dir') . DIRECTORY_SEPARATOR . 'doctrine'; $config = array('data_fixtures_path' => $fixtures, 'models_path' => $models, 'migrations_path' => $migrations, 'sql_path' => $sql, 'yaml_schema_path' => $yaml); foreach ($config as $dir) { $dirs = (array) $dir; foreach ($dirs as $dir) { Doctrine_Lib::makeDirectories($dir); } } return $config; }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $config = $this->getCliConfig(); $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures'; Doctrine_Lib::makeDirectories($dir); $args = array(); if (isset($arguments['target'])) { $filename = $arguments['target']; if (!sfToolkit::isPathAbsolute($filename)) { $filename = $dir . DIRECTORY_SEPARATOR . $filename; } Doctrine_Lib::makeDirectories(dirname($filename)); $args = array('data_fixtures_path' => array($filename)); $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $filename)); } else { $this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $config['data_fixtures_path'][0])); } $this->callDoctrineCli('dump-data', $args); }
public function testTest() { $from = dirname(__FILE__) . '/Diff/schema/from.yml'; $to = dirname(__FILE__) . '/Diff/schema/to.yml'; $migrationsPath = dirname(__FILE__) . '/Diff/migrations'; Doctrine_Lib::makeDirectories($migrationsPath); $diff = new Doctrine_Migration_Diff($from, $to, $migrationsPath); $changes = $diff->generateChanges(); $this->assertEqual($changes['dropped_tables']['homepage']['tableName'], 'homepage'); $this->assertEqual($changes['created_tables']['blog_post']['tableName'], 'blog_post'); $this->assertEqual($changes['created_columns']['profile']['user_id'], array('type' => 'integer', 'length' => 8)); $this->assertEqual($changes['dropped_columns']['user']['homepage_id'], array('type' => 'integer', 'length' => 8)); $this->assertEqual($changes['dropped_columns']['user']['profile_id'], array('type' => 'integer', 'length' => 8)); $this->assertEqual($changes['changed_columns']['user']['username'], array('type' => 'string', 'length' => 255, 'unique' => true, 'notnull' => true)); $this->assertEqual($changes['created_foreign_keys']['profile']['profile_user_id_user_id']['local'], 'user_id'); $this->assertEqual($changes['created_foreign_keys']['blog_post']['blog_post_user_id_user_id']['local'], 'user_id'); $this->assertEqual($changes['dropped_foreign_keys']['user']['user_profile_id_profile_id']['local'], 'profile_id'); $this->assertEqual($changes['dropped_foreign_keys']['user']['user_homepage_id_homepage_id']['local'], 'homepage_id'); $this->assertEqual($changes['created_indexes']['blog_post']['blog_post_user_id'], array('fields' => array('user_id'))); $this->assertEqual($changes['created_indexes']['profile']['profile_user_id'], array('fields' => array('user_id'))); $this->assertEqual($changes['dropped_indexes']['user']['is_active'], array('fields' => array('is_active'))); $diff->generateMigrationClasses(); $files = glob($migrationsPath . '/*.php'); $this->assertEqual(count($files), 2); $this->assertTrue(strpos($files[0], '_version1.php')); $this->assertTrue(strpos($files[1], '_version2.php')); $code1 = file_get_contents($files[0]); $this->assertTrue(strpos($code1, 'this->dropTable')); $this->assertTrue(strpos($code1, 'this->createTable')); $this->assertTrue(strpos($code1, 'this->removeColumn')); $this->assertTrue(strpos($code1, 'this->addColumn')); $this->assertTrue(strpos($code1, 'this->changeColumn')); $code2 = file_get_contents($files[1]); $this->assertTrue(strpos($code2, 'this->dropForeignKey')); $this->assertTrue(strpos($code2, 'this->removeIndex')); $this->assertTrue(strpos($code2, 'this->addIndex')); $this->assertTrue(strpos($code2, 'this->createForeignKey')); Doctrine_Lib::removeDirectories($migrationsPath); }
/** * Get array of configuration variables for the Doctrine cli * * @return array $config */ public function getCliConfig() { $fixtures = array(); $fixtures[] = sfConfig::get('sf_root_dir') . '/data/fixtures'; $pluginPaths = $this->configuration->getPluginPaths(); foreach ($pluginPaths as $pluginPath) { if (is_dir($dir = $pluginPath . '/data/fixtures')) { $fixtures[] = $dir; } } $models = sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'model' . DIRECTORY_SEPARATOR . 'doctrine'; $migrations = sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'migration' . DIRECTORY_SEPARATOR . 'doctrine'; $sql = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'sql'; $yaml = sfConfig::get('sf_config_dir') . DIRECTORY_SEPARATOR . 'doctrine'; $config = array('data_fixtures_path' => $fixtures, 'models_path' => $models, 'migrations_path' => $migrations, 'sql_path' => $sql, 'yaml_schema_path' => $yaml); foreach ($config as $dir) { $dirs = (array) $dir; foreach ($dirs as $dir) { Doctrine_Lib::makeDirectories($dir); } } return $config; }
public function joinForTableProxy(Doctrine_Query $q, array $options = array()) { $options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); $q->getRootAlias(); // fix for initialize root if (empty($options['parentTable'])) { $parentTable = $q->getRoot(); $parentTableAlias = $q->getRootAlias(); } else { $parentTable = Doctrine::getTable($options['parentTable']); $parentTableAlias = empty($options['parentTableAlias']) ? $q->getSqlTableAlias(sfInflector::tableize($options['parentTable'])) : $options['parentTableAlias']; } if (!empty($options['componentAlias'])) { $componentAlias = $options['componentAlias']; } elseif ($parentTable->hasRelation($this->_table->getComponentName())) { $componentAlias = $this->_table->getComponentName(); } else { $componentName = $this->_table->getComponentName(); $relations = $parentTable->getRelations(); foreach ($relations as $relation) { if ($relation['class'] == $componentName) { $componentAlias = $relation['alias']; break; } } } $tableAlias = empty($options['tableAlias']) ? $this->_table->getAlias() : $options['tableAlias']; $q->addSqlTableAlias($tableAlias, sfInflector::tableize($this->_table->getComponentName())); $q->leftJoin($parentTableAlias . '.' . $componentAlias . ' ' . $tableAlias); if ($options['withI18n'] == true && $this->_table->hasTemplate('Doctrine_Template_I18nMod')) { $cultures = empty($options['cultures']) ? sfContext::getInstance()->getUser()->getCulture() : $options['cultures']; $chunkWith = implode(' AND ', array_fill(0, count($cultures), ' ' . $tableAlias . '_trans.lang = ? ')); $q->leftJoin($tableAlias . '.Translation ' . $tableAlias . '_trans WITH ' . $chunkWith, $cultures); } return $q; }
/** * returns a string representation of this object * * @return string */ public function __toString() { return Doctrine_Lib::getTableAsString($this); }
/** * returns a string representation of this object * @return string */ public function __toString() { return Doctrine_Lib::getConnectionAsString($this); }
/** * __construct * * @param string $array * @return void */ public function __construct(array $options = array()) { $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options); }
/** * Generates a string representation of a connection. * * This method returns an html dump of a connection, containing state, open * transactions and loaded tables. * * @param Doctrine_Connection $connection * @return string */ public static function getConnectionAsString(Doctrine_Connection $connection) { $r[] = '<pre>'; $r[] = 'Doctrine_Connection object'; $r[] = 'State : ' . Doctrine_Lib::getConnectionStateAsString($connection->transaction->getState()); $r[] = 'Open Transactions : ' . $connection->transaction->getTransactionLevel(); $r[] = 'Table in memory : ' . $connection->count(); $r[] = 'Driver name : ' . $connection->getAttribute(Doctrine::ATTR_DRIVER_NAME); $r[] = "</pre>"; return implode("\n", $r) . "<br>"; }