Skip to content

Instantly share code, notes, and snippets.

View guiwoda's full-sized avatar

Guido Contreras Woda guiwoda

View GitHub Profile
@guiwoda
guiwoda / ArticleRepository.php
Created February 12, 2015 17:54
injecting doctrine Repositories
<?php namespace App\Repositories;
// Already mapped to the Container in a ServiceProvider
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use App\Entities\Article;
class ArticleRepository extends EntityRepository
{
public function __construct(EntityManager $em)
@guiwoda
guiwoda / aggregate-root-events.md
Last active August 29, 2015 14:12
Agregate roots and events

Agregate roots and events

Given an aggregate Project, one Team (with many Devs) and one Source, if I $project->releaseEvents(), should the Project aggregate all events from all its related entities?

Example code:

Entities

<?php namespace App\Entities;
@guiwoda
guiwoda / example.php
Last active August 29, 2015 14:11
Embeddables with inheritance
<?php
abstract class Framework {
/**
* @type bool
*/
private $installsGlobally;
abstract public function download();
}
@guiwoda
guiwoda / foo.php
Last active August 29, 2015 14:11
IoC bindings in Laravel
<?php namespace Acme;
interface IFoo {}
class Foo implements IFoo {}
class Bar {
public function __construct(\Acme\IFoo $foo) {}
}
<?php
namespace Acme;
use Symfony\Component\HttpKernel\HTTPKernelInterface;
use Psr\Http\Message\RequestInterface;
class MyMiddleware implements HTTPKernelInterface {
private $kernel;
@guiwoda
guiwoda / ExpectationCommandBus.php
Last active August 29, 2015 14:04
Expectation in Commands
<?php
use Laracasts\Commander\CommandBus;
class ExpectationCommandBus implements CommandBus
{
/*
* Constructor injects the resolver...
*/
protected $expectationResolver;
cd /var/www
mv railsapp railsapp-old
hg clone --updaterev 2.0-stable https://bitbucket.org/redmine/redmine-all railsapp
cp railsapp-old/config/email.yml railsapp/config/configuration.yml
cp railsapp-old/config/database.yml railsapp/config/database.yml
cp -r railsapp-old/files/ railsapp/files/
chown -R root:www-data /var/www/railsapp
cd railsapp
gem install bundler
gem install test-unit