Skip to content

Instantly share code, notes, and snippets.

@arfaram
arfaram / OnUserPublishSlot.php
Last active December 7, 2017 16:24
Add a backend user notification everytime when user is added in eZPlatform CMS. In this example the Admin will be notified and data will also added to a system file. You could add other users or notify a user group. Note that all Signal will be sent to the Slot, you can avoid that when you limit the signal only to `Signal\UserService\CreateUserS…
<?php
namespace AppBundle\Slot;
use eZ\Publish\API\Repository\LocationService;
use eZ\Publish\Core\SignalSlot\SignalDispatcher;
use eZ\Publish\Core\SignalSlot\Slot as BaseSlot;
use eZ\Publish\Core\SignalSlot\Signal;
use eZ\Publish\Core\SignalSlot\UserService;
use EzSystems\Notification\Core\SignalSlot\Signal\NotificationSignal;
@arfaram
arfaram / ezrest_curl_httpie.md
Last active November 27, 2017 07:51
Command line using curl and http with eZPlatform Rest API v2

root Location information

curl -u "admin:publish" -H "Accept: application/vnd.ez.api.Root+xml" http://cologne.tripandtravel.dev/api/ezp/v2/

curl -u admin -H "Accept: application/vnd.ez.api.Root+json" http://cologne.tripandtravel.dev/api/ezp/v2/
http -a "admin:publish" --json http://cologne.tripandtravel.dev/api/ezp/v2/
@bdunogier
bdunogier / Howto-eZ-Platform-In-Context-with-Crowdin.md
Last active December 16, 2016 14:54
Translating eZ Platform in-context using Crowdin.com

Crowdin In-Context integration

This guide explains how to translate the eZ Platform UI in-context, within the application itself. It uses crowdin.com, and requires eZ Platform 1.7.0, released on december 15th.

  • Edit vendor/willdurand/js-translation-bundle/Bazinga/Bundle/JsTranslationBundle/Controller/Controller.php:198, change {2} to {3}.
  • Download the ezplatform-ach-ug-translations-tgz file from this gist.
  • Unzip it from app/Resources/translations. Create the directory if it doesn't exist. You should have three new directories: EzPublishCoreBundle, EzSystemsPlatformUIBundle and EzSystemsRepositoryFormsBundle.
  • Edit vendor/ezsystems/platform-ui-bundle/Resources/views/PlatformUI/shell.html.twig, and add this block right before
<?php
$stateId = 3;
$stateService = $this->get('ezpublish.api.service.object_state');
$contentService = $this->get('ezpublish.api.service.content');
$contentInfo = $contentService->loadContentInfo(93);
$objectStateGroup = $stateService->loadObjectStateGroup(4);
@andrerom
andrerom / a - oci8.md
Last active April 30, 2017 17:38
Oracle support in eZ Platform

Todo in regards to getting Oracle support in eZ Platform

We need a few things in order to support Oracle:

  • Development:
  • kernel: There are a few places we parse database "dsn", these needs to understand oci8 dsn as well
    • Or better yet find a way to get rid of it and let doctrine parse this so we can support full doctrine dsn as used by Symfony flex
  • Oracle schema, need someone with Oracle expertise involved to see what we can optimize in the schema
  • Estimate 1-2 weeks (but you need step below to be able to verify)
  • CI: Continues Integration, aka testing of every change, this is the more tricky part. in short oracle does not allow CI services to provide Oracle as an option so we have two options:
  • A: Setup testing of this on Jenkins and buy a license
@emodric
emodric / RelationList.php
Created August 7, 2015 08:39
eZ Publish RelationList field type with location ID support
<?php
namespace Netgen\Bundle\HelperBundle\Core\Persistence\Legacy\Content\FieldValue\Converter;
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\RelationList as BaseRelationListConverter;
use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
use eZ\Publish\SPI\Persistence\Content\FieldValue;
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@starlightsys
starlightsys / filegrep.py
Last active December 29, 2015 10:29
Quick script that ties together find and grep so you can search through file contents. Uses Python because I was already familiar with argparse.Much of the length and inelegance of the script is because I wanted to preserve colored output through the pipe.
#!/usr/bin/env python
import argparse, subprocess
parser = argparse.ArgumentParser()
parser.add_argument("file_glob", help="a quoted string to use when globbing for files; example: \"*.py\"")
parser.add_argument("search_string", help="the string to search for in the files")
args = parser.parse_args()
find = subprocess.Popen(["find", ".", "-type", "f", "-name", args.file_glob, "-print0"], stdout=subprocess.PIPE)