Skip to content

Instantly share code, notes, and snippets.

View skrosoft's full-sized avatar

Vincent Guyard skrosoft

View GitHub Profile
@skrosoft
skrosoft / gist:035a7755a94ee5bf3ee60593f5005f02
Created February 15, 2017 19:36
limit_left_join_to_one_result.sql
// Seen on http://stackoverflow.com/questions/2978726/limit-results-from-joined-table-to-one-row
SELECT * FROM days_off_request AS dor
INNER JOIN days_off_request_status_history AS dorsh
ON dor.id=dorsh.days_off_request
LEFT JOIN days_off_request_status_history AS dorsh2
ON dor.id=dorsh2.days_off_request
AND dorsh2.created_at>dorsh.created_at
WHERE dorsh2.created_at IS NULL
@skrosoft
skrosoft / default_parameters.yml
Created February 8, 2017 15:02
ezplatform field group configuration (doesnt seems to work)
# File default_parameters.yml
parameters:
ezsettings.default.content.field_groups.list: ['content', 'metadata', 'test']
@skrosoft
skrosoft / SlugConverterLC.php
Created February 3, 2017 06:30
ezplatform urlalias lowecase
<?php
/**
* Created by PhpStorm.
* User: Vincent Guyard
* Date: 03/02/2017
* Time: 03:27
*
* Instrucctions: change the class from parameters
*
* parameters:
@skrosoft
skrosoft / common.yml
Created February 3, 2017 05:42
SlugConverter class configuration
parameters:
ezpublish.persistence.slug_converter.class: eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter
@skrosoft
skrosoft / transform.ini.append.php
Created January 29, 2017 16:16
url alias transform lowercase
<?php /* #?ini charset="utf-8"?
[urlalias]
Commands[]=lowercase
*/ ?>
@skrosoft
skrosoft / pjax_admin.html.twig
Created January 25, 2017 19:20
ezplatform parent block breadcrumb
{% block header_breadcrumbs %}
{% if breadcrumb_items is defined %}
{% include 'eZPlatformUIBundle:components:breadcrumbs.html.twig' with {'items': breadcrumb_items} %}
{% endif %}
{% endblock %}
@skrosoft
skrosoft / view_role.html.twig
Created January 25, 2017 19:19
breadcrumb ezplatform backend
{% block header_breadcrumbs %}
{% set breadcrumb_items = [
{link: path('admin_dashboard'), label: 'dashboard.title'|trans({}, 'dashboard')},
{link: path('admin_role'), label: 'role.dashboard_title'|trans},
{link: null, label: role.identifier}
] %}
{{ parent() }}
{% endblock %}
@skrosoft
skrosoft / view_role.html.twig
Created January 25, 2017 19:19
breadcrumb ezplatform backend
{% block header_breadcrumbs %}
{% set breadcrumb_items = [
{link: path('admin_dashboard'), label: 'dashboard.title'|trans({}, 'dashboard')},
{link: path('admin_role'), label: 'role.dashboard_title'|trans},
{link: null, label: role.identifier}
] %}
{{ parent() }}
{% endblock %}
@skrosoft
skrosoft / SymfonyEntityCloneMethod.php
Created November 21, 2016 15:45
clone entity with file (assume upload function is called with lifecycle)
public function __clone() {
$this->id = null;
if (!is_null($this->filename)){
$temp_file = tempnam(ini_get('upload_tmp_dir'), sha1(uniqid(mt_rand(), true)));
$file = new File($this->getAbsolutePath());
copy($this->getAbsolutePath(), $temp_file);
@skrosoft
skrosoft / config.php
Created August 26, 2016 13:47
EzPublish Allow Kernel Override
define( 'EZP_AUTOLOAD_ALLOW_KERNEL_OVERRIDE', true );