Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unit and functional test, upgrade to last symfony version 1.4.20 #439

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
url = git://github.com/diem-project/sfFormExtraPlugin.git
[submodule "symfony"]
path = symfony
url = git://github.com/diem-project/symfony.git
url = git://github.com/symfony/symfony1.git
[submodule "dmCorePlugin/test/project/plugins/dmTagPlugin"]
path = dmCorePlugin/test/project/plugins/dmTagPlugin
url = git://github.com/diem-project/dmTagPlugin.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function executeMove(dmWebRequest $request)
);

$this->forward404Unless(
$module instanceof dmProjectModule && $module->getTable() instanceof dmDoctrineTable && $module->getTable()->isNestedSet()
($module instanceof dmProjectModule || $module instanceof dmModule) && $module->getTable() instanceof dmDoctrineTable && $module->getTable()->isNestedSet()
);

$this->forward404Unless(
Expand Down
2 changes: 1 addition & 1 deletion dmCorePlugin/config/dm/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ services:
seo_synchronizer:
class: %seo_synchronizer.class%
shared: true
arguments: [ @module_manager ]
arguments: [ @module_manager, @service_container ]

cache_cleaner:
class: %cache_cleaner.class%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
abstract class BaseFormDoctrine extends dmFormDoctrine
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
abstract class Base<?php echo $this->modelName ?>Form extends <?php echo $this->getFormClassToExtend() . "\n" ?>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
abstract class Base<?php echo $this->modelName ?>Form extends <?php echo $this->getFormClassToExtend() . "\n" ?>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
abstract class Plugin<?php echo $this->table->getOption('name') ?>Form extends Base<?php echo $this->table->getOption('name') ?>Form
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
class <?php echo $this->table->getOption('name') ?>Form extends Base<?php echo $this->table->getOption('name') ?>Form
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* @author ##AUTHOR_NAME##
* @version SVN: $Id$
* @generator <?php echo 'Diem ', constant('DIEM_VERSION'), "\n"?>
* @gen-file <?php echo __FILE__?>
*/
class <?php echo $this->table->getOption('name') ?>Form extends Plugin<?php echo $this->table->getOption('name') ?>Form
{
Expand Down
4 changes: 4 additions & 0 deletions dmCorePlugin/lib/form/dmFormDoctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ protected function filterValuesByEmbeddedMediaForm(array $values, $local)
{
$this->embeddedForms[$formName]->setObject($media);
$values[$formName]['dm_media_folder_id'] = $media->dm_media_folder_id;

// we don't check if a media has been defined using d&d from media bar
$this->validatorSchema[$formName]->offsetSet('id', new sfValidatorInteger(array('required' => true)));
$this->validatorSchema[$formName]->offsetSet('file', new sfValidatorFile(array('required' => false)));
}
}
}
Expand Down
29 changes: 28 additions & 1 deletion dmCorePlugin/lib/form/doctrine/PluginDmMediaForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function setup()

$this->widgetSchema['file'] = new sfWidgetFormDmInputFile();
$this->validatorSchema['file'] = new sfValidatorFile(array(
'required' => false //@todo this is weir bugfix as we don't check if a media has been defined using d&d from media bar
'required' => true // resolved in dmFormDoctrine
));

$this->changeToHidden('dm_media_folder_id');
Expand Down Expand Up @@ -168,4 +168,31 @@ protected function getUseFields()
{
return array('dm_media_folder_id', 'file', 'legend', 'author', 'license');
}

protected function doBind(array $values)
{
$isFileProvided = isset($values['file']) && !empty($values['file']['size']);

// media id provided with drag&drop or file edit without upload
if(!empty($values['id']) && !$isFileProvided)
{
if($this->getObject()->isNew() || $this->getObject()->id != $values['id'])
{
if($media = dmDb::table('DmMedia')->findOneByIdWithFolder($values['id']))
{
$this->setObject($media);
$values['dm_media_folder_id'] = $media->dm_media_folder_id;

$this->validatorSchema['id']->setOption('required', true);
$this->validatorSchema['file']->setOption('required', false);
}
}
elseif ($this->getObject()->id == $values['id'])
{
$this->validatorSchema['id']->setOption('required', true);
$this->validatorSchema['file']->setOption('required', false);
}
}
parent::doBind($values);
}
}
8 changes: 5 additions & 3 deletions dmCorePlugin/lib/seo/dmSeoSynchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class dmSeoSynchronizer extends dmMicroCache
$moduleManager,
$culture,
$nodeParentIdStmt,
$currentModule;
$currentModule,
$serviceContainer;

public function __construct(dmModuleManager $moduleManager)
public function __construct(dmModuleManager $moduleManager, dmBaseServiceContainer $serviceContainer)
{
$this->moduleManager = $moduleManager;
$this->serviceContainer = $serviceContainer;
}

public function setCulture($culture)
Expand Down Expand Up @@ -425,7 +427,7 @@ public function getReplacementsForPatterns(dmProjectModule $module, array $patte

if($processMarkdown)
{
$markdown = $this->getContext()->getServiceContainer()->get('markdown');
$markdown = $this->serviceContainer->get('markdown');
$usedValue = $markdown::brutalToText($usedValue);
}

Expand Down
2 changes: 1 addition & 1 deletion dmCorePlugin/lib/view/html/dmHtmlTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function removeClass($class)
{
if($this->hasClass($class))
{
unset($this['class'][$class]);
unset($this->options['class'][array_search($class,$this->options['class'])]);
}

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ public function getChoices()
{
foreach($choices as $choice)
{
$this->cache_choices[$choice->$keyMethod()] = $choice->$method();
// fix for Doctrine Behaviours like DmVersionable which are not instances of sfDoctrineRecord
if ($keyMethod == 'getPrimaryKey' && !$choice instanceof sfDoctrineRecord && $choice instanceof Doctrine_Record)
{
$identifier = (array) $choice->identifier();
$primaryKey = $identifier['id'];
}
else
{
$primaryKey = $choice->$keyMethod();
}

$this->cache_choices[$primaryKey] = $choice->$method();
}
}
elseif(isset($this->choices))
Expand Down
Binary file modified dmCorePlugin/test/project/data/db.sqlite
Binary file not shown.
Loading