insight recommandations
This commit is contained in:
parent
cbdc3109e3
commit
925ded4b7f
|
@ -35,5 +35,4 @@ class ModelConfiguration
|
|||
{
|
||||
return $this->blocks;
|
||||
}
|
||||
|
||||
}
|
|
@ -34,5 +34,4 @@ class AddBlockFieldsSubscriber implements EventSubscriberInterface
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -8,8 +8,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\PageQuery;
|
||||
|
||||
class BuildIndexCommand extends ContainerAwareCommand
|
||||
{
|
||||
protected function configure()
|
||||
|
@ -46,18 +44,12 @@ EOF
|
|||
return $namespace.'\\'.str_replace('.php', 'Query', $file->getFilename());
|
||||
}
|
||||
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$dialog = $this->getDialogHelper();
|
||||
|
||||
if ($input->isInteractive()) {
|
||||
if (!$dialog->askConfirmation(
|
||||
$output,
|
||||
$dialog->getQuestion('Do you confirm generation', 'yes', '?'),
|
||||
true
|
||||
)
|
||||
) {
|
||||
if (!$dialog->askConfirmation($output, $dialog->getQuestion('Do you confirm generation', 'yes', '?'), true)) {
|
||||
$output->writeln(
|
||||
array(
|
||||
'',
|
||||
|
@ -163,7 +155,6 @@ EOF
|
|||
$indexed_elements++;
|
||||
}
|
||||
|
||||
|
||||
$output->writeln(
|
||||
array(
|
||||
'<info>'.$query.'</info> number of indexed elements : <comment>'.$indexed_elements.'</comment>',
|
||||
|
|
|
@ -2,14 +2,9 @@
|
|||
|
||||
namespace Trinity\Bundle\SearchBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Trinity\Bundle\ContentManagerBundle\Controller\PageController;
|
||||
use Trinity\Bundle\ContentManagerBundle\Exception\NavigationNotFoundException;
|
||||
use Trinity\Bundle\ContentManagerBundle\Exception\PageNotFoundException;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
use Trinity\Bundle\SearchBundle\Model\SearchObject;
|
||||
|
||||
|
@ -17,10 +12,8 @@ use Trinity\Bundle\ContentManagerBundle\Model\PageQuery;
|
|||
use Zend\Search\Lucene\Index\Term;
|
||||
use Zend\Search\Lucene\Search\Query\Boolean as ZendBooleanQuery;
|
||||
use Zend\Search\Lucene\Search\Query\Fuzzy as FuzzyQuery;
|
||||
use Zend\Search\Lucene\Search\Query\MultiTerm;
|
||||
use Zend\Search\Lucene\Search\QueryParser;
|
||||
|
||||
|
||||
class SearchController extends PageController
|
||||
{
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
|||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
namespace Trinity\Bundle\SearchBundle\EventListener;
|
||||
|
||||
use Ivory\LuceneSearchBundle\Model\Field;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\Page;
|
||||
use Trinity\Bundle\SearchBundle\Event\LuceneEvent;
|
||||
use Trinity\Bundle\SearchBundle\TrinitySearchEvents;
|
||||
use ZendSearch\Lucene\Document;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Trinity\Bundle\SearchBundle\Model;
|
||||
|
||||
|
||||
class SearchObject
|
||||
{
|
||||
protected $object;
|
||||
|
|
|
@ -4,8 +4,6 @@ namespace Trinity\Bundle\SearchBundle\Page;
|
|||
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use Pagerfanta\Exception\NotValidCurrentPageException;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\Page;
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\SeoPageInterface;
|
||||
use Trinity\Bundle\ContentManagerBundle\Model\PageableInterface;
|
||||
|
@ -27,7 +25,6 @@ class SearchPage extends Page implements SeoPageInterface, PageableInterface
|
|||
->setDefaultControllerClass('Trinity\Bundle\SearchBundle\Controller\SearchController::indexAction');
|
||||
}
|
||||
|
||||
|
||||
public function __construct($template = null)
|
||||
{
|
||||
parent::__construct(null !== $template ? $template : 'TrinitySearchBundle:Search:index.html.twig');
|
||||
|
|
|
@ -2,20 +2,23 @@
|
|||
|
||||
namespace Trinity\Bundle\SearchBundle\Twig\Extension;
|
||||
|
||||
class HighlightExtension extends \Twig_Extension {
|
||||
|
||||
public function getFilters() {
|
||||
class HighlightExtension extends \Twig_Extension
|
||||
{
|
||||
public function getFilters()
|
||||
{
|
||||
return array(
|
||||
'highlight' => new \Twig_Filter_Method($this, 'highlight'),
|
||||
);
|
||||
}
|
||||
|
||||
public function highlight($sentence, $expr) {
|
||||
public function highlight($sentence, $expr)
|
||||
{
|
||||
$expr = explode(' ', $expr);
|
||||
foreach ($expr as $word) {
|
||||
$sentence = preg_replace('/(' . $word . ')/i',
|
||||
'<span class="bold">\1</span>', $sentence);
|
||||
}
|
||||
|
||||
return $sentence;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
|||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
|||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
namespace Trinity\Bundle\SlideshowBundle\Form\Extension\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class FileImageType extends AbstractType
|
||||
{
|
||||
|
@ -17,7 +14,6 @@ class FileImageType extends AbstractType
|
|||
return 'file';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -26,4 +22,3 @@ class FileImageType extends AbstractType
|
|||
return 'file_image';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace Trinity\Bundle\SlideshowBundle\Form\Extension\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class PersoType extends AbstractType
|
||||
|
@ -51,4 +49,3 @@ class PersoType extends AbstractType
|
|||
return 'perso';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Trinity\Bundle\SlideshowBundle\Block\SlideshowItemsContainerBlock;
|
||||
use Trinity\Bundle\SlideshowBundle\Model\SlideshowItemQuery;
|
||||
use Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType;
|
||||
|
||||
class SlideshowItemsContainerBlockType extends BlockType
|
||||
|
@ -48,7 +47,6 @@ class SlideshowItemsContainerBlockType extends BlockType
|
|||
));
|
||||
}
|
||||
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'slideshow_items_container_block';
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
namespace Trinity\Bundle\UserBundle\Controller;
|
||||
|
||||
use \Symfony\Component\HttpFoundation\Request;
|
||||
use \Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use \FOS\UserBundle\Controller\SecurityController as BaseSecurityController;
|
||||
|
||||
class SecurityController extends BaseSecurityController
|
||||
|
|
|
@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use Trinity\Bundle\UserBundle\Configuration\UserLogCrudConfiguration as CrudConfiguration;
|
||||
use Trinity\Bundle\UserBundle\Form\Type\UserLogBatchType as BatchType;
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/admin/userlog")
|
||||
*/
|
||||
|
|
|
@ -32,5 +32,4 @@ class AddCodeFieldSubscriber implements EventSubscriberInterface
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,6 @@ namespace Trinity\Bundle\UserBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use FOS\UserBundle\Form\Type\ProfileFormType as BaseType;
|
||||
use Trinity\Bundle\UserBundle\Form\Type\ProfileType;
|
||||
|
||||
class MyProfileType extends BaseType
|
||||
{
|
||||
|
@ -29,4 +28,3 @@ class MyProfileType extends BaseType
|
|||
return 'trinity_user_profile';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ use Propel\PropelBundle\Form\BaseAbstractType;
|
|||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
use \Trinity\Bundle\UserBundle\Form\Type\ProfileType;
|
||||
|
||||
class UserType extends BaseAbstractType
|
||||
{
|
||||
/**
|
||||
|
@ -110,5 +108,3 @@ class UserType extends BaseAbstractType
|
|||
return array_keys(self::getRoles());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface
|
|||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
// more information on that topic.
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ if (\$this->isColumnModified($const) && \$this->{$this->getColumnGetter()}()) {
|
|||
\$this->{$this->getColumnSetter()}(\$this->createSlug());
|
||||
}";
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
|
@ -247,7 +248,7 @@ protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->ge
|
|||
// replace non letter or digits with separator
|
||||
\$slug = preg_replace_callback(
|
||||
'" . $this->getParameter('replace_pattern') . "',
|
||||
function(\$m) use (\$replacement) {
|
||||
function (\$m) use (\$replacement) {
|
||||
return \$replacement;
|
||||
},
|
||||
utf8_encode(\$slug)
|
||||
|
@ -255,7 +256,7 @@ protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->ge
|
|||
|
||||
\$slug = preg_replace_callback(
|
||||
'#'.preg_quote(\$replacement).'{2,}#',
|
||||
function(\$m) use (\$replacement) {
|
||||
function (\$m) use (\$replacement) {
|
||||
return \$replacement;
|
||||
},
|
||||
utf8_encode(\$slug)
|
||||
|
|
|
@ -5,7 +5,6 @@ use I18nBehavior;
|
|||
use ReflectionObject;
|
||||
use SluggableBehavior;
|
||||
|
||||
|
||||
class I18nSluggableBehavior extends I18nBehavior
|
||||
{
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class UploadableBehavior extends \Behavior
|
|||
if ($this->getTable()->getColumn($columnName)) {
|
||||
return 'get'.$this->getTable()->getColumn($columnName)->getPhpName();
|
||||
}
|
||||
|
||||
return PropelUtils::getGetter($columnName);
|
||||
}
|
||||
|
||||
|
@ -27,6 +28,7 @@ class UploadableBehavior extends \Behavior
|
|||
if ($this->getTable()->getColumn($columnName)) {
|
||||
return 'set'.$this->getTable()->getColumn($columnName)->getPhpName();
|
||||
}
|
||||
|
||||
return PropelUtils::getSetter($columnName);
|
||||
}
|
||||
|
||||
|
@ -35,7 +37,7 @@ class UploadableBehavior extends \Behavior
|
|||
$this->fields = array_map('trim', explode(',', $this->getParameter('fields')));
|
||||
$path = array_map('trim', explode(',', $this->getParameter('paths')));
|
||||
|
||||
if(count($this->fields) != count($path)) {
|
||||
if (count($this->fields) != count($path)) {
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'You must give a path for each field specified in \'fields\' parameter. %s field for %s path',
|
||||
count($this->fields),
|
||||
|
@ -43,7 +45,7 @@ class UploadableBehavior extends \Behavior
|
|||
));
|
||||
}
|
||||
|
||||
foreach($this->fields as $k => $v) {
|
||||
foreach ($this->fields as $k => $v) {
|
||||
$this->dirs[$v] = $path[$k];
|
||||
}
|
||||
}
|
||||
|
@ -133,43 +135,47 @@ class UploadableBehavior extends \Behavior
|
|||
$this->addI18nWebPathMethod($script);
|
||||
$this->addHasUploadedFieldMethod($script);
|
||||
$this->addGetterAsFile($script);
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function preSave()
|
||||
{
|
||||
$script = '';
|
||||
foreach($this->fields as $k => $field) {
|
||||
foreach ($this->fields as $k => $field) {
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
$script .= sprintf('$this->upload%s();%s', $camel_field, PHP_EOL);
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function postInsert()
|
||||
{
|
||||
$script = '';
|
||||
foreach($this->fields as $k => $field) {
|
||||
foreach ($this->fields as $k => $field) {
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
$script .= sprintf('$this->save%sFile();%s', $camel_field, PHP_EOL);
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function postUpdate()
|
||||
{
|
||||
$script = '';
|
||||
foreach($this->fields as $k => $field) {
|
||||
foreach ($this->fields as $k => $field) {
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
$script .= sprintf('$this->save%sFile();%s', $camel_field, PHP_EOL);
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function postSave()
|
||||
{
|
||||
$script = '';
|
||||
foreach($this->fields as $k => $field) {
|
||||
foreach ($this->fields as $k => $field) {
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
$script .= <<<EOL
|
||||
|
||||
|
@ -179,24 +185,24 @@ if (\$this->delete_$field) {
|
|||
|
||||
EOL;
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
public function postDelete()
|
||||
{
|
||||
$script = '';
|
||||
foreach($this->fields as $k => $field) {
|
||||
foreach ($this->fields as $k => $field) {
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
$script .= sprintf('$this->set%s(null);%s', $camel_field, PHP_EOL);
|
||||
$script .= sprintf('$this->setDelete%s(true);%s', $camel_field, PHP_EOL);
|
||||
$script .= sprintf('$this->remove%s();%s', $camel_field, PHP_EOL);
|
||||
$script .= ' '.PHP_EOL;
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function addAttributes(&$script)
|
||||
{
|
||||
$dirs = var_export($this->dirs, true);
|
||||
|
@ -218,22 +224,22 @@ EOL;
|
|||
$upload
|
||||
EOS;
|
||||
}
|
||||
if($rollbacks != '') {
|
||||
if ($rollbacks != '') {
|
||||
$script .= <<<EOS
|
||||
$rollbacks
|
||||
EOS;
|
||||
}
|
||||
if($delete != '') {
|
||||
if ($delete != '') {
|
||||
$script .= <<<EOS
|
||||
$delete
|
||||
EOS;
|
||||
}
|
||||
if($files != '') {
|
||||
if ($files != '') {
|
||||
$script .= <<<EOS
|
||||
$files
|
||||
EOS;
|
||||
}
|
||||
if($has_uploaded_file != '') {
|
||||
if ($has_uploaded_file != '') {
|
||||
$script .= <<<EOS
|
||||
$has_uploaded_file
|
||||
EOS;
|
||||
|
@ -283,7 +289,7 @@ public function getUploadDir(\$field)
|
|||
|
||||
\$transform_dir = preg_replace_callback(
|
||||
'`\{(.*)\}`sU',
|
||||
function(\$matches) {
|
||||
function (\$matches) {
|
||||
return method_exists(\$this, \$matches[1]) ? (string) call_user_func(array(\$this, \$matches[1])) : '';
|
||||
}, \$dir
|
||||
);
|
||||
|
@ -312,6 +318,7 @@ EOS;
|
|||
{
|
||||
if (null === \$this->$field && !\$this->delete_$field && null !== \$this->rollback_$field) {
|
||||
\$this->$field = \$this->rollback_$field; // keep the file
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -356,7 +363,7 @@ EOS;
|
|||
*/
|
||||
public function save{$camel_field}File()
|
||||
{
|
||||
if(\$this->hasUploaded{$camel_field}()){
|
||||
if (\$this->hasUploaded{$camel_field}()) {
|
||||
\$this->{$field}_file->move(\$this->getUploadDir('$field')$i18n, \$this->{$field});
|
||||
}
|
||||
}
|
||||
|
@ -492,8 +499,8 @@ EOS;
|
|||
|
||||
protected function addI18nWebPathMethod(&$script)
|
||||
{
|
||||
if($this->getTable()->hasBehavior('i18n')) {
|
||||
foreach($this->i18n_upload_fields as $field) {
|
||||
if ($this->getTable()->hasBehavior('i18n')) {
|
||||
foreach ($this->i18n_upload_fields as $field) {
|
||||
|
||||
$camel_field = PropelUtils::camelCase($field);
|
||||
|
||||
|
@ -547,6 +554,7 @@ EOS;
|
|||
$upload
|
||||
EOS;
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
|
@ -572,6 +580,7 @@ public static function getUploadDir(\$field)
|
|||
}
|
||||
|
||||
EOS;
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,4 +37,3 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||
return self::getApplication()->run(new \Symfony\Component\Console\Input\StringInput($command));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,4 +34,3 @@ class WebTestCase extends BaseWebTestCase
|
|||
return self::getApplication()->run(new \Symfony\Component\Console\Input\StringInput($command));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class Propel
|
|||
{
|
||||
return ucfirst(preg_replace_callback(
|
||||
'/_[a-z0-9]{1}/iU',
|
||||
function($matches) {
|
||||
function ($matches) {
|
||||
return str_replace('_', '', strtoupper($matches[0]));
|
||||
},
|
||||
$string
|
||||
|
|
Loading…
Reference in a new issue