I try to configure Travis-ci with symfony (not easy !). When I run composer install, just after download all package, composer try to clear the cache, and execute a SQL query (why?), and, don't find the table (the migration command is after). I don't understand, why composer try to execute a query.
This is the code in travisci.yml:
install:
- cp .env.dist .env
- mysql -e 'create database testing;'
- composer install
after_install:
- php ./bin/console doctrine:migrations:diff
- php ./bin/console doctrine:migrations:migrate --no-interaction
#- php bin/console doctrine:migrations:migrate
#- php bin/console doctrine:fixtures:load -n --env=test
#- ./vendor/bin/simple-phpunit install
- ./bin/phpunit install
and the result :
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! // Clearing the cache for the dev environment with debug
!! // true
!!
!!
!! In AbstractMySQLDriver.php line 62:
!!
!! An exception occurred while executing 'SELECT t0.id AS id_1, t0.created AS
!! created_2, t0.updated AS updated_3, t0.name AS name_4, t0.source AS source_
!! 5 FROM twig_template t0 WHERE t0.name = ? LIMIT 1' with params [{}]:
!!
!! SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem
!! plate' doesn't exist
!!
!!
!! In PDOStatement.php line 144:
!!
!! SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem
!! plate' doesn't exist
!!
!!
!! In PDOStatement.php line 142:
!!
!! SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem
!! plate' doesn't exist
!!
or here in details: https://travis-ci.org/Dannebicque/intranetV3/builds/455840273
Thanks for your help
David
Related
i'm new to symfony 4, i tried to install admin panel by composer require admin command, but it sounds error :
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In Definition.php line 770:
!!
!! The deprecation template must contain the "%service_id%" placeholder.
!!
!!
!!
Script #auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
a new commit that seems to fix this issue was merged today in the repo EasyCorp/EasyAdminBundle.
Until they release next version, you could do
symfony composer req admin:3.0.x-dev
I am creating entities in the API Platform. Everytime I add a new entity or modify a field I run
docker-compose exec php bin/console doctrine:schema:update --force
to synchronize the schema. I faced no problems this far but after I created a datetime field and tried synchronizing I get a table already exists error
In AbstractPostgreSQLDriver.php line 66:
An exception occurred while executing 'CREATE SEQUENCE financial_statement_templates_definition_fstemplate_definition_id_seq INCREMENT BY 1 MINVALUE 1 START 1':
In PDOConnection.php line 83:
SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "financial_statement_templates_definition_fstemplate_definition_" already exists
In PDOConnection.php line 78:
SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "financial_statement_templates_definition_fstemplate_definition_" already exists
In the normal case I would have just dropped the tables and recreated it but since I am using the API Platform within docker I have no access to the database. Is there a way to resolve this?
Managed to figure this out. I dropped the database by running the following command
docker-compose exec php bin/console doctrine:database:drop --force
Then recreated the database using this statement from the command line
docker-compose exec php bin/console doctrine:database:create
Then updated the schema using this statement
docker-compose exec php bin/console doctrine:schema:update --force
Updating database schema...
6 queries were executed
[OK] Database schema updated successfully!
i've tried to update Symfony 4.3 runing the command "composer update". 107 packages were updated . then in the end of the script an error appeared when runing the command "cache:clear"
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 327:
!!
!! Unrecognized options "dir_name, namespace" under "doctrine_migrations". Ava
!! ilable options are "all_or_nothing", "check_database_platform", "connection
!! ", "custom_template", "em", "factories", "migrations", "migrations_paths",
!! "organize_migrations", "services", "storage".
!!
!!
!!
Script #auto-scripts was called via post-update-cmd
i did some reserches and i foud that i have to update the DoctrineMigrations config file
config/packages/doctrine_migrations.yaml :
from
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
to
doctrine_migrations:
migrations_paths:
"App\\Migrations": "src/Migrations"
Here are the steps, I am following:
Cloning my repository from github
git clone https://github.com/EresDev/EresNoteSymfony.git .
Updating .env file with APP_ENV=prod
Then performing install
composer install --no-dev
I get following error:
.
.
.
- Installing symfony/translation (v4.2.4): Loading from cache
- Installing symfony/validator (v4.2.4): Loading from cache
- Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
Script #auto-scripts was called via post-install-cmd
However, it works fine if I just use composer install without --no-dev
What can I do to make it work with --no-dev
Please refer to repository to access code if required.
apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run with commit e722218...)
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!! Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!! Stack trace:
!! #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!
you should somehow turn error display on ;o)
update:
your config/bundles.php:6 says:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)
after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.
I am trying to generate a new bundle for the OroCRM (Symfony2), but when I am trying to run the following
php app/console cache:clear
this error occur
Fatal error: Call to a member function getProperties() on null in /var/www/platform-application/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaValidator.php on line 239
try this:
sudo php app/console cache:clear
or this:
sudo php app/console cache:clear --force