[RESOLU] duplication d'un projet symfo 2.8 pour dev local

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] duplication d'un projet symfo 2.8 pour dev local

Re: duplication d'un projet symfo 2.8 pour dev local

par Mathieu Delgado » 04 juil. 2019, 16:29

Super merci à toi Yann, ça fonctionne : j'ai un autre problème car l'appli allant chercher les identifiants de l'ordi (elle ne possède pas son système d'authentification) elle me refuse tout accès mais je vais voir avec le patron comment gérer ça passe une bonne soirée !

Re: duplication d'un projet symfo 2.8 pour dev local

par yann18 » 04 juil. 2019, 15:57

bonjour,
normal l'utilisateur n'est pas connecté. il faut vérifier que la variable $_SERVER contient l'index REMOTE_USER.
L'appli n'affichait pas ces erreurs en prod parce que les erreurs du genre notice, warning ... sont désactivées.

Concernant l'erreur sur le chargement de fichier, tu n'avais qu'à saisir la commande composer dump-autoloload pour régénérer un nouveau fichier d'autoload.

Après en terme de qualité on est très loin des bests practices de Symfony car ce dernier propose nativement l'authentification et la gestion des droits.

public function indexAction() {
$userRepo = $this->getDoctrine()->getRepository(Utilisateur::class);
$login =isset($_SERVER['REMOTE_USER']) ? substr($_SERVER['REMOTE_USER'], 5): false;
$user = $userRepo->findOneBy(['login' => $login]);
$admin = false;
if ($user == FALSE) {

}

}//
.

duplication d'un projet symfo 2.8 pour dev local

par Mathieu Delgado » 04 juil. 2019, 13:56

Bonjour,

Je suis en stage pour réparer et améliorer un outil métier de finance.
L’outil a été développé en symfony 2.8 et je n’ai que 5 semaines pour améliorer son fonctionnement.
Le site est toujours utilisé par le service finance et je dois le dupliquer ur ma machine locale pour pouvoir développer ses améliorations.
J’ai fait :
-copié les dossiers sans le vendor et sans les deux fichiers de log dev.log et prod.log .

Code : Tout sélectionner

composer install

Code : Tout sélectionner

