Skip to content

Instantly share code, notes, and snippets.

View sergeylunev's full-sized avatar

Sergey Lunev sergeylunev

View GitHub Profile
<?php
namespace App\DefaultBundle\Listener;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use App\DefaultBundle\Annotation\MinAccess;
class Version20121016140948 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE acl_entries DROP FOREIGN KEY FK_46C8B806EA000B10");
$this->addSql("ALTER TABLE acl_entries DROP FOREIGN KEY FK_46C8B8063D9AB4A6");
$this->addSql("ALTER TABLE acl_object_identities DROP FOREIGN KEY FK_9407E54977FA751A");
public function findSame($entity)
{
$qb = $this->getEntityManager()->createQueryBuilder();
$qb
->select('ar')
->from('AppAddressBundle:AddressRubric', 'ar')
->where('ar.address = :address')
->andWhere('ar.rubric = :rubric')
->andWhere('ar.id != :id')
->setParameter('address', $entity->getAddress())
xdebug.auto_trace=1
;;Type: boolean, Default value: 0
;;When this setting is set to on, the tracing of function calls will be enabled just before the script is run. This makes it possible to trace code in the auto_prepend_file.
xdebug.cli_color=1
;;Type: integer, Default value: 0, Introduced in Xdebug 2.2
;;If this setting is 1, Xdebug will color var_dumps and stack traces output when in CLI mode and when the output is a tty. On Windows, the ANSICON tool needs to be installed.
;;If the setting is 2, then Xdebug will always color var_dumps and stack trace, no matter whether it's connected to a tty or whether ANSICON is installed. In this case, you might end up seeing escape codes.
;xdebug.collect_assignments=0
@sergeylunev
sergeylunev / CLI - zip to docx
Created July 30, 2013 06:04
Creating style docx file for Report project in CLI
cd web/files/Копия\ style && zip -r style.zip . && mv style.zip ../style.docx && ~/Sites/reports
@sergeylunev
sergeylunev / Builder.php
Created August 25, 2013 16:28
Symfony2 - Knp Menu Builder Class
<?php
namespace App\AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@sergeylunev
sergeylunev / Take base path.js
Last active December 28, 2015 00:19
Patterns of bad code
var baseurl = '{{ asset('') }}';
var lifesite = '{{ app.request.getBaseUrl }}';
# Эту строчку надо просто найти и поставить нужное значение
html_errors = On
# Копируем все что ниже
xdebug.var_display_max_children = 128
xdebug.var_display_max_data = 512
xdebug.var_display_max_depth = 3
xdebug.overload_var_dump = On