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

[AllBundles] Fixes for SensiolabsInsights #943

Merged
merged 1 commit into from
Jan 26, 2016
Merged
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs;

use Kunstmaan\UtilitiesBundle\Helper\Slugifier;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
Expand All @@ -15,7 +15,6 @@
*/
class TabPane
{

/**
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ public function addSegmentAction(Request $request)
// add the segment to the config
$config = $em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->find($configId);
$segment->setConfig($config);
$segments = $config->getSegments();
$segments = $config->getSegments();
$segments[] = $segment;
$config->setSegments($segments);

$em->persist($config);
$em->flush();
Expand All @@ -295,7 +296,6 @@ public function deleteSegmentAction(Request $request)
{
$em = $this->getDoctrine()->getManager();

// remove the segment
$id = $request->query->get('id');
$em->getRepository('KunstmaanDashboardBundle:AnalyticsSegment')->deleteSegment($id);

Expand All @@ -309,7 +309,6 @@ public function editSegmentAction(Request $request)
{
$em = $this->getDoctrine()->getManager();

// remove the segment
$id = $request->query->get('id');
$query = $request->query->get('query');
$name = $request->query->get('name');
Expand Down
2 changes: 0 additions & 2 deletions src/Kunstmaan/DashboardBundle/Entity/AnalyticsConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use Kunstmaan\AdminBundle\Entity\AbstractEntity;

/**
* AnalyticsToken
*
* @ORM\Table(name="kuma_analytics_config")
* @ORM\Entity(repositoryClass="Kunstmaan\DashboardBundle\Repository\AnalyticsConfigRepository")
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Kunstmaan\FormBundle\Entity\PageParts;

use ArrayObject;

use Symfony\Component\Form\FormBuilderInterface;
use Kunstmaan\FormBundle\Form\SingleLineTextPagePartAdminType;
use Doctrine\ORM\Mapping as ORM;
Expand All @@ -20,7 +19,6 @@
*/
class CheckboxPagePart extends AbstractFormPagePart
{

/**
* If set to true, you are obligated to fill in this page part
*
Expand Down Expand Up @@ -103,7 +101,7 @@ public function getDefaultView()
public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
{
$bfsf = new BooleanFormSubmissionField();
$bfsf->setFieldName("field_" . $this->getUniqueId());
$bfsf->setFieldName('field_' . $this->getUniqueId());
$bfsf->setLabel($this->getLabel());
$bfsf->setSequence($sequence);

Expand All @@ -127,7 +125,7 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
);
$formBuilder->setData($data);

$fields[] = $bfsf;
$fields->append($bfsf);
}

/**
Expand All @@ -139,5 +137,4 @@ public function getDefaultAdminType()
{
return new CheckboxPagePartAdminType();
}

}
14 changes: 5 additions & 9 deletions src/Kunstmaan/FormBundle/Entity/PageParts/ChoicePagePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace Kunstmaan\FormBundle\Entity\PageParts;

use ArrayObject;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;

use Doctrine\ORM\Mapping as ORM;
use Kunstmaan\FormBundle\Form\ChoiceFormSubmissionType;
use Kunstmaan\FormBundle\Form\ChoicePagePartAdminType;
use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\ChoiceFormSubmissionField;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;

/**
* The choice page part can be used to create forms with single or multiple choices. This can be
Expand All @@ -22,7 +19,6 @@
*/
class ChoicePagePart extends AbstractFormPagePart
{

/**
* If set to true, radio buttons or checkboxes will be rendered (depending on the multiple value). If false,
* a select element will be rendered.
Expand Down Expand Up @@ -124,7 +120,8 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
)
);
$formBuilder->setData($data);
$fields[] = $cfsf;

$fields->append($cfsf);
}

/**
Expand Down Expand Up @@ -280,5 +277,4 @@ public function getErrorMessageRequired()
{
return $this->errorMessageRequired;
}

}
9 changes: 2 additions & 7 deletions src/Kunstmaan/FormBundle/Entity/PageParts/EmailPagePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace Kunstmaan\FormBundle\Entity\PageParts;

use ArrayObject;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;

use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\EmailFormSubmissionField;
use Kunstmaan\FormBundle\Form\EmailFormSubmissionType;
use Kunstmaan\FormBundle\Form\EmailPagePartAdminType;

use Doctrine\ORM\Mapping as ORM;

/**
Expand All @@ -22,7 +19,6 @@
*/
class EmailPagePart extends AbstractFormPagePart
{

/**
* If set to true, you are obligated to fill in this page part
*
Expand Down Expand Up @@ -116,7 +112,6 @@ public function getErrorMessageInvalid()
return $this->errorMessageInvalid;
}


/**
* Returns the frontend view
*
Expand Down Expand Up @@ -167,7 +162,8 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
)
);
$formBuilder->setData($data);
$fields[] = $efsf;

$fields->append($efsf);
}

/**
Expand All @@ -179,5 +175,4 @@ public function getDefaultAdminType()
{
return new EmailPagePartAdminType();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class FileUploadPagePart extends AbstractFormPagePart
{

/**
* If set to true, you are obligated to fill in this page part
*
Expand All @@ -44,7 +43,7 @@ class FileUploadPagePart extends AbstractFormPagePart
public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
{
$ffsf = new FileFormSubmissionField();
$ffsf->setFieldName("field_" . $this->getUniqueId());
$ffsf->setFieldName('field_' . $this->getUniqueId());
$ffsf->setLabel($this->getLabel());
$ffsf->setSequence($sequence);

Expand All @@ -71,7 +70,7 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
);
$formBuilder->setData($data);

$fields[] = $ffsf;
$fields->append($ffsf);
}

/**
Expand Down Expand Up @@ -141,5 +140,4 @@ public function getDefaultAdminType()
{
return new FileUploadPagePartAdminType();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
namespace Kunstmaan\FormBundle\Entity\PageParts;

use ArrayObject;

use Doctrine\ORM\Mapping as ORM;

use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\TextFormSubmissionField;
use Kunstmaan\FormBundle\Form\TextFormSubmissionType;
use Kunstmaan\FormBundle\Form\MultiLineTextPagePartAdminType;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Regex;
Expand All @@ -22,7 +19,6 @@
*/
class MultiLineTextPagePart extends AbstractFormPagePart
{

/**
* If set to true, you are obligated to fill in this page part
*
Expand Down Expand Up @@ -167,7 +163,7 @@ public function getErrorMessageRequired()
public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
{
$mfsf = new TextFormSubmissionField();
$mfsf->setFieldName("field_" . $this->getUniqueId());
$mfsf->setFieldName('field_' . $this->getUniqueId());
$mfsf->setLabel($this->getLabel());
$mfsf->setSequence($sequence);

Expand Down Expand Up @@ -201,7 +197,7 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
);
$formBuilder->setData($data);

$fields[] = $mfsf;
$fields->append($mfsf);
}

/**
Expand All @@ -213,5 +209,4 @@ public function getDefaultAdminType()
{
return new MultiLineTextPagePartAdminType();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
namespace Kunstmaan\FormBundle\Entity\PageParts;

use ArrayObject;

use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Regex;

use Kunstmaan\FormBundle\Form\StringFormSubmissionType;
use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\StringFormSubmissionField;
use Kunstmaan\FormBundle\Form\SingleLineTextPagePartAdminType;

use Doctrine\ORM\Mapping as ORM;


/**
* The single-line text page part can be used to create forms with text input fields
*
Expand All @@ -23,7 +19,6 @@
*/
class SingleLineTextPagePart extends AbstractFormPagePart
{

/**
* If set to true, you are obligated to fill in this page part
*
Expand Down Expand Up @@ -168,7 +163,7 @@ public function getDefaultView()
public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields, $sequence)
{
$sfsf = new StringFormSubmissionField();
$sfsf->setFieldName("field_" . $this->getUniqueId());
$sfsf->setFieldName('field_' . $this->getUniqueId());
$sfsf->setLabel($this->getLabel());
$sfsf->setSequence($sequence);

Expand Down Expand Up @@ -201,7 +196,7 @@ public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields
);
$formBuilder->setData($data);

$fields[] = $sfsf;
$fields->append($sfsf);
}

/**
Expand All @@ -213,5 +208,4 @@ public function getDefaultAdminType()
{
return new SingleLineTextPagePartAdminType();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
Expand Down
4 changes: 0 additions & 4 deletions src/Kunstmaan/MediaBundle/Form/FolderType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Kunstmaan\MediaBundle\Form;

use Kunstmaan\MediaBundle\Entity\Folder;
use Kunstmaan\MediaBundle\Repository\FolderRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
Expand All @@ -11,9 +10,6 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* FolderType
*/
class FolderType extends AbstractType
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ public function prepareMedia(Media $media)
//update thumbnail
switch ($video->getType()) {
case 'youtube':
//this can either throw an exception, or return false
$return = @file_get_contents('http://img.youtube.com/vi/' . $code . '/maxresdefault.jpg');
if (!$return){
if (fopen('http://img.youtube.com/vi/' . $code . '/maxresdefault.jpg', 'r') === false) {
$video->setThumbnailUrl('http://img.youtube.com/vi/' . $code . '/0.jpg');
} else {
$video->setThumbnailUrl('http://img.youtube.com/vi/' . $code . '/maxresdefault.jpg');
Expand Down
7 changes: 2 additions & 5 deletions src/Kunstmaan/NodeSearchBundle/Services/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function search()
* @param Request $request
* @param RenderContext $context
*/
protected function applySearchParams(AbstractElasticaSearcher $searcher, Request $request, RenderContext $context)
protected function applySearchParams(AbstractElasticaSearcher $searcher, Request $request, RenderContext &$context)
{
// Retrieve the search parameters
$queryString = trim($request->query->get('query'));
Expand All @@ -164,13 +164,10 @@ protected function applySearchParams(AbstractElasticaSearcher $searcher, Request
->setContentType($queryType)
->setLanguage($lang);


// Facets
$query = $searcher->getQuery();
$facetTerms = new \Elastica\Facet\Terms('type');

$facetTerms->setField('type');

$query = $searcher->getQuery();
$query->addFacet($facetTerms);

// Aggregations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ services:
class: 'Kunstmaan\TranslatorBundle\Service\Command\Importer\Importer'
calls:
- [setTranslationGroupManager, ['@kunstmaan_translator.service.group_manager']] # default, maken via config var
- [setTranslationRepository, ['@kunstmaan_translator.repository.translation']]

kunstmaan_translator.service.group_manager:
class: 'Kunstmaan\TranslatorBundle\Service\TranslationGroupManager'
Expand Down
Loading