Git Product home page Git Product logo

Comments (16)

norkunas avatar norkunas commented on July 23, 2024 1

But I am going to close this one as this is a Symfony specific issue

from foundry.

dmitryuk avatar dmitryuk commented on July 23, 2024

The library must be within dev composer section.

I've defined on all factories #[When('dev')] and #[When('test')] and don't use them in production code

I think you called cache:clear in dev environment, but compose install was with --no-dev
Try APP_ENV=production composer install

from foundry.

norkunas avatar norkunas commented on July 23, 2024
#30 [frankenphp_prod 8/8] RUN set -eux; 	mkdir -p var/cache var/log var/storage; 	composer dump-autoload --classmap-authoritative --no-dev; 	composer dump-env prod; 	composer run-script --no-dev post-install-cmd; 	chmod +x bin/console; sync;
#30 0.061 + mkdir -p var/cache var/log var/storage
#30 0.062 + composer dump-autoload --classmap-authoritative --no-dev
#30 0.225 Generating optimized autoload files (authoritative)
#30 9.151 Generated optimized autoload files (authoritative) containing 19049 classes
#30 9.164 + composer dump-env prod
#30 9.375 Successfully dumped .env files in .env.local.php
#30 9.382 + composer run-script --no-dev post-install-cmd
#30 9.549 
#30 9.549 Run composer recipes at any time to see the status of your Symfony recipes.
#30 9.549 
#30 9.555 Executing script cache:clear [KO]
#30 10.02  [KO]
#30 10.02 Script cache:clear returned with error code 1
#30 10.02 !!  
#30 10.02 !!  In AbstractRecursivePass.php line 177:
#30 10.02 !!                                                                                 
#30 10.02 !!    Invalid service "App\Foundry\PostFactory": class "Zenstru  
#30 10.02 !!    ck\Foundry\ModelFactory" not found while loading "App\Foundry\Factory\PostFactory".                                                           

I think it runs with prod env, because in dunglas/symfony-docker there is ENV APP_ENV=prod set above the failed instructions

from foundry.

dmitryuk avatar dmitryuk commented on July 23, 2024

can you send your services.yaml ?

from foundry.

norkunas avatar norkunas commented on July 23, 2024
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:

services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Kernel.php'
            - '../src/Security/SecurityIdentity.php'

    app.redis:
        class: Redis
        factory: ['Symfony\Component\Cache\Adapter\RedisAdapter', 'createConnection']
        arguments: ['%env(REDIS_DSN)%']

when@prod:
    parameters:
        .container.dumper.inline_factories: true

from foundry.

dmitryuk avatar dmitryuk commented on July 23, 2024

You should exclude Factory path for all environments and include into the test/dev

from foundry.

norkunas avatar norkunas commented on July 23, 2024

That's what #[When] attribute does it, no? πŸ™‚

from foundry.

dmitryuk avatar dmitryuk commented on July 23, 2024

I don't see When attribute in your config

from foundry.

norkunas avatar norkunas commented on July 23, 2024

Because attributes are declared on the factories itself

from foundry.

dmitryuk avatar dmitryuk commented on July 23, 2024

bin/console debug:container β€”env=production | grep SomeFactory

from foundry.

kbond avatar kbond commented on July 23, 2024

This does feel like a Symfony issue especially if it just started happening... Did you upgrade Symfony recently?

from foundry.

kbond avatar kbond commented on July 23, 2024

Possibly related: symfony/symfony#51106 & symfony/symfony#32995

from foundry.

norkunas avatar norkunas commented on July 23, 2024

Sorry, forgot to reply.

bin/console debug:container β€”env=production | grep SomeFactory

it does not return it

This does feel like a Symfony issue especially if it just started happening... Did you upgrade Symfony recently?

Possibly related: symfony/symfony#51106 & symfony/symfony#32995

Thanks, that must be it..
Then the workaround probably will be not using attributes :(

from foundry.

norkunas avatar norkunas commented on July 23, 2024

But still I don't understand why it started to occur randomly 😞

from foundry.

nikophil avatar nikophil commented on July 23, 2024

Hey @norkunas, does this problem still occur with Foundry v2 / last Symfony version?

from foundry.

norkunas avatar norkunas commented on July 23, 2024

It is still the same.

from foundry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.