Skip to content

Instantly share code, notes, and snippets.

View arghav's full-sized avatar

arghav arghav

View GitHub Profile
@arghav
arghav / User.php
Created December 7, 2010 17:38
User.php
<?php
namespace Application\MyBundle\Document;
use Bundle\DoctrineUserBundle\Document\User as BaseUser;
/**
* @mongodb:Document(collection="users" ,repositoryClass="Application\MyBundle\Document\UserRepository")
*/
class User extends BaseUser
<?php
namespace Application\MyBundle\Document;
use Bundle\DoctrineUserBundle\Document\UserRepository as BaseUserRepository;
class UserRepository extends BaseUserRepository
{
}
@arghav
arghav / gist:798420
Created January 27, 2011 12:02
security.yml
###FORM_LOGIN_AUTH
security.config:
encoders:
Symfony\Component\Security\User\User: plaintext
providers:
main:
users:
foo: { password: bar, roles: ROLE_USER }
firewalls:
login: { pattern: /login, security: true, anonymous: true }
@arghav
arghav / ResolveDefinitionTemplatesPass.php
Created March 9, 2011 12:13
Suppress exception if abstract
if (!$this->container->hasDefinition($parent = $definition->getParent())) {
if ($definition->isAbstract()) {
return null;
}
throw new \RuntimeException(sprintf('The parent definition "%s" defined for definition "%s" does not exist.', $parent, $id));
}
<?php
namespace Flock\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Flock\MainBundle\Form\EventForm;
use Flock\MainBundle\Entity\Event;
class DefaultController extends Controller
{
@arghav
arghav / config.yml
Created May 11, 2011 07:59
app/config/config.yml
framework:
#...
session:
default_locale: %locale%
lifetime: 3600
auto_start: true
storage_id: session.storage.pdo
#...
parameters:
@arghav
arghav / session_table.sql
Created May 11, 2011 08:01
SQL dump of my session table
CREATE TABLE `session` (
`sess_id` varchar(255) NOT NULL,
`sess_data` text NOT NULL,
`sess_time` int(11) NOT NULL,
PRIMARY KEY (`sess_id`),
UNIQUE KEY `sess_id_idx` (`sess_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@arghav
arghav / config.yml
Created May 24, 2011 06:52
PdoSessionStorage with DBAL connection
parameters:
pdo.options: []
pdo.db_options:
db_table: session
services:
session.storage.pdo:
class: Symfony\Component\HttpFoundation\SessionStorage\PdoSessionStorage
arguments:
- @doctrine.dbal.default.wrapped_connection
{
"name": "friendsofsymfony/twitter-bundle",
"type": "symfony-bundle",
"description": "Symfony FOSTwitterBundle",
"keywords": ["Twitter authentication"],
"homepage": "http://friendsofsymfony.github.com",
"license": "MIT",
"authors": [
{
"name": "FriendsOfSymfony Community",
<?php
// app/AppKernel.php
public function registerContainerConfiguration(LoaderInterface $loader)
{
$envParameters = $this->getEnvParameters();
if (@$envParameters['domain.name'] == 'domain2') {
$loader->load(__DIR__.'/config/domain2/config_'.$this->getEnvironment().'.yml');
} else {