Skip to content

Instantly share code, notes, and snippets.

View rande's full-sized avatar
🖖
hello!

Thomas rande

🖖
hello!
View GitHub Profile
import ioc.loader
import os
class Extension(object):
def load(self, config, container_builder):
path = os.path.dirname(os.path.abspath(__file__))
loader = ioc.loader.YamlLoader()
loader.load("%s/resources/config/services.yml" % path, container_builder)
Problem 1
- Installation request for sonata-project/user-bundle 2.1.*@dev -> satisfiable by sonata-project/user-bundle 2.1.x-dev.
- sonata-project/user-bundle 2.1.x-dev requires sonata-project/admin-bundle 2.1.x-dev -> no matching package found.
Problem 2
- Installation request for sonata-project/page-bundle 2.1.*@dev -> satisfiable by sonata-project/page-bundle 2.1.x-dev.
- sonata-project/page-bundle 2.1.x-dev requires symfony-cmf/routing-extra-bundle 1.0.* -> no matching package found.
Problem 3
- Installation request for sonata-project/media-bundle 2.1.*@dev -> satisfiable by sonata-project/media-bundle 2.1.x-dev.
- sonata-project/media-bundle 2.1.x-dev requires sonata-project/admin-bundle 2.1.x-dev -> no matching package found.
class consumer(twistedhttpstream.MessageReceiver):
def connectionMade(self):
print "connected..."
def connectionFailed(self, why):
print "cannot connect:", why
reactor.stop()
def messageReceived(self, tweet):
print "new message:", repr(tweet)
@rande
rande / gist:4981650
Last active December 13, 2015 21:59
Sonata Media Bundle
===================
Media path generation: http://mycdn.com/context/01223/023/thumb_1232_small.jpg
1. CDN http://mycdn.com
2. Path Generator : context/01223/023
3. Thumbnail - internal generation: thumb_1232_small.jpg
4. Thumbnail - return the relative path: context/01223/023/thumb_1232_small.jpg
@rande
rande / gist:985705
Created May 22, 2011 17:48
Sonata Security - Roles definitions
sonata_admin:
access_control:
- { path: ^/admin/sonata/media/media/list$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_LIST], methods: null }
- { path: ^/admin/sonata/media/media/create$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_CREATE], methods: null }
- { path: ^/admin/sonata/media/media/update$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_UPDATE], methods: null }
- { path: ^/admin/sonata/media/media/batch$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_BATCH], methods: null }
- { path: ^/admin/sonata/media/media/(?P[^/]+?)/edit$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_EDIT], methods: null }
- { path: ^/admin/sonata/media/media/(?P[^/]+?)/delete$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_DELETE], methods: null }
- { path: ^/admin/sonata/media/media/(?P[^/]+?)/view$, roles: [ROLE_SONATA_MEDIA_ADMIN_MEDIA_VIEW], methods: null }
- { path: ^/admin/sonata/media/gallery/list$, roles: [ROLE_SONATA_MEDIA_ADMIN_GALLERY_LIST], methods: null }
<?php
/*
* This file is part of the Sonata project.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
<?php
namespace Sonata\Bundle\ScreenyBundle\Consumer;
use Sonata\Bundle\ScreenyBundle\Screeny\UrlShotManager;
use PhpAmqpLib\Message\AMQPMessage;
use OldSound\RabbitMqBundle\RabbitMq\Producer;
class UrlShotConsumer
{
<?php
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it, or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
'84.14.82.2',
'88.175.92.100',
))) {
diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
index 2cad8a4..51c4924 100644
--- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
+++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
@@ -127,6 +127,16 @@ class XmlExporter extends AbstractExporter
}
}
+ foreach ($metadata->associationMappings as $name => $field) {
+ if (isset($field['id']) && $field['id']) {
<?php
// service
interface BlockExecuteFactoryInterface
{
function getExecutionContext(BlockInterface $block);
}
// object, one per block
interface BlockExecutionContextInterface