/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $config = $this->getCliConfig(); $args = array( '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); }
public function customize($params) { $params['moduleName'] = 'search'; sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir')); $generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive()); sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params); }
protected function addClassBody(&$script) { parent::addClassBody($script); // remove comments and fix coding standards $script = str_replace(array("\t", "{\n \n"), array(' ', "{\n"), sfToolkit::stripComments($script)); }
protected function execute($arguments = array(), $options = array()) { $this->standardBootstrap($arguments['application'], $options['env']); $remove = sfLuceneToolkit::getDirtyIndexRemains(); if (count($remove) == 0) { $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Nothing to do!', 'INFO')))); } elseif ($arguments['confirmation'] == 'delete') { $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Delete confirmation provided. Deleting directories now...', array('fg' => 'red', 'bold' => true))))); foreach ($remove as $dir) { sfToolkit::clearDirectory($dir); rmdir($dir); $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('dir-', $dir)))); } } else { $messages = array($this->formatter->format('The following directories are alien and not referenced by your configuration:', 'INFO')); for ($c = count($remove), $x = 0; $x < $c; $x++) { $messages[] = ' ' . ($x + 1) . ') ' . $remove[$x]; } $messages[] = ''; $messages[] = 'These directories were ' . $this->formatter->format('not', array('fg' => 'red', 'bold' => true)) . ' deleted. To delete these directories, please run:'; $messages[] = ''; $messages[] = ' ' . $this->formatter->format('symfony lucene:clean ' . $arguments['application'] . ' delete', 'INFO'); $messages[] = ''; $this->dispatcher->notify(new sfEvent($this, 'command.log', $messages)); } }
/** * @see sfPluginConfiguration */ public function initialize() { sfConfig::set('sf_orm', 'propel'); if (!sfConfig::get('sf_admin_module_web_dir')) { sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin'); } sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor')))); require_once 'propel/Propel.php'; if (!Propel::isInit()) { if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) { Propel::setLogger(new sfPropelLogger($this->dispatcher)); } $propelConfiguration = new PropelConfiguration(); Propel::setConfiguration($propelConfiguration); $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure')); Propel::initialize(); } $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent')); if (sfConfig::get('sf_web_debug')) { $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent')); } if (sfConfig::get('sf_test')) { $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools')); } }
function sf_unit_test_shutdown() { $sf_root_dir = sys_get_temp_dir().'/sf_test_project'; if(is_dir($sf_root_dir)) { sfToolkit::clearDirectory($sf_root_dir); @rmdir($sf_root_dir); } $sessions = glob(sys_get_temp_dir().'/sessions*'); $tmp_files = glob(sys_get_temp_dir().'/sf*'); $files = array_merge((empty($sessions) ? array() : $sessions), (empty($tmp_files) ? array() : $tmp_files)); foreach ($files as $file) { if(is_dir($file)) { sfToolkit::clearDirectory($file); @rmdir($file); } else { @unlink($file); } } }
function cleanup() { //sfToolkit::clearDirectory(dirname(__FILE__).'/../fixtures/project/cache'); sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log'); @unlink(sfConfig::get('sf_data_dir') . '/test.sqlite'); @unlink(sfConfig::get('sf_config_dir') . '/app.yml'); }
/** * Executes this configuration handler. * * @param array $configFiles An array of absolute filesystem path to a configuration file * * @return string Data to be written to a cache file * * @throws sfConfigurationException If a requested configuration file does not exist or is not readable * @throws sfParseException If a requested configuration file is improperly formatted */ public function execute($configFiles) { // parse the yaml $config = self::getConfiguration($configFiles); // init our data $data = ''; // let's do our fancy work foreach ($config as $file) { if (!is_readable($file)) { // file doesn't exist throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file)); } $contents = file_get_contents($file); // strip comments (not in debug mode) if (!sfConfig::get('sf_debug')) { $contents = sfToolkit::stripComments($contents); } // insert configuration files /* $contents = preg_replace_callback(array('#(require|include)(_once)?\((sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->checkConfig\(\'config/([^\']+)\'\)\);#m', '#()()(sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->import\(\'config/([^\']+)\'(, false)?\);#m'), array($this, 'insertConfigFileCallback'), $contents); */ // strip php tags $contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php)?/m' => '', '/^\\s*\\?>/m' => '')); // replace windows and mac format with unix format $contents = str_replace("\r", "\n", $contents); // replace multiple new lines with a single newline $contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents); // append file data $data .= "\n" . $contents; } // compile data $retval = sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), $data); return $retval; }
/** * Executes this configuration handler. * * @param array An array of absolute filesystem path to a configuration file * * @return string Data to be written to a cache file * * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist or is not readable * @throws <b>sfParseException</b> If a requested configuration file is improperly formatted * @throws <b>sfInitializationException</b> If a cache.yml key check fails */ public function execute($configFiles) { // set our required categories list and initialize our handler $categories = array('required_categories' => array()); $this->initialize($categories); // parse the yaml $myConfig = $this->parseYamls($configFiles); $myConfig['all'] = sfToolkit::arrayDeepMerge(isset($myConfig['default']) && is_array($myConfig['default']) ? $myConfig['default'] : array(), isset($myConfig['all']) && is_array($myConfig['all']) ? $myConfig['all'] : array()); unset($myConfig['default']); $this->yamlConfig = $myConfig; // iterate through all action names $data = array(); $first = true; foreach ($this->yamlConfig as $actionName => $values) { if ($actionName == 'all') { continue; } $data[] = $this->addCache($actionName); $first = false; } // general cache configuration $data[] = $this->addCache('DEFAULT'); // compile data $retval = sprintf("<?php\n" . "// auto-generated by sfCacheConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), implode('', $data)); return $retval; }
/** * Returns an underscore-syntaxed version or the CamelCased string. * * @param string $camel_cased_word String to underscore. * * @return string Underscored string. */ public static function underscore($camel_cased_word) { $tmp = $camel_cased_word; $tmp = str_replace('::', '/', $tmp); $tmp = sfToolkit::pregtr($tmp, array('/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2', '/([a-z\\d])([A-Z])/' => '\\1_\\2')); return strtolower($tmp); }
protected function clearDirectory($dir) { sfToolkit::clearDirectory($dir); if (is_dir($dir)) { rmdir($dir); } }
protected function findPhpBinary() { if (defined('PHP_BINARY') && PHP_BINARY) { return PHP_BINARY; } if (false !== strpos(basename($php = $_SERVER['_']), 'php')) { return $php; } // from https://github.com/symfony/Process/blob/379b35a41a2749cf7361dda0f03e04410daaca4c/PhpExecutableFinder.php $suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array(''); foreach ($suffixes as $suffix) { if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix)) { return $php; } } if ($php = getenv('PHP_PEAR_PHP_BIN')) { if (is_executable($php)) { return $php; } } return sfToolkit::getPhpCli(); }
public function executeCommand(sfWebRequest $request) { $command = trim($request->getParameter("dm_command")); if (substr($command, 0, 2) == "sf") { $command = substr($command, 3); $exec = sprintf('%s "%s" %s --color', sfToolkit::getPhpCli(), dmProject::getRootDir() . '/symfony', $command); } else { $options = substr(trim($command), 0, 2) == 'll' || substr(trim($command), 0, 2) == 'ls' ? '--color' : ''; $parts = explode(" ", $command); $parts[0] = dmArray::get($this->getAliases(), $parts[0], $parts[0]); $command = implode(" ", $parts); $parts = explode(" ", $command); $command = dmArray::get($this->getAliases(), $command, $command); if (!in_array($parts[0], $this->getCommands())) { return $this->renderText(sprintf("%s<li>This command is not available. You can do: <strong>%s</strong></li>", $this->renderCommand($command), implode(' ', $this->getCommands()))); } $exec = sprintf("%s {$options}", $command); } ob_start(); passthru($exec . ' 2>&1', $return); $raw = dmAnsiColorFormatHtmlRenderer::render(ob_get_clean()); $arr = explode("\n", $raw); $res = $this->renderCommand($command); foreach ($arr as $a) { $res .= "<li class='dm_result_command'><pre>" . $a . "</pre></li>"; } return $this->renderText($res); }
protected function initialize(array $options) { $this->options = sfToolkit::arrayDeepMerge($this->options, $options); if (!$this->page instanceof DmPage) { throw new dmException(sprintf('%s require a source instance of DmPage, %s given', get_class($this), get_class($this->page))); } }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $filename = $arguments['target']; if (null !== $filename && !sfToolkit::isPathAbsolute($filename)) { $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures'; $this->getFilesystem()->mkdirs($dir); $filename = $dir.DIRECTORY_SEPARATOR.$filename; $this->logSection('propel', sprintf('dumping data to "%s"', $filename)); } $data = new sfPropelData(); $classes = null === $options['classes'] ? 'all' : explode(',', $options['classes']); if (null !== $filename) { $data->dumpData($filename, $classes, $options['connection']); } else { fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3)); } }
public function getLinkToAction($actionName, $params, $pk_link = false) { $options = isset($params['params']) && !is_array($params['params']) ? sfToolkit::stringToArray($params['params']) : array(); // default values if ($actionName[0] == '_') { $actionName = substr($actionName, 1); $name = $actionName; //$icon = sfConfig::get('sf_admin_web_dir').'/images/'.$actionName.'_icon.png'; $action = $actionName; if ($actionName == 'delete') { $options['post'] = true; if (!isset($options['confirm'])) { $options['confirm'] = 'Are you sure?'; } } } else { $name = isset($params['name']) ? $params['name'] : $actionName; //$icon = isset($params['icon']) ? sfToolkit::replaceConstants($params['icon']) : sfConfig::get('sf_admin_web_dir').'/images/default_icon.png'; $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName); } $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\''; $phpOptions = var_export($options, true); // little hack $phpOptions = preg_replace("/'confirm' => '(.+?)(?<!\\\\)'/", '\'confirm\' => __(\'$1\')', $phpOptions); return '<li class="sf_admin_action_' . sfInflector::underscore($name) . '">[?php echo link_to(__(\'' . $params['label'] . '\'), \'' . $this->getModuleName() . '/' . $action . $url_params . ($options ? ', ' . $phpOptions : '') . ') ?]</li>' . "\n"; }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { /** * include path to propel generator */ sfToolkit::addIncludePath(array(sfConfig::get('sf_propel_path') . '/generator/lib')); /** * first check the db connectivity for all connections */ $this->logBlock('Checking Db Connectivity', "QUESTION"); if (!$this->createTask('afs:db-connectivity')->run()) { return; } $this->logBlock('Creating specific AppFlower folders', "QUESTION"); $this->createFolders(); $this->logBlock('Setting Symfony project permissions', "QUESTION"); $this->createTask('project:permissions')->run(); $type_method = 'execute' . sfInflector::camelize($options['type']); if (!method_exists($this, $type_method)) { throw new sfCommandException("Type method '{$type_method}' not defined."); } call_user_func(array($this, $type_method), $arguments, $options); $this->logBlock('Creating models from current schema', "QUESTION"); $this->createTask('propel:build-model')->run(); $this->logBlock('Creating forms from current schema', "QUESTION"); $this->createTask('propel:build-forms')->run(); $this->logBlock('Setting AppFlower project permissions', "QUESTION"); $this->createTask('afs:fix-perms')->run(); $this->logBlock('Creating AppFlower validator cache', "QUESTION"); $this->createTask('appflower:validator-cache')->run(array('frontend', 'cache', 'yes')); $this->logBlock('Clearing Symfony cache', "QUESTION"); $this->createTask('cc')->run(); }
/** * Executes this configuration handler. * * @param array $configFiles An array of absolute filesystem path to a configuration file * * @return string Data to be written to a cache file * * @throws sfConfigurationException If a requested configuration file does not exist or is not readable * @throws sfParseException If a requested configuration file is improperly formatted */ public function execute($configFiles) { // parse the yaml $config = self::getConfiguration($configFiles); // init our data $data = ''; // let's do our fancy work foreach ($config as $file) { if (!is_readable($file)) { // file doesn't exist throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file)); } $contents = file_get_contents($file); // strip comments (not in debug mode) if (!sfConfig::get('sf_debug')) { $contents = sfToolkit::stripComments($contents); } // strip php tags $contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php\\s*)?/m' => '', '/^\\s*\\?>/m' => '')); // replace windows and mac format with unix format $contents = str_replace("\r", "\n", $contents); // replace multiple new lines with a single newline $contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents); // append file data $data .= "\n" . $contents; } // compile data return sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n" . "%s\n", date('Y/m/d H:i:s'), $data); }
function task_extra_cleanup() { sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/cache'); sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log'); sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/plugins'); sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/test/unit'); }
public function build() { if (!DataModelBuilder::getBuildProperty('builderAddComments')) { return sfToolkit::stripComments(parent::build()); } return parent::build(); }
function __construct($alias, $architecture) { $this->alias = $alias; $this->architecture = $architecture; $archiConfig = $architecture->getConfig(); $this->config = sfToolkit::arrayDeepMerge($archiConfig['hosts']['all'], $archiConfig['hosts'][$alias]); }
/** * La funcion original en dist/symfony/data/tasks/sfPakePropel.php * NO FUNCIONA * porque a la funcion dumpData() no se le pasan los parametros correctos * * * Dumps yml database data to fixtures directory. * * @example symfony dump-data frontend data.yml * @example symfony dump-data frontend data.yml dev * * @param object $task * @param array $args */ function run_alba_dump_data($task, $args) { if (!count($args)) { throw new Exception('You must provide the app.'); } $app = $args[0]; if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) { throw new Exception('The app "' . $app . '" does not exist.'); } if (!isset($args[1])) { throw new Exception('You must provide a filename.'); } $filename = $args[1]; $env = empty($args[2]) ? 'dev' : $args[2]; // define constants define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', $app); define('SF_ENVIRONMENT', $env); define('SF_DEBUG', true); // get configuration require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); if (!sfToolkit::isPathAbsolute($filename)) { $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures'; pake_mkdirs($dir); $filename = $dir . DIRECTORY_SEPARATOR . $filename; } pake_echo_action('propel', sprintf('dumping data to "%s"', $filename)); $data = new sfPropelData(); // FIX de parametros $data->dumpData($filename, 'all', 'alba'); }
public function deleteApplication() { sfToolkit::clearDirectory(sfConfig::get('sf_apps_dir') . '/' . $this->slug); rmdir(sfConfig::get('sf_apps_dir') . '/' . $this->slug); @unlink(sfConfig::get('sf_web_dir') . '/' . $this->slug . '_dev.php'); @unlink(sfConfig::get('sf_web_dir') . '/' . $this->slug . '.php'); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $this->logSection('Diem Extended', 'Setup ' . dmProject::getKey()); $this->dispatcher->notify(new sfEvent($this, 'dm.setup.before', array('clear-db' => $options['clear-db']))); // don't use cache:clear task because it changes current app & environment @sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir')); if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'))) { $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineRecord.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineRecord.php')); } if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'))) { $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineQuery.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineQuery.php')); } if (!file_exists(dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php'))) { $this->getContext()->get('filesystem')->copy(dmOs::join(sfConfig::get('dm_core_dir'), 'data', 'skeleton', 'lib', 'model', 'doctrine', 'myDoctrineTable.php'), dmOs::join(sfConfig::get('sf_root_dir'), 'lib', 'model', 'doctrine', 'myDoctrineTable.php')); } $this->runTask('doctrine:build', array(), array('model' => true)); if ($options['clear-db'] || $options['clear-tables'] || $this->isProjectLocked()) { $this->reloadAutoload(); if ($options['clear-db']) { $this->runTask('doctrine:drop-db', array(), array('env' => $options['env'], 'no-confirmation' => dmArray::get($options, 'no-confirmation', false))); } else { $this->runTask('dm:drop-tables', array(), array('env' => $options['env'])); } if ($options['clear-db'] && ($ret = $this->runTask('doctrine:build-db', array(), array('env' => $options['env'])))) { return $ret; } $this->runTask('doctrine:build-sql', array(), array('env' => $options['env'])); $this->runTask('doctrine:insert-sql', array(), array('env' => $options['env'])); } else { $this->runTask('dm:upgrade', array(), array('env' => $options['env'])); } $this->reloadAutoload(); $this->withDatabase(); $this->runTask('dm:clear-cache', array(), array('env' => $options['env'])); $this->getContext()->reloadModuleManager(); $this->runTask('doctrine:build-forms', array(), array('generator-class' => 'dmDoctrineFormGenerator')); $this->runTask('doctrine:build-filters', array(), array('generator-class' => 'dmDoctrineFormFilterGenerator')); $this->runTask('dm:publish-assets'); $this->runTask('dm:clear-cache', array(), array('env' => $options['env'])); $this->reloadAutoload(); $this->getContext()->reloadModuleManager(); $this->runTask('dmAdmin:generate', array(), array('env' => $options['env'])); if (!$options['dont-load-data']) { $this->runTask('dm:data', array(), array('load-doctrine-data' => $options['load-doctrine-data'], 'env' => $options['env'])); } $this->logSection('Diem Extended', 'generate front modules'); if (!($return = $this->context->get('filesystem')->sf('dmFront:generate --env=' . dmArray::get($options, 'env', 'dev')))) { $this->logBlock(array('Can\'t run dmFront:generate: ' . $this->context->get('filesystem')->getLastExec('output'), 'Please run "php symfony dmFront:generate" manually to generate front templates'), 'ERROR'); } $this->runTask('dm:permissions'); // fix db file permissions if ('Sqlite' === Doctrine_Manager::connection()->getDriverName()) { $this->filesystem->chmod(sfConfig::get('sf_data_dir'), 0777, 00); } $this->runTask('dm:clear-cache', array(), array('env' => $options['env'])); $this->dispatcher->notify(new sfEvent($this, 'dm.setup.after', array('clear-db' => $options['clear-db']))); $this->logBlock('Setup successful', 'INFO_LARGE'); $this->unlockProject(); }
/** * Executes this validator. * * @param mixed A parameter value * @param error An error message reference * * @return bool true, if this validator executes successfully, otherwise false */ public function execute(&$value, &$error) { $decodedValue = sfToolkit::isUTF8($value) && function_exists('utf8_decode') ? utf8_decode($value) : $value; $min = $this->getParameterHolder()->get('min'); if ($min !== null && strlen(trim($decodedValue)) < $min) { // too short $error = $this->getParameterHolder()->get('min_error'); return false; } $max = $this->getParameterHolder()->get('max'); if ($max !== null && strlen(trim($decodedValue)) > $max) { // too long $error = $this->getParameterHolder()->get('max_error'); return false; } $values = $this->getParameterHolder()->get('values'); if ($values !== null) { if ($this->getParameterHolder()->get('insensitive')) { $value = strtolower($value); $found = false; foreach ($values as $avalue) { if ($value == strtolower($avalue)) { $found = true; break; } } if (!$found) { // can't find a match $error = $this->getParameterHolder()->get('values_error'); return false; } } else { if (!in_array($value, (array) $values)) { // can't find a match $error = $this->getParameterHolder()->get('values_error'); return false; } } } return true; }
public function build() { $code = parent::build(); if (!DataModelBuilder::getBuildProperty('builderAddComments')) { $code = sfToolkit::stripComments($code); } return $code; }
/** * Parses an array of YAMLs files and merges them in one configuration array. * * @param array An array of configuration file paths * * @param array A merged configuration array */ protected function parseYamls($configFiles) { $config = array(); foreach ($configFiles as $configFile) { $config = sfToolkit::arrayDeepMerge($config, $this->parseYaml($configFile)); } return $config; }
/** * Replaces a relative filesystem path with an absolute one. * * @param string A relative filesystem path * * @return string The new path */ public static function replacePath($path) { if (!sfToolkit::isPathAbsolute($path)) { // not an absolute path so we'll prepend to it $path = sfConfig::get('sf_app_dir') . '/' . $path; } return $path; }
protected function boot() { $configuration = ProjectConfiguration::getApplicationConfiguration($this->options['app'], $this->options['env'], $this->options['debug']); $this->context = dm::createContext($configuration); sfConfig::set('sf_logging_enabled', false); // remove all cache sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir')); }
public function build() { $objectCode = parent::build(); if (!$this->getBuildProperty('builderAddComments')) { $objectCode = sfToolkit::stripComments($objectCode); } return $objectCode; }