Skip to content

Instantly share code, notes, and snippets.

View bdunogier's full-sized avatar

Bertrand Dunogier bdunogier

View GitHub Profile
@bdunogier
bdunogier / post.md
Created September 25, 2015 15:44
Organizing an eZ Platform project

Organizing an eZ Platform project

This article will cover the initialization of the project,version management, code and settings organization, and keeping Platform up-to-date version.

Initializing from one of the meta-repositories`

In order to easily follow the evolutions of eZ Platform, the best way is to use the meta-repositories, such as ezsystems/ezplatform. They're meant to be publicly open, so that they can be used as a basis for projects, both on Community or Enterprise editions.

The first thing is to initialize the project itself, using git. I suggest you add your remote first, so that master is actually your own master:

@bdunogier
bdunogier / embed_video_fragment_fieldtype.md
Last active September 13, 2015 19:22
eZ Platform features/extensions ideas

EmbedVideoFragment FieldType

A FieldType that:

  • stores a links to an embedded (youtube) video with maybe size and stuff
  • stores a list of user submitted "chapters" (e.g. named time references)

Example:

@bdunogier
bdunogier / curl.sh
Last active August 29, 2015 14:23
Creating an image content with the eZ Platform REST API, XML and base64
# Create the content
curl -v -X POST http://admin:publish@php55-vm.ezpublish5/api/ezp/v2/content/objects \
-H 'Content-Type: application/vnd.ez.api.ContentCreate+xml'
--data-binary "@payload.xml"
# Publish the content
## replace 122 with the content id returned by the POST request
curl -v -X PUBLISH http://admin:publish@php55-vm.ezpublish5/api/ezp/v2/content/objects/122/versions/1
$ php app/console bdtest:match-uri /Getting-Started/Selected-Features/Create
# Router
route: ez_urlalias
controller: ez_content:viewContent
arguments:
- contentId: 69
- locationId: 71
- viewType: full
- layout: 1
[fpm]
user = www-data
group = www-data
listen = 9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
<?xml version="1.0" encoding="UTF-8"?>
<Content media-type="application/vnd.ez.api.Content+xml" href="/api/ezp/v2/content/objects/276" remoteId="2f7b3d4c6137721b88bd5c931efad513" id="276">
<ContentType media-type="application/vnd.ez.api.ContentType+xml" href="/api/ezp/v2/content/types/48"/>
<Name>EZP-23000</Name>
<Versions media-type="application/vnd.ez.api.VersionList+xml" href="/api/ezp/v2/content/objects/276/versions"/>
<CurrentVersion media-type="application/vnd.ez.api.Version+xml" href="/api/ezp/v2/content/objects/276/currentversion">
<Version media-type="application/vnd.ez.api.Version+xml" href="/api/ezp/v2/content/objects/276/versions/2">
<VersionInfo>
<id>863</id>
<versionNo>2</versionNo>
@bdunogier
bdunogier / .netrc
Created May 16, 2014 12:10
REST: Setting username & password for a host, for use with curl -n or HTTPie
# use admin/publish as the login/password for net requests to localhost
machine localhost login admin password publish
Feature: template helpers
Scenario: As a template developer, I want to get a Route Reference to the current route
Given I am in any Twig template
And I am in the master request
When I use "{{ set route_reference = route_ref() }}"
Then "route_reference" contains a Route Reference to the current route
Scenario: As a template developer, I want to get a Route Reference to a location
Given I am in any Twig template
server {
listen 80;
server_name php55-vm.ezpublish5 php55-vm.ezpublish5.admin;
root /home/bertrand/ezpublish5/app/web;
access_log /home/bertrand/ezpublish5/app/logs/httpd-access.log;
error_log /home/bertrand/ezpublish5/app/logs/httpd-error.log debug;
disable_symlinks off;
<?php
// "Simple" query (e.g. no logical operations)
// is_class( article, blog_post ) AND parent_location_id( 4 ) AND attr_enabled = true AND attr_publishing_date = <DATE>
$queryBuilder
->contentTypeIdentifier()->in( 'article', 'blog_post' )
->parentLocationId()->eq( 2 )
->checkboxField( 'enabled' )->isFalse()
->dateField( 'publishing_date' )->before( 'last monday' )
->sortBy()
->datePublished()->descending()