/** * @param array $settings * * @return mixed */ public function resolve(array $settings = []) { $driver = new FluentDriver(array_get($settings, 'mappings')); $namingStrategy = $this->getNamingStrategy($settings); $driver->setFluentFactory(function (ClassMetadata $meta) use($namingStrategy) { return new Builder(new ClassMetadataBuilder($meta), $namingStrategy); }); return $driver; }
public function test_allow_other_fluent_implementations() { $driver = new FluentDriver(); $driver->setFluentFactory(function (ClassMetadata $metadata) { return new CustomBuilder(new ClassMetadataBuilder($metadata)); }); $mapping = $this->getMock(EntityMapping::class); $mapping->expects($this->once())->method('map')->with($this->isInstanceOf(CustomBuilder::class)); $driver->getMappers()->addMapper('fake', new EntityMapper($mapping)); $driver->loadMetadataForClass('fake', new ClassMetadataInfo('fake')); }