"formapro/pvm": "^0.4.7"
"symfony/yaml": "3.*"
"doctrine/orm": "^2.6.2",
I am following your documentation example here:
https://pvm-demo.forma-pro.com/demo/store-to-mysql
I am however using more recent versions. I've had to update a few parts to make it work.
I'm now stuck on this line:
$doctrineDal = new DoctrineDAL($em, OrmProcess::class, OrmToken::class);
According to your example Argument 1 should be the EntityManager instance but for some reason it is expecting ObjectManager.
Everything seems to run fine up until this point...
$config = new Configuration();
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(\sys_get_temp_dir());
$config->setProxyNamespace('Proxies');
$config->setQueryCacheImpl(new ArrayCache());
$config->setMetadataCacheImpl(new ArrayCache());
$driver = new MappingDriverChain();
$annotationDriver = $config->newDefaultAnnotationDriver([BASE_DIR . 'app/StoreToDoctrine'], false);
$driver->addDriver($annotationDriver, 'MYAPP\StoreToDoctrine');
$xmlDriver = new SimplifiedXmlDriver([
realpath(BASE_DIR.'vendor/formapro/pvm/src/Doctrine/mapping') => 'Formapro\Pvm\Doctrine',
]);
$driver->addDriver($xmlDriver, 'Formapro\Pvm\Doctrine');
$config->setMetadataDriverImpl($driver);
$encryption = new Encryption();
$dbName = 'test';
$credentials = array (
'test' => array (
'username' => <removed>,
'pw' => <removed>,
'connstr' => <removed>,
'host' => <removed>
)
);
$conn = [
'url' => 'oci8:' . $credentials[$dbName]['username'] .':'. $credentials[$dbName]['pw'] . '@' . $credentials[$dbName]['host'] ."/" . $credentials[$dbName]['connstr'],
'user' => $credentials[$dbName]['username'],
'password' => <removed>,
"connectstring" => $credentials[$dbName]['host'] ."/" . $credentials[$dbName]['connstr']
];
$entityManager = EntityManager::create($conn, $config);
/* Formapro PVM */
use Formapro\Pvm\DefaultBehaviorRegistry;
use Formapro\Pvm\Doctrine\DoctrineDAL;
use Formapro\Pvm\ProcessEngine;
use Formapro\Pvm\Token;
use Formapro\Pvm\ProcessBuilder;
use MYAPP\Doctrine\OrmProcess;
use MYAPP\Doctrine\OrmToken;
$schemaTool = new SchemaTool($entityManager);
$schemaTool->updateSchema($entityManager->getMetadataFactory()->getAllMetadata());
Then I add this:
$doctrineDal = new DoctrineDAL($entityManager, OrmProcess::class, OrmToken::class);
And get the following error:
Fatal error: Uncaught TypeError: Argument 1 passed to Formapro\Pvm\Doctrine\DoctrineDAL::__construct() must be an instance of Doctrine\Common\Persistence\ObjectManager, instance of Doctrine\ORM\EntityManager given, called in <removed>/scripts/myapp.php on line 77 and defined in <removed>/vendor/formapro/pvm/src/Doctrine/DoctrineDAL.php:28
Stack trace:
#0 <removed>/scripts/myapp.php(77): Formapro\Pvm\Doctrine\DoctrineDAL->__construct(Object(Doctrine\ORM\EntityManager), 'MYAPP\\Doctrine\\Or...', 'MYAPP\\Doctrine\\Or...')
#1 {main}
thrown in <removed>/vendor/formapro/pvm/src/Doctrine/DoctrineDAL.php on line 28
I've only been able to find this possible solution online...
https://stackoverflow.com/questions/45678333/construct-must-be-an-instance-of-doctrine-common-persistance-objectmanager
But I'm not sure what they mean or how to resolve this.