With this module the user can set the timezone.
- PHP 5 >= 5.2.0
- Symfony 1.4
- Doctrine
- sfGuardDoctrinePlugin
Model time is a unified time (by default your server's system time), view is a user time, may specific for any user.
Activate the plugin in the config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins(array(
'sfDoctrinePlugin',
'sfDoctrineGuardPlugin',
'JagmortTimezonePlugin'
));
}
}
Setup timezone in config/app.yml
:
default_timezone: UTC
Setup timezone in config/ProjectConfiguration.class.php
:
class ProjectConfiguration extends sfProjectConfiguration
{
//...
public function setup()
{
//...
$this->dispatcher->connect(
'doctrine.filter_model_builder_options',
array($this, 'configureDoctrineBuilderOptions')
);
//...
}
//...
public function configureDoctrineBuilderOptions(sfEvent $event, $options)
{
$options['baseClassName'] = 'JagmortTzDoctrineRecord';
return $options;
}
//...
}
Rebuild your models:
./symfony doctrine:build-model
./symfony doctrine:build-forms
To run tests you need SQLite extension installed:
apt-get install php5-sqlite
Then run:
cd /path/to/your/project/plugins/JagmortTimezonePlugin
touch symfony
/path/to/symfony/data/bin/symfony test:unit -t JagmortTimezonePlugin
or add to your config/ProjectConfiguration.class.php
:
public function setupPlugins()
{
$this->pluginConfigurations['JagmortTimezonePlugin']->connectTests();
}
and then run:
cd /path/to/your/project
./symfony test:unit -t JagmortTimezonePlugin