Skip to content

Instantly share code, notes, and snippets.

View tworzenieweb's full-sized avatar

Łukasz Adamczewski tworzenieweb

View GitHub Profile
@tworzenieweb
tworzenieweb / version73.php
Created March 12, 2012 09:59
Doctrine 1.2 How to drop non standard index in migration
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class Version73 extends Doctrine_Migration_Base
{
public function up()
{
$manager = Doctrine_Manager::getInstance();
@tworzenieweb
tworzenieweb / Category - tree
Created March 29, 2013 10:04
how to create movable tree interface with sonata
<?php
/*
* This file is part of the Sonata package.
*
* (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.
*/
@tworzenieweb
tworzenieweb / CategoryAdmin
Created March 29, 2013 10:05
how to create doctrine tree behaviour with sonata
<?php
namespace Luxodo\Bundle\ProductionBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Luxodo\Bundle\ProductionBundle\Entity\Category" table="category" repository-class="Gedmo\Tree\Entity\Repository\NestedTreeRepository">
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
@tworzenieweb
tworzenieweb / ApiManager.php
Last active December 16, 2015 17:19
Using Guzzle in Symfony2
<?php
namespace Tworzenieweb\Bundle\ApiBundle\Manager;
use Symfony\Bridge\Monolog\Logger,
Symfony\Component\HttpKernel\Kernel,
Guzzle\Http\Client,
Guzzle\Plugin\CurlAuth\CurlAuthPlugin;
class ApiManager {
<?php
namespace Luxodo\Bundle\ProductionBundle\Tests;
use Luxodo\Bundle\ProductionBundle\Entity\Product;
use Luxodo\Bundle\ProductionBundle\Manager\StatusManager;
class ProductTest extends \PHPUnit_Framework_TestCase
{
@tworzenieweb
tworzenieweb / ComponentExtension.php
Last active December 18, 2015 01:08
jquery hinclude like extension
<?php
namespace Phpme\Bundle\ExampleBundle\Twig\Extension;
use Symfony\Bundle\FrameworkBundle\HttpKernel;
class ComponentExtension extends \Twig_Extension
{
private $httpKernel;
<?php
$installer = new Mage_Eav_Model_Entity_Setup('eav_setup');
$installer->startSetup();
$inheritBase = 9; // default for product
$attributeSetName = 'Custom Attribute Set';
$installer->addAttributeSet('catalog_product', $attributeSetName);
@tworzenieweb
tworzenieweb / install.sh
Created July 26, 2016 06:28
install homebrew on Debina 8
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew
phpbrew
phpbrew init
nano ~/.zshrc
soure ~/.zshrc
phpbrew install 5.4.45
sudo apt-get install libxml2-dev
@tworzenieweb
tworzenieweb / clean.sh
Created February 14, 2017 21:21
Remove _test_ tables from mysql schemas
mysql -u root -se "SELECT CONCAT('DROP DATABASE ', SCHEMA_NAME, ';') FROM information_schema.SCHEMATA WHERE SCHEMA_NAME LIKE '%_test_%'"