Skip to content

Instantly share code, notes, and snippets.

View ElectricMaxxx's full-sized avatar
💭
Working in customer project on normal work days. OSS at night.

Maximilian Berghoff ElectricMaxxx

💭
Working in customer project on normal work days. OSS at night.
  • Mayflower GmbH
  • Ansbach, Germany
View GitHub Profile
@ElectricMaxxx
ElectricMaxxx / gist:38107471b08cdab421ab
Created August 8, 2014 11:26
problem to fetch the node

Got problems with that code:

<div class="carousel-wrapper">
   <h3>{{ title }}</h3>
    <div class="carousel">
        <a class="left"></a>
        {% if list|length > 0 %}
            <ul id="carousel-list">
                {% for key, value in list %}
@ElectricMaxxx
ElectricMaxxx / bridge.md
Created May 20, 2014 10:33
Purpose of the the doctrine bride/use cases

#Purpose of the DoctrineOrmOdmAdapter

tasks:

  • persist referenced object out of the box, when an object is persisted
  • update referenced object out of the box, when object is updated and referenced object has changed
  • remove referenced object out of the box, when object is removed
  • load just a reference/proxy of the referenced object, when the object is loaded

As you can see i just speak about an object and an referenced object. I do want to keep all various doctrine implementation stuff out of it. When referencing an phpcr-odm document on an an orm entity, then the object would be the entity and the referenced object the document:

@ElectricMaxxx
ElectricMaxxx / admin-extension.md
Last active August 29, 2015 14:01
Admin-Extension problem

First Admin:

class ContentContactInformationAdmin extends Admin
{
    protected $baseRouteName = 'bobbiq_core_test_content_contact_information';
    protected $baseRoutePattern = 'bobbiq/iq/test/content-contact-information';

    public function getExportFormats()
    {
        return array();
@ElectricMaxxx
ElectricMaxxx / gist:9659316
Last active August 29, 2015 13:57
Combine ODM and ORM

Hi,

it try to combine some orm and odm stuff. All examples i made are done with the phpcr-odm. I try to understand the lazy-loading of collections, cause i need to do same when loading documents that are referenced by an entity.

But from beginning: When i understand it right, doctrine helps while loading collections. It doesn't query for every item in a collection if it isn't realy needed, means if it isn't asked for. Atm i create a project where i need to load some documents that are referenced in an entity on my own. All references in one world (ORM or ODM) will end up with a list of proxies. But as i am loading the document on my own i would like to have an equal solution for that.

But how do i load the documents? I have stored an uuid of the documents in every entity, so i have got a (almost) unique reference. I created a DocumentAwareEntityInterface that looks like that:

@ElectricMaxxx
ElectricMaxxx / gist:9597332
Created March 17, 2014 10:56
Got Exception with SonataUserbundle
Just adding the sonata-user-bundle to the appKernel causes this exception:
```
ReflectionException: Class Application\Sonata\UserBundle\Entity\User does not exist
in /home/onitdlbj/neckartalradweg.onit-development.loc/vendor/sonata-project/admin-bundle/DependencyInjection/Compiler/ExtensionCompilerPass.php line 99
at ReflectionClass->__construct('Application\Sonata\UserBundle\Entity\User') in /home/onitdlbj/neckartalradweg.onit-development.loc/vendor/sonata-project/admin-bundle/DependencyInjection/Compiler/ExtensionCompilerPass.php line 99
at ExtensionCompilerPass->getExtensionsForAdmin('sonata.user.admin.user', object(Definition), object(ContainerBuilder), array('excludes' => array(), 'admins' => array(), 'implements' => array('Symfony\Cmf\Bundle\MenuBundle\Model\MenuNodeReferrersInterface' => array('cmf_menu.admin_extension.menu_node_referrers')), 'extends' => array(), 'instanceof' => array())) in /home/onitdlbj/neckartalradweg.onit-development.loc/vendor/sonata-project/admin-bundle/DependencyInjection/Co
@ElectricMaxxx
ElectricMaxxx / $.ajax() and IE
Last active December 18, 2015 03:39
Problem with an ajax request $.ajax() in some IE.
Hi,
here is the code of the main function:
```
function doActualPointRequest(adress,fn){
var url = "http://maps.googleapis.com/maps/api/geocode/json?address="+adress+"&sensor=false";
if ($.browser.msie && window.XDomainRequest) {
// Use Microsoft XDR
var xdr = new XDomainRequest();
@ElectricMaxxx
ElectricMaxxx / test
Last active December 16, 2015 13:29
problem with this.$el in backbone.js
#in the container
layout = Backbone.View.extend({
el:"body"
initialize: ->
this.template = template.layout
this.navigation = new navigation()
this.render()
render:->
opt=
container: config.option.container