Skip to content

Commit

Permalink
Merge pull request #10 from ElectricMaxxx/improvements
Browse files Browse the repository at this point in the history
increase symfony version bandwidth
  • Loading branch information
ElectricMaxxx committed Dec 15, 2014
2 parents 3fe1dc4 + 4abfb7d commit f9a3ceb
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ php:
env:
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.4.*
- SYMFONY_VERSION=2.5.*
- SYMFONY_VERSION=2.6.*
- SYMFONY_VERSION=dev-master

before_script:
Expand All @@ -22,4 +24,4 @@ notifications:

matrix:
allow_failures:
- env: SYMFONY_VERSION=dev-master
- env: SYMFONY_VERSION=dev-master
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,35 @@ doctrine implementations.

## Documentation

later ...
### Minimum Configuration


```yml

doctrine_orm_phpcr_adapter:
managers:
reference-phpcr:
defaul: doctrine_phpcr.odm.default_document_manager
reference-dbal-orm:
default: doctrine.orm.default_entity_manager
adapters:
mapping: true
auto_generate_proxy_classes: %kernel.debug%

```

You can add some mapping for the documents/entities as you used to know it in the ORM/ODM:

```yml

doctrine_orm_phpcr_adapter:
...
mappings:
some_name:
type: annotation
dir: ../Entity
is_bundle: true

```
Your will find the mapping information in the (library)[https://github.com/ElectricMaxxx/DoctrineOrmOdmAdapter]
19 changes: 19 additions & 0 deletions Tests/Resources/Fixtures/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
$container->loadFromExtension('doctrine_orm_phpcr_adapter', array(
'managers' => array(
'reference-phpcr' => array('default' => 'doctrine_phpcr.odm.default_document_manager'),
'reference-dbal-orm' => array('default' => 'doctrine.orm.default_entity_manager'),
),
'adapter' => array(
'auto_mapping' => true,
'auto_generate_proxy_classes' => true,
'mappings' => array(
'test_mapping' => array(
'type' => 'annotation',
'prefix' => '\Entity',
'dir' => '%kernel.root_dir%/../Entity',
'is_bundle' => false,
),
),
),
));
16 changes: 16 additions & 0 deletions Tests/Resources/Fixtures/config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
doctrine_orm_phpcr_adapter:
managers:
reference-phpcr:
default: doctrine_phpcr.odm.default_document_manager
reference-dbal-orm:
default: doctrine.orm.default_entity_manager
adapter:
mapping: true
auto_generate_proxy_classes: true
mappings:
test_mapping:
type: annotation
dir: %kernel.root_dir%/../Entity
prefix: \Entity
is_bundle: true

5 changes: 5 additions & 0 deletions Tests/Resources/app/config/routing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$routeCollection = new \Symfony\Component\Routing\RouteCollection();


return $routeCollection;
69 changes: 69 additions & 0 deletions Tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace Doctrine\ORM\Bundle\DoctrineOrmPhpcrAdapterBundle\Tests\Unit\DependencyInjection;

use Doctrine\ORM\Bundle\DoctrineOrmPhpcrAdapterBundle\DependencyInjection\Configuration;
use Doctrine\ORM\Bundle\DoctrineOrmPhpcrAdapterBundle\DependencyInjection\DoctrineOrmPhpcrAdapterExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase;

/**
* @author Maximilian Berghoff <Maximilian.Berghoff@gmx.de>
*/
class ConfigurationTest extends AbstractExtensionConfigurationTestCase
{
protected function getContainerExtension()
{
return new DoctrineOrmPhpcrAdapterExtension();
}

protected function getConfiguration()
{
return new Configuration();
}

public function testDefaultsForAllConfigFormats()
{
$expectedConfiguration = array(
'managers' => array(
array('name' => 'default', 'service' => 'doctrine_phpcr.odm.default_document_manager', 'type' => 'reference-phpcr'),
array('name' => 'default', 'service' => 'doctrine.orm.default_entity_manager', 'type' => 'reference-dbal-orm'),
array('name' => 'default', 'service' => 'doctrine_phpcr.odm.default_document_manager', 'type' => 'reference-phpcr'), // remove that duplication, when i find that
array('name' => 'default', 'service' => 'doctrine.orm.default_entity_manager', 'type' => 'reference-dbal-orm'),
),
'adapter' => array(
'auto_generate_proxy_classes' => true,
'default_adapter_manager' => 'default',
'adapter_managers' => array(
'default' => array(
'mappings' => array(
'test_mapping' => array(
'type' => 'annotation',
'prefix' => '\Entity',
'dir' => '%kernel.root_dir%/../Entity',
'is_bundle' => false,
'mapping' => true,
),
),
'auto_mapping' => true,
'metadata_cache_driver' => array(
'type' => 'array',
),
'class_metadata_factory_name' => 'Doctrine\ORM\ODMAdapter\Mapping\ClassMetadataFactory',
),
),
'proxy_dir' => '%kernel.cache_dir%/doctrine/PHPCRProxies',
'proxy_namespace' => 'PHPCRProxies'
),
);

$sources = array_map(function ($path) {
return __DIR__.'/../../Resources/Fixtures/'.$path;
}, array(
'config/config.yml',
'config/config.php',
));

$this->assertProcessedConfigurationEquals($expectedConfiguration, $sources);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,10 @@ public function testDefaultSessionSetting()
$this->assertContainerBuilderHasParameter('doctrine_orm_phpcr_adapter.sessions', array(
'default' => 'doctrine_orm_phpcr_adapter.default_session',
));

$this->assertContainerBuilderHasService('doctrine_orm_phpcr_adapter.event.phpcr', 'Doctrine\ORM\Bundle\DoctrineOrmPhpcrAdapterBundle\Event\PhpcrListener');
$this->assertContainerBuilderHasService('doctrine_orm_phpcr_adapter.event.orm', 'Doctrine\ORM\Bundle\DoctrineOrmPhpcrAdapterBundle\Event\OrmListener');
$this->assertContainerBuilderHasServiceDefinitionWithTag('doctrine_orm_phpcr_adapter.event.phpcr', 'doctrine_phpcr.event_subscriber');
$this->assertContainerBuilderHasServiceDefinitionWithTag('doctrine_orm_phpcr_adapter.event.orm', 'doctrine.event_subscriber');
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"electricmaxxx/doctrine-orm-odm-adapter": "1.0.*@dev"
},
"require-dev": {
"symfony/symfony":"2.5.*",
"symfony-cmf/testing": "dev-master",
"matthiasnoback/symfony-dependency-injection-test": "0.*",
"matthiasnoback/symfony-config-test": "0.*",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<listener class="Symfony\Cmf\Component\Testing\Phpunit\DatabaseTestListener" />
</listeners>

</phpunit>
</phpunit>

0 comments on commit f9a3ceb

Please sign in to comment.