C:\Users\delgadom\Desktop\prevision_paiement\prevision_paiement>composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 38 installs, 0 updates, 0 removals - Installing doctrine/lexer (v1.0.1): Downloading (100%) - Installing doctrine/annotations (v1.2.7): Downloading (100%) - Installing symfony/polyfill-ctype (v1.9.0): Downloading (100%) - Installing twig/twig (v1.35.4): Downloading (100%) - Installing symfony/symfony (v2.8.46): Downloading (100%) - Installing symfony/security-acl (v2.8.0): Downloading (100%) - Installing symfony/polyfill-util (v1.9.0): Downloading (100%) - Installing paragonie/random_compat (v2.0.17): Downloading (100%) - Installing symfony/polyfill-php70 (v1.9.0): Downloading (100%) - Installing symfony/polyfill-php56 (v1.9.0): Downloading (100%) - Installing ircmaxell/password-compat (v1.0.4): Downloading (100%) - Installing symfony/polyfill-php55 (v1.9.0): Downloading (100%) - Installing symfony/polyfill-php54 (v1.9.0): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.9.0): Downloading (100%) - Installing symfony/polyfill-intl-icu (v1.9.0): Downloading (100%) - Installing symfony/polyfill-apcu (v1.9.0): Downloading (100%) - Installing psr/log (1.0.2): Downloading (100%) - Installing doctrine/inflector (v1.1.0): Downloading (100%) - Installing doctrine/collections (v1.3.0): Downloading (100%) - Installing doctrine/cache (v1.5.4): Downloading (100%) - Installing doctrine/common (v2.5.3): Downloading (100%) - Installing jdorn/sql-formatter (v1.2.17): Downloading (100%) - Installing doctrine/doctrine-cache-bundle (1.3.3): Downloading (100%) - Installing doctrine/dbal (v2.5.13): Downloading (100%) Skipped installation of bin bin/doctrine-dbal for package doctrine/dbal: name conflicts with an existing file - Installing doctrine/doctrine-bundle (1.6.4): Downloading (100%) - Installing doctrine/orm (v2.4.8): Downloading (100%) Skipped installation of bin bin/doctrine for package doctrine/orm: name conflicts with an existing file Skipped installation of bin bin/doctrine.php for package doctrine/orm: name conflicts with an existing file - Installing incenteev/composer-parameter-handler (v2.1.3): Downloading (100%) - Installing sensiolabs/security-checker (v3.0.7): Downloading (100%) Skipped installation of bin security-checker for package sensiolabs/security-checker: name conflicts with an existing file - Installing sensio/distribution-bundle (v4.0.40): Downloading (100%) - Installing sensio/framework-extra-bundle (v3.0.29): Downloading (100%) - Installing tecnickcom/tcpdf (6.2.25): Downloading (100%) - Installing spipu/html2pdf (v4.6.1): Downloading (100%) - Installing monolog/monolog (1.23.0): Downloading (100%) - Installing symfony/monolog-bundle (v3.2.0): Downloading (100%) - Installing swiftmailer/swiftmailer (v5.4.12): Downloading (100%) - Installing symfony/swiftmailer-bundle (v2.6.7): Downloading (100%) - Installing sensio/generator-bundle (v3.1.7): Downloading (100%) - Installing symfony/phpunit-bridge (v2.8.46): Downloading (100%) paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.) symfony/polyfill-intl-icu suggests installing ext-intl (For best performance) sensio/framework-extra-bundle suggests installing symfony/psr-http-message-bridge (To use the PSR-7 converters) spipu/html2pdf suggests installing fagundes/zff-html2pdf (zff-html2pdf module ~0.1.1, if you need to integrate HTML2PDF with Zend Framework 2 (zf2)) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server) monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver) monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib) monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome) monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar) monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server) monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server) Generating autoload files > Incenteev\ParameterHandler\ScriptHandler::buildParameters Updating the "app/config/parameters.yml" file > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache // Clearing the cache for the dev environment with debug true [OK] Cache for the "dev" environment (debug=true) was successfully cleared. > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets Trying to install assets as relative symbolic links. --------- -------------------------- ------------------ Bundle Method / Error --------- -------------------------- ------------------ WARNING FrameworkBundle absolute symlink WARNING SensioDistributionBundle absolute symlink --------- -------------------------- ------------------ [OK] All assets were successfully installed.



Tout à l’air de s’être bien passé.
- Ensuite j’ai créé la bdd :

Code : Tout sélectionner

php app/console doctrine:database:create
- puis je l’ai mise à jour avec un php app/console doctrine :schema :update force et mes tables sont bien apparues dans ma bdd. je les ai remplie en important le fichier sql.
- Ensuite je lance le server

Code : Tout sélectionner

php app/console server:run
Cependant en allant sur le projet j’ai cette erreur :
Compile Error: Symfony\Component\Debug\DebugClassLoader::main(): Failed opening required 'C:\xampp\htdocs\prevision_paiement/vendor/autoload.php' (include_path='C:\xampp\php\PEAR')
Avec la suggestion en dessous : Stack Trace :
in src\AppBundle\Controller\DefaultController.php at line 31.
31 use AppBundle\Entity\Droit_utilisateur_service;
29 use AppBundle\Form\ImputationRechercheType;
30
31 require_once 'C:\xampp\htdocs\prevision_paiement/vendor/autoload.php';
32 require_once ('C:\xampp\htdocs\prevision_paiement\vendor\spipu\html2pdf\html2pdf.class.php');
33 ini_set("memory_limit", '256M');


je l'ai réglé en changeant le chemin des require_once .

cette erreur disparaît pour en afficher une autre, dans le default controller :
Notice: Undefined index: REMOTE_USER

public function indexAction() {
$userRepo = $this->getDoctrine()->getRepository(Utilisateur::class);
$login = substr($_SERVER['REMOTE_USER'], 5);
$user = $userRepo->findOneBy(['login' => $login]);
$admin = false;
if ($user == FALSE) {

Je ne vois vraiment pas ce que j’ai mal fait.
Je vous serais extrêmement reconnaissant pour votre aide.