Skip to content

Instantly share code, notes, and snippets.

View jwage's full-sized avatar
💭
I am still here.

Jonathan H. Wage jwage

💭
I am still here.
View GitHub Profile

1.) find() is only for finding by identifier now

	$article = $dm->find('Article', array('title' => 'test'))

to

	$article = $dm->getRepository('Article')->findBy(array('title' => 'test'));

2.) Query builder change:

<?php
namespace Hydrators;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Hydrator\HydratorInterface;
use Doctrine\ODM\MongoDB\UnitOfWork;
/**
$path = sfConfig::get('sf_upload_dir').'/tracks/';
$fp = fopen($path.$track->getTeaserFile(), 'a+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.musicalturk.com/teaser.php');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_POST, true); $post = array(
if ($filter !== null) {
if ($filter->current) {
$expr = $qb->expr()->field('special.startDate')->lte($date)
->field('special.endDate')->gte($date);
$qb->addOr($expr);
}
if ($filter->upcoming) {
$expr = $qb->expr()->field('special.startDate')->gt($date);
$qb->addOr($expr);
}
@jwage
jwage / gist:767205
Created January 5, 2011 23:17 — forked from cwage/gist:767203
Employee:
columns:
id:
type: integer
primary: true
autoincrement: true
sf_guard_user_id:
type: integer
name:
type: string(155)
Employee:
columns:
id:
type: integer
primary: true
autoincrement: true
sf_guard_user_id:
type: integer
start_date:
type: date
sfGuardUser:
user_employee1:
username: employee1
password: changeme
Department:
dev:
title: Development
Employee:
server {
expires 1M;
listen 80;
root /var/www/vhosts/sociallynotable.com/socially-notable/web;
index index.php;
if ($host ~* ^www.(.*)) {
set $remove_www $1;
rewrite ^(.*)$ http://$remove_www$1 permanent;
}
<?php
// create SoftDeleteManager
$sdm = new SoftDeleteManager($dm);
// Soft delete a few documents
$sdm->delete($user);
$sdm->delete($product);
$sdm->delete($seller);
@jwage
jwage / Doctrine MongoDB ODM Tail Cursor Command Daemon
Created February 6, 2011 00:01
This is a Symfony2 Doctrine MongoDB ODM Tail Cursor console command. It can be ran as a daemon and it will tail a mongodb collection with a tailable cursor and process the documents with a given service as the "processor". You must specify the document, t
<?php
namespace MyCompany\Bundle\MyBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Request;