Skip to content

Instantly share code, notes, and snippets.

In your repositories, watching your code. Always watching.

Marco Pivetta Ocramius

In your repositories, watching your code. Always watching.
Block or report user

Report or block Ocramius

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Ocramius / compiler-pass.php
Last active Dec 4, 2019
Compiler pass to declare a repository as service for each declared doctrine entity in a symfony application
View compiler-pass.php
final class RegisterRepositoriesForAllEntitiesPass implements CompilerPassInterface
/** {@inheritdoc} */
public function process(ContainerBuilder $container)
/** @var MappingDriver $metadata */
$metadata = $container->get($this->mappingDriverServiceName());
$entityManagerReference = new Reference('doctrine.orm.entity_manager');
Ocramius / proposed-dql-inspections.php
Created Sep 21, 2018
DQL inspections example/proposal for JetBrains PHPStorm EAP
View proposed-dql-inspections.php
class Foo {
private $bar = 'baz';
/** @var Baz @ORM\ManyToOne(targetEntity=Baz::class) */
private $baz;
class Baz {
private $tab = 'taz';
Ocramius / DOCTRINE-ORM-3.x-BC-BREAKS-2018-09-12.txt
Last active Sep 12, 2018
Doctrine ORM 3.x BC breaks as per 2018-09-12
View DOCTRINE-ORM-3.x-BC-BREAKS-2018-09-12.txt
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_resultSetMapping was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_em was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_hints was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_hydrationMode was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_queryCacheProfile was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_expireResultCache was removed
[BC] REMOVED: Property Doctrine\ORM\AbstractQuery#$_hydrationCacheProfile was removed
[BC] REMOVED: Method Doctrine\ORM\AbstractQuery#_doExecute() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMInvalidArgumentException::invalidEntityName() was removed
[BC] CHANGED: The parameter $associationMapping of Doctrine\ORM\ORMInvalidArgumentException::newEntityFoundThroughRelationship() changed from array to a non-contravariant Doctrine\ORM\Mapping\AssociationMetadata
Ocramius / BC-BREAKS.txt
Created Aug 20, 2018
doctrine/dbal 2.7.2 -> 2.8.0 Backwards Compatibility (BC) breaks
View BC-BREAKS.txt
[BC] CHANGED: Type documentation for property Doctrine\DBAL\Connection#$_conn changed from \Doctrine\DBAL\Driver\Connection to \Doctrine\DBAL\Driver\Connection|null
[BC] CHANGED: Type documentation for property Doctrine\DBAL\Connections\MasterSlaveConnection#$connections changed from \Doctrine\DBAL\Driver\Connection[] to \Doctrine\DBAL\Driver\Connection[]|null[]
[BC] CHANGED: Type documentation for property Doctrine\DBAL\Connection#$_conn changed from \Doctrine\DBAL\Driver\Connection to \Doctrine\DBAL\Driver\Connection|null
[BC] CHANGED: Type documentation for property Doctrine\DBAL\Connection#$_conn changed from \Doctrine\DBAL\Driver\Connection to \Doctrine\DBAL\Driver\Connection|null
[BC] SKIPPED: Provided node "Symfony\Component\Console\Command\Command" is not class, but "interface"
[BC] SKIPPED: Provided node "Symfony\Component\Console\Command\Command" is not class, but "interface"
[BC] SKIPPED: Provided node "Symfony\Component\Console\Command\Command" is not class, but "interface"
[BC] SKIPPED: Provided
Ocramius / Caddyfile
Last active Dec 5, 2019
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
View Caddyfile
:80 {
root /serve
View .gitlab-ci.yml
- docker:dind
image: tiangolo/docker-with-compose
- docker info
View BC-BREAKS.txt
[BC] REMOVED: Method Doctrine\ORM\ORMException::missingMappingDriverImpl() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::namedQueryNotFound() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::namedNativeQueryNotFound() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::entityMissingForeignAssignedId() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::entityMissingAssignedIdForField() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::unrecognizedField() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::unexpectedAssociationValue() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::invalidOrientation() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::invalidFlushMode() was removed
[BC] REMOVED: Method Doctrine\ORM\ORMException::entityManagerClosed() was removed
View example.php
use Zend\Diactoros\Response;
use Zend\Diactoros\Server;
use Zend\Stratigility\MiddlewarePipe;
use function Zend\Stratigility\middleware;
require 'vendor/autoload.php';
$app = new MiddlewarePipe();
View NameResolvingParser.php
namespace Roave\BetterReflection\SourceLocator\Ast\Parser;
use PhpParser\ErrorHandler;
use PhpParser\NodeTraverser;
use PhpParser\NodeTraverserInterface;
use PhpParser\NodeVisitor\NameResolver;
View output.txt
/usr/bin/php /home/ocramius/Documents/roave/ApiCompare/bin/api-compare api-compare:compare --from=v2.6.0 --to=master lib/Doctrine/ORM/Mapping/
Comparing from 83cb274a7a4d7dcef9133f6d7973f132b140efd3 to 50da42f2f472a705586a2803f9acbb991b8db0a2...
Loading composer repositories with package information
Updating dependencies
Package operations: 10 installs, 0 updates, 0 removals
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing doctrine/annotations (v1.6.0): Loading from cache
- Installing doctrine/cache (v1.7.1): Loading from cache
- Installing doctrine/collections (v1.5.0): Loading from cache
- Installing doctrine/inflector (v1.3.0): Loading from cache
You can’t perform that action at this time.