You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm on the way to build a complete php application in a PHAR archive.
Therefore i want to programmatically build a sqlite database and several other files, if they dont exists in the root folder, where the phar archive is executed.
If i programmatically want to execute orm:schema-tool:update --force, it will perfect work, when triggered by console, or apache - if the script is NOT in a phar archive.
As soon as i execute the generated PHAR archive, which contains exactly the same code, the orm:schema-tool:update --force will output No Metadata Classes to process
If the file /Test/public/index.php is via apache handler or console triggered, and the sqlite database /database.sqlite does not exist, doctrine will create the database by the annotations of the Entity.
Start of output on line 53 in C:/xampp/htdocs/test.lh/Test/public/index.php
I think not - if i look into the phar archive, all annotations are fully there, nothing is removed.
is the metadata driver pointing at the correct path?
Without PHAR execution its a normal absolute path, and correct.
With the PHAR execution its a Path into the PHAR archive phar://C:/xampp/htdocs/Project/generated/client.phar/src/Entity, but the path is correct.
if i scandir the phar uri from inside the phar, i get a full list of the entitiy files.
I can even open the EntityFiles and get there contents with file_get_contents - all annotations there, no problem in path or file itself.
Which results in path phar://C:/xampp/htdocs/Project/generated/client.phar/src/Entity.
Then in the vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php there is a RegexIterator (Line 211) which gathers all files of the path.
As result there is a foreach of all gathered files @ Line 220.
The output of the Entity Filename is like: phar://C:/xampp/htdocs/Project/generated/client.phar/src/Entity\Request.php
More bottom then he fetches all declared classes over get_declared_classes - fetches the reflection class of each declared class and $sourceFile = $rc->getFileName(); gets the source filename by the reflection class, which results in following:
Stackoverflow Link
Github Example
PHP 5.6.3
I'm on the way to build a complete php application in a PHAR archive.
Therefore i want to programmatically build a sqlite database and several other files, if they dont exists in the root folder, where the phar archive is executed.
If i programmatically want to execute
orm:schema-tool:update --force
, it will perfect work, when triggered by console, or apache - if the script is NOT in a phar archive.As soon as i execute the generated PHAR archive, which contains exactly the same code, the
orm:schema-tool:update --force
will outputNo Metadata Classes to process
If the file
/Test/public/index.php
is via apache handler or console triggered, and the sqlite database/database.sqlite
does not exist, doctrine will create the database by the annotations of the Entity.If you trigger the generated phar, the same code is triggered, but the output then is:
How is it possible to let Doctrine generate the sqlite file by the annotations - by execute the PHAR archive?
The text was updated successfully, but these errors were encountered: