Skip to content

Commit

Permalink
Merge pull request #12 from sumocoders/update-to-fork5-compatible
Browse files Browse the repository at this point in the history
Convert module to be Fork 5.
  • Loading branch information
ohvitorino authored Aug 17, 2017
2 parents 9930a87 + 1a10186 commit d2a0c67
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 36 deletions.
8 changes: 4 additions & 4 deletions src/Backend/Modules/Partners/Actions/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

class Add extends ActionAdd
{
public function execute()
public function execute(): void
{
parent::execute();
$createWidget = new CreateWidget();
$form = $this->createForm(WidgetType::class, $createWidget);
$form->handleRequest($this->get('request'));
$form->handleRequest($this->getRequest());
if (!$form->isValid()) {
$this->tpl->assign('form', $form->createView());
$this->template->assign('form', $form->createView());
$this->display();

return;
}
$this->get('command_bus')->handle($form->getData());

return $this->redirect(
$this->redirect(
Model::createURLForAction(
'Index',
null,
Expand Down
17 changes: 13 additions & 4 deletions src/Backend/Modules/Partners/Actions/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@

class Delete extends ActionDelete
{
public function execute()
public function execute(): void
{
$widget = $this->get('partners.repository.widget')->find(
$this->getParameter('id', 'int')
$this->getRequest()->query->getInt('id')
);

if (!$widget instanceof Widget) {
return $this->redirect(Model::createURLForAction('Index', null, null, ['error' => 'non-existing']));
$this->redirect(
Model::createURLForAction(
'Index',
null,
null,
['error' => 'non-existing']
)
);
return;
}
$this->get('command_bus')->handle(new DeleteWidget($widget));

return $this->redirect(
$this->redirect(
Model::createURLForAction(
'Index',
null,
Expand All @@ -31,5 +39,6 @@ public function execute()
]
)
);
return;
}
}
16 changes: 9 additions & 7 deletions src/Backend/Modules/Partners/Actions/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,25 @@

class Edit extends ActionEdit
{
public function execute()
public function execute(): void
{
parent::execute();
$widget = $this->get('partners.repository.widget')->find(
$this->getParameter('id', 'int')
$this->getRequest()->query->getInt('id')
);

if (!$widget instanceof Widget) {
return $this->redirect(Model::createURLForAction('Index', null, null, ['error' => 'non-existing']));
$this->redirect(Model::createURLForAction('Index', null, null, ['error' => 'non-existing']));
return;
}

$editWidget = new UpdateWidget($widget);
$form = $this->createForm(WidgetType::class, $editWidget);

$form->handleRequest($this->get('request'));
$form->handleRequest($this->getRequest());
if (!$form->isValid()) {
$this->tpl->assign('form', $form->createView());
$this->tpl->assign('widget', $widget);
$this->template->assign('form', $form->createView());
$this->template->assign('widget', $widget);

$this->display();

Expand All @@ -36,7 +37,7 @@ public function execute()

$this->get('command_bus')->handle($form->getData());

return $this->redirect(
$this->redirect(
Model::createURLForAction(
'Index',
null,
Expand All @@ -47,5 +48,6 @@ public function execute()
]
)
);
return;
}
}
4 changes: 2 additions & 2 deletions src/Backend/Modules/Partners/Actions/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

class Index extends ActionIndex
{
public function execute()
public function execute(): void
{
parent::execute();
$this->tpl->assign('dataGrid', WidgetDataGrid::getHtml());
$this->template->assign('dataGrid', WidgetDataGrid::getHtml());
$this->display();
}
}
2 changes: 1 addition & 1 deletion src/Backend/Modules/Partners/Domain/Partner/Image.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Image extends AbstractImage
/**
* @return string
*/
protected function getUploadDir()
protected function getUploadDir(): string
{
return 'Partners/Partner/Image';
}
Expand Down
11 changes: 2 additions & 9 deletions src/Backend/Modules/Partners/Domain/Partner/ImageDBALType.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
namespace Backend\Modules\Partners\Domain\Partner;

use Common\Doctrine\Type\AbstractFileType;
use Common\Doctrine\ValueObject\AbstractFile;

class ImageDBALType extends AbstractFileType
{
/**
* @param string $fileName
*
* @return Image
*/
protected function createFromString($fileName)
protected function createFromString(string $fileName): AbstractFile
{
return Image::fromString($fileName);
}

/**
* @return string
*/
public function getName()
{
return 'partners_partner_image';
Expand Down
2 changes: 1 addition & 1 deletion src/Backend/Modules/Partners/Domain/Partner/PartnerType.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Backend\Modules\Partners\Domain\Partner;

use Backend\Form\Type\ImageType;
use Common\Form\ImageType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Modules/Partners/Domain/Widget/WidgetDataGrid.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace Backend\Modules\Partners\Domain\Widget;

use Backend\Core\Engine\Authentication;
use Backend\Core\Engine\DataGridDB;
use Backend\Core\Engine\DataGridDatabase;
use Backend\Core\Engine\Model;
use Backend\Core\Language\Language;

class WidgetDataGrid extends DataGridDB
class WidgetDataGrid extends DataGridDatabase
{
public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Backend/Modules/Partners/Domain/Widget/WidgetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
CollectionType::class,
[
'label' => 'lbl.Partners',
'type' => PartnerType::class,
'entry_type' => PartnerType::class,
'allow_add' => true,
'allow_delete' => true,
'constraints' => [new Valid()],
Expand Down
1 change: 1 addition & 0 deletions src/Backend/Modules/Partners/Layout/Templates/Add.html.twig
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '/Layout/Templates/base.html.twig' %}
{% import 'Layout/Templates/macros.html.twig' as macro %}
{% form_theme form '/Partners/Layout/Templates/FormLayout.html.twig' %}

{% block actionbar %}
Expand Down
1 change: 1 addition & 0 deletions src/Backend/Modules/Partners/Layout/Templates/Edit.html.twig
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '/Layout/Templates/base.html.twig' %}
{% import 'Layout/Templates/macros.html.twig' as macro %}
{% form_theme form '/Partners/Layout/Templates/FormLayout.html.twig' %}

{% block actionbar %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '/Layout/Templates/base.html.twig' %}
{% extends 'Layout/Templates/base.html.twig' %}
{% import 'Layout/Templates/macros.html.twig' as macro %}

{% block actionbar %}
<div class="btn-toolbar pull-right">
Expand Down
4 changes: 2 additions & 2 deletions src/Backend/Modules/Partners/Resources/config/doctrine.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ doctrine:
partners_widget:
type: annotation
is_bundle: false
dir: %kernel.root_dir%/../src/Backend/Modules/Partners/Domain/Widget
dir: "%kernel.root_dir%/../src/Backend/Modules/Partners/Domain/Widget"
alias: PartnersWidget
prefix: Backend\Modules\Partners\Domain\Widget

partners_partner:
type: annotation
is_bundle: false
dir: %kernel.root_dir%/../src/Backend/Modules/Partners/Domain/Partner
dir: "%kernel.root_dir%/../src/Backend/Modules/Partners/Domain/Partner"
alias: PartnersPartner
prefix: Backend\Modules\Partners\Domain\Partner
4 changes: 2 additions & 2 deletions src/Frontend/Modules/Partners/Widgets/Slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

class Slideshow extends FrontendBaseWidget
{
public function execute()
public function execute(): void
{
parent::execute();
$this->tpl->assign(
$this->template->assign(
'partners',
$this->get('partners.repository.widget')->find($this->data['id'])->getPartners()
);
Expand Down

0 comments on commit d2a0c67

Please sign in to comment.