for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cube\DoctrineEntityFactory;
/**
* Instantiates a given entity bypassing it's constructor
*
* @author Gabriel Somoza <[email protected]>
*/
final class BypassConstructorEntityFactory implements EntityFactoryInterface
{
* Gets an instance of the specified entity
* @param string $entityClassName
* @return object
public function get($entityClassName)
$klass = new \ReflectionClass($entityClassName);
return $klass->newInstanceWithoutConstructor();
}