Skip to content

Instantly share code, notes, and snippets.

View nenad-mitic-bg's full-sized avatar

Nenad Mitic nenad-mitic-bg

View GitHub Profile
@nenad-mitic-bg
nenad-mitic-bg / purchase.yml
Created August 3, 2019 09:35
For Medium article "Symfony EasyAdmin: complex forms" - example that works
easy_admin:
entities:
Purchase:
class: App\Entity\Purchase
controller: App\Controller\Admin\PurchaseController
disabled_actions: ['delete']
list:
actions: [ { name: 'show', icon: 'shopping-basket' } ]
fields: ['guid', 'buyer', 'deliveryDate', 'deliveryHour', 'billingAddress', 'purchasedItems', 'total']
form:
@nenad-mitic-bg
nenad-mitic-bg / StreetAddressType.php
Created August 3, 2019 09:33
For Medium article "Symfony EasyAdmin: complex forms"
<?php
namespace App\Form;
use App\Entity\StreetAddress;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@nenad-mitic-bg
nenad-mitic-bg / purchase.yml
Last active August 3, 2019 09:34
For Medium article "Symfony EasyAdmin: complex forms" - example of non working config
easy_admin:
entities:
Purchase:
class: App\Entity\Purchase
controller: App\Controller\Admin\PurchaseController
disabled_actions: ['delete']
list:
actions: [ { name: 'show', icon: 'shopping-basket' } ]
fields: ['guid', 'buyer', 'deliveryDate', 'deliveryHour', 'billingAddress', 'purchasedItems', 'total']
form:
@nenad-mitic-bg
nenad-mitic-bg / Purchase.php
Last active August 3, 2019 10:06
For Medium article "Symfony EasyAdmin: complex forms"
<?php
/*
* A lot of stuff is omitted so that we can focus on the point of the article.
* The whole working project can be seen here: https://github.com/shonezlo/easy-admin-demo-complex-forms
*/
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
@nenad-mitic-bg
nenad-mitic-bg / ExampleRepository.php
Created May 20, 2016 09:15 — forked from gnugat/ExampleRepository.php
Declaring a Doctrine Repository as a service and injecting it a dependency.
<?php
namespace Acme\DemoBundle\Repository;
use Acme\DemoBundle\Dependency;
use Doctrine\ORM\EntityRepository;
/**
* Get this repository directly from the container: it will set the $dependency attribute.
* If you get it using Doctrine's "getRepository()", don't forget to call setDependency().
@nenad-mitic-bg
nenad-mitic-bg / merge-two-gifs.php
Created January 12, 2016 08:09
Merge two animated GIFs with PHP (ImageMagick)
<?php
/*
* This can be used to merge two animated gifs into one. Both GIFs should
* have the same size and frame rates. ImageMagick is needed for this to work
*
* Author: Nenad Mitic [email protected]
*
*/