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 / 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
@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 / 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 / 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 / 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 / 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 / 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 / gist:ae42665dbae7b65d4137
Last active August 29, 2015 14:11
Vorbereitungen für den Workshop - conference-tutorial

Für den Workshop sollten auf euren Maschinen folgendes bereit stehen:

  • git
  • php >= 5.3
  • composer oder cURL um .phar laden zu können
  • mysql oder sql_lite

Ob das auf dem lokalen Rechner läuft oder ihr eine VM dafür verwendet sei ganz euch überlassen.

Danach kann man sich das Tutorial schon einmal per git clone ... auf seinen Rechner holen:

@ElectricMaxxx
ElectricMaxxx / gist:5bac51d95af4ffe91957
Last active August 29, 2015 14:11
composer.lock for sandbox pull request

atm i got the follwing error:

 [Composer\DependencyResolver\SolverProblemsException]                                                           
    Problem 1                                                                                                     
      - Installation request for symfony-cmf/symfony-cmf dev-menu_2.0 -> satisfiable by symfony-cmf/symfony-cmf[  
  dev-menu_2.0].                                                                                                  
      - symfony-cmf/symfony-cmf dev-menu_2.0 requires doctrine/phpcr-odm 1.2.* -> no matching package found.      
    Problem 2                                                                                                     
      - Installation request for jackalope/jackalope-doctrine-dbal 1.1.* -> satisfiable by jackalope/jackalope-d  

Rersvation back from SDK->reserveProducts()


O:29:"Bepado\SDK\Struct\Reservation":3:{s:7:"success";b:0;s:8:"messages";a:1:{i:62;a:0:{}}s:6:"orders";a:1:{i:62;O:23:"Bepado\SDK\Struct\Order":10:{s:9:"orderShop";s:2:"47";s:12:"providerShop";s:2:"62";s:13:"reservationId";N;s:12:"localOrderId";N;s:15:"providerOrderId";N;s:8:"shipping";O:26:"Bepado\SDK\Struct\Shipping":7:{s:6:"shopId";i:62;s:4:"rule";N;s:11:"isShippable";b:1;s:13:"shippingCosts";d:10;s:18:"grossShippingCosts";d:11.899999999999999;s:16:"deliveryWorkDays";i:10;s:7:"service";s:11:"check-value";}s:11:"paymentType";s:7:"unknown";s:10:"orderItems";a:28:{i:0;O:27:"Bepado\SDK\Struct\OrderItem":3:{s:5:"count";i:1;s:7:"product";O:25:"Bepado\SDK\Struct\Product":26:{s:8:"sourceId";s:2:"15";s:7:"groupId";N;s:3:"ean";s:0:"";s:3:"url";s:71:"http://bepado-oxid-local.mayflowerkunden.de/LUNG-CHING-gruener-Tee.html";s:5:"title";s:22:"LUNG CHING grüner Tee";s:16:"shortDescription";s:255:"A barathrum lA barathrum lex dictata sesquimellesimus per, nox hic adfero