This example will help you create custom Sonata Admin page and also explain how to make a statistics admin.
You can read more here
alias cdg=gitdir | |
gitdir(){ | |
cd $1 | |
count=$(find . -name .git -type d -maxdepth 1 | wc -l) | |
if [ $count -gt 0 ]; then | |
git branch | |
fi | |
} | |
<?php | |
namespace YourBundle\EventListener; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Symfony\Component\Routing\RouterInterface; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\Routing\Matcher\UrlMatcher; | |
use Symfony\Component\Routing\RequestContext; |
<?php | |
namespace YourBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Application\Sonata\MediaBundle\Entity\Media; | |
use Application\Sonata\MediaBundle\Entity\Gallery; | |
use Application\Sonata\MediaBundle\Entity\GalleryHasMedia; |
<?php | |
/** | |
* Created by PhpStorm. | |
* User: markokunic | |
* Date: 4/21/17 | |
* Time: 3:41 PM | |
*/ | |
namespace AppBundle\Exporter; |
<?php | |
namespace Drupal\clone_nodes\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Drupal\node\Entity\Node; | |
class CloneController extends ControllerBase | |
{ |
<?php | |
namespace AppBundle\Entity; | |
/** | |
* @package AppBundle\Entity | |
* @ORM\Entity() | |
* @ORM\Table() | |
* @ORM\Cache(usage="NONSTRICT_READ_WRITE") | |
*/ |
<?php | |
namespace AppBundle\Twig; | |
abstract class DebugTemplate extends \Twig_Template { | |
public function display(array $context, array $blocks = array()) | |
{ | |
echo '<!-- START: ' . $this->getTemplateName() . ' -->'; |
This example will help you create custom Sonata Admin page and also explain how to make a statistics admin.
You can read more here
<?php | |
namespace YourBundle\Provider; | |
use Sonata\MediaBundle\Provider\FileProvider; | |
class ImageProvider extends FileProvider | |
{ | |
} |
bendavies [1:22 PM] | |
@iltar we use this to solve this problem: https://github.com/SyliusLabs/AssociationHydrator | |
use it like so (edited) | |
https://github.com/Sylius/Sylius/blob/0205d4b3efa155a05b29bcc64849fd7cd460ceea/src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php#L300-L313 | |
iltar [1:31 PM] | |
That will still cause queries, won't it? | |
bendavies [1:35 PM] | |
it does what is suggested in ocramius' post |