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
// works in production
core:PRIMARY> db.test.insert({test:new Date('2014-01-29 03:00')})
core:PRIMARY> db.test.find().pretty()
{
"_id" : ObjectId("52e930ef400853587d69153f"),
"test" : ISODate("1970-01-01T00:00:00Z")
}
// does not work in other dev/local envs
<?php
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Persistence\ObjectManager;
class ObjectSerializer
{
private $om;
public function __construct(ObjectManager $om)
<?php
use PHPUnit_Framework_TestCase;
use Symfony\Component\DomCrawler\Crawler;
class SimpleHttpTest extends PHPUnit_Framework_TestCase
{
public function testHttp()
{
$crawler = new Crawler(file_get_contents('http://myapp.lcl/hello/Jon'));
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Doctrine\Tests\ORM\Mapping\User" table="cms_users">
<lifecycle-callbacks>
<?php
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->setPrimaryTable(array(
'name' => 'cms_users',
));
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->addLifecycleCallback('doStuffOnPrePersist', 'prePersist');
Doctrine\Tests\ORM\Mapping\User:
type: entity
table: cms_users
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
<?php
namespace Doctrine\Tests\ORM\Mapping;
/**
* @Entity
* @HasLifecycleCallbacks
* @Table(name="cms_users")
*/
class User
class OutputWriter
{
private $_closure;
public function __construct($closure = null)
{
if ($closure === null) {
$closure = function($message) {};
}
$this->_closure = $closure;
protected function _getMigrationConfiguration(InputInterface $input, OutputInterface $output)
{
$outputWriter = new OutputWriter(function($message) use ($output) {
return $output->writeln($message);
});
<?xml version="1.0"?>
<!--
Doctrine 2 build file.
-->
<project name="Doctrine2" default="build" basedir=".">
<import file="build-dependencies.xml"/>
<taskdef classname="NativePhpunitTask" classpath="./tests/" name="nativephpunit" />