Skip to content

Instantly share code, notes, and snippets.

View spolischook's full-sized avatar
🌐
Saving the world

Serhii Polishchuk spolischook

🌐
Saving the world
View GitHub Profile
fos_js_routing:
routes_to_expose:
- "^api_.*" # expose all routes with a name starting with api_
<?php
class Dto
{
public $foo;
public $bar;
public $baz;
}
class Obj
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
<?php
/*
* This file is part of the Doctrine Extensions Taggable package.
* (c) 2011 Fabien Pennequin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
<?php
namespace Geekhub\DreamBundle\Controller;
use Geekhub\DreamBundle\Entity\Dream;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Application\Sonata\MediaBundle\Entity\Media;
use Sonata\MediaBundle\Entity\MediaManager;
@spolischook
spolischook / getAllTranslationsFiles.php
Last active August 29, 2015 14:01
Get all translation files
<?php
private function getAllTranslationsFiles($container)
{
// Discover translation directories
$dirs = array();
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
$reflection = new \ReflectionClass($class);
@spolischook
spolischook / base_script.php
Created June 24, 2014 05:59
Import mongoDb database dump
<?php
function show_run($text, $command, $canFail = false)
{
echo "\n* $text\n$command\n";
passthru($command, $return);
if (0 !== $return && !$canFail) {
echo "\n/!\\ The command returned $return\n";
exit(1);
}
@spolischook
spolischook / all-documents-from-document-manager.php
Created July 1, 2014 14:42
Get all documents from DocumentManager
<?php
$this->dm = $this->getContainer()->get('doctrine.odm.mongodb.document_manager');
$meta = $this->dm->getMetadataFactory()->getAllMetadata();
$documents = array();
foreach ($meta as $m) {
$documents[] = $m->getName();
}
@spolischook
spolischook / kotoblog_53e7bd80efcd4.php
Last active August 29, 2015 14:05
Annotation mapping class
<?php
namespace Kotoblog\Annotation;
use Doctrine\Common\Annotations\Annotation;
/** @Annotation
* @Target("PROPERTY")
*/
final class Mapping
@spolischook
spolischook / kotoblog_53e7bd81b5a8d.php
Last active August 29, 2015 14:05
Some base Doctrine2 entity class
<?php
namespace Kotoblog\Entity;
use Kotoblog\Annotation\Mapping;
class Blogpost
{
/**
* @Mapping(type="integer", default="false")