Skip to content

Instantly share code, notes, and snippets.

View benr77's full-sized avatar

Ben Roberts benr77

  • France
View GitHub Profile
@benr77
benr77 / sulu-3.0-upgrade.md
Last active February 7, 2025 10:40
Sulu 3.0 upgrade process

Sulu 3.0 Upgrade Notes

Before starting, read the Sulu 3.0 Upgrade notes.

Update Flysystem Packages

First, we need to update the Flysystem packages to version 3.x. Skip this if you already depend on this version.

composer require league/flysystem:"^3.29" league/flysystem-aws-s3-v3:"^3.29"
@benr77
benr77 / HideInSitemapListener.php
Created September 19, 2024 08:44
SuluCMS exclude specified webspaces from sitemap.xml
<?php
declare(strict_types=1);
namespace App\Infra;
use Sulu\Bundle\PageBundle\Document\HomeDocument;
use Sulu\Bundle\PageBundle\Document\PageDocument;
use Sulu\Component\Content\Document\Extension\ExtensionContainer;
use Sulu\Component\DocumentManager\Event\PersistEvent;
use Sulu\Component\DocumentManager\Events;
@benr77
benr77 / AcmeDemoBundle.php
Created August 13, 2022 15:32
Auto-registering Doctrine mappings in a Symfony bundle
<?php
declare(strict_types=1);
namespace Acme\DemoBundle;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AcmeDemoBundle extends Bundle
@benr77
benr77 / AcmeDemoBundle.php
Created August 13, 2022 15:11
Auto-registering a Doctrine custom type in Symfony bundle configuration
<?php
declare(strict_types=1);
namespace Acme\DemoBundle;
use Acme\DemoBundle\Doctrine\DBAL\Types\MyCustomType;
use Doctrine\DBAL\Types\Type;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Download the .git-prompt.sh file from Git's repo

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~/.git-prompt.sh

Add the following to .bashrc in your homedir, after the PATH= definition

source ~/.git-prompt.sh
@benr77
benr77 / ChoiceTypeExtension.php
Last active November 2, 2017 16:51
Symfony form extension to permit un-sorted "preferred_choices" option
<?php
declare(strict_types=1);
namespace AppBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
@benr77
benr77 / MemcachedWrapper.php
Last active September 24, 2024 14:40
Memcached wrapper for persistent connections
<?php
namespace ChaletOps\BaseBundle\Utils;
/**
* Class MemcachedWrapper
*/
class MemcachedWrapper extends \Memcached
{