Permalink
Browse files

Merge pull request #9 from jonmchan/bugFixes-2012-10

Bug fixes 2012/10
  • Loading branch information...
beberlei committed Nov 19, 2012
2 parents 801400d + c5b8c19 commit f942e51a6e2a54388dde26d995ca7c9cabe7eb8e
Showing with 34 additions and 5 deletions.
  1. +24 −3 README.md
  2. +9 −1 lib/Doctrine/KeyValueStore/Mapping/ClassMetadataFactory.php
  3. +1 −1 tests/bootstrap.php
View
@@ -61,13 +61,27 @@ Suppose we track e-mail campaigns based on campaign id and recipients.
}
}
+### Create
+
$response = new Response("1234", "kontakt@beberlei.de", Response::RECIEVE);
$entityManager->persist($response);
//.... persists as much as you can :-)
$entityManager->flush();
+### Read
+
+ // untested, i have not tested composite id's
+ $response = $entityManager->find("Response",array("1234","kontakt@beberlei.de"));
+### Update
+ same as create, just reuse the same id.
+
+### Delete
+ $response = $entityManager->find("Response",array("1234","kontakt@beberlei.de"));
+ $entityManager->remove($response);
+ $entityManager->flush();
+
## Configuration
There is no factory yet that simplifies the creation process, here is the
@@ -80,10 +94,17 @@ Cache backend:
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Annotations\AnnotationReader;
- $storage = new DoctrineCacheStorage($cache);
$cache = new ArrayCache;
- $metadata = new AnnotationDriver(new AnnotationReader);
- $entityManager = new EntityManager($storage, $cache, $metadata);
+ $storage = new DoctrineCacheStorage($cache);
+
+ $reader = new AnnotationReader();
+ $metadata = new AnnotationDriver($reader);
+ $config = new Configuration();
+ $config->setMappingDriverImpl($metadata);
+ $config->setMetadataCache($cache);
+
+ $entityManager = new EntityManager($storage, $config);
+
If you want to use WindowsAzure Table you can use the following configuration
to instantiate the storage:
@@ -48,7 +48,7 @@ protected function getFqcnFromAlias($namespaceAlias, $simpleClassName)
throw new \InvalidArgumentException("aliasing is not supported.");
}
- protected function doLoadMetadata($class, $parent, $rootEntityFound)
+ protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents)
{
$this->getDriver()->loadMetadataForClass($class->name, $class);
@@ -94,5 +94,13 @@ protected function initializeReflection(ClassMetadata $class, ReflectionService
}
}
}
+
+ /**
+ * copied from doctrine/common - tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php
+ */
+ protected function isEntity(ClassMetadata $class)
+ {
+ return true;
+ }
}
View
@@ -1,6 +1,6 @@
<?php
-if (!@include __DIR__ . '/../vendor/.composer/autoload.php') {
+if (!@include __DIR__ . '/../vendor/autoload.php') {
die(<<<'EOT'
You must set up the project dependencies, run the following commands:
wget http://getcomposer.org/composer.phar

0 comments on commit f942e51

Please sign in to comment.