Skip to content

Instantly share code, notes, and snippets.

@liuggio
Created June 25, 2013 14:01
Show Gist options
  • Save liuggio/5858661 to your computer and use it in GitHub Desktop.
Save liuggio/5858661 to your computer and use it in GitHub Desktop.
<?php
$factory = new FactoryObject();
$this->changeSetEventManager = new EventManager();
$this->changeSet = new ChangeSet($this->changeSetEventManager);
$extractor = new IdentityExtractorFactory();
$extractor->add('Spicci\Github\Entity\Milestone', '\Spicci\Github\IdIdentityExtractor');
$this->identityMap = new IdentityMap($extractor);
$this->identityMapSynchronizer = new IdentityMapSynchronizer($this->identityMap);
$this->changeSetEventManager->attach($this->identityMapSynchronizer);
$this->unitOfWork = new SimpleUnitOfWork($this->changeSet);
$this->objectLoaderFactory = new ObjectLoaderFactory($this->unitOfWork, $factory);
$this->objectLoaderFactory->add('\Spicci\Github\Entity\Milestone', '\Spicci\Github\ObjectLoader');
$this->repositoryFactory = new ObjectRepositoryFactory($this->unitOfWork, $this->objectLoaderFactory, $this->identityMap);
$this->repositoryFactory->add('\Spicci\Github\Entity\Milestone', '\Spicci\Github\Entity\MilestoneRepository');
$this->objectManager = new ObjectManager($this->repositoryFactory);
$this->committer = new SimpleLoggingCommitter();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment