symfony4

Fatal error while creating Symfony 4 project

萝らか妹 提交于 2019-12-24 20:44:46
问题 after running composer create-project symfony/website-skeleton my-project I get an error : Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 255 !! !! Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "FileResource" from namespace "App". !! Did you forget a "use" statement for "Symfony\Component\Config\Resource\FileResource"? in /Users/bastiennicolau/Documents/dev_web/my-project/src/Kernel.php:39 !! Stack

How to increment the session array value?

倖福魔咒の 提交于 2019-12-24 20:04:58
问题 I am using this on a shopping cart if (!empty($_getvars['id'])) { $data = $session->get('cart'); $data[] = $_getvars['id']; $session->set('cart', $data); } $_getvars['id'] is productid, and on each click, a new array element will be added to the session. It works fine as it is now, but if a product is chosen more than once a new array will be added, how can change it that productid will be array offset and the value will be incremented from 1 each time to reflect the quantity? $i = 1; if (

Fatal error in fresh skeleton Symfony 4 app

狂风中的少年 提交于 2019-12-24 19:39:23
问题 (I have previously tried to ask the same question, but quoted the wrong error message; this is the correct version): Right after creating a new app from symfony/skeleton, loading in the public dir in the browser yields internal server error 500. The web server error log gets an entry such as this: [Thu Jan 25 19:26:35.881140 2018] [:error] [pid 26752] [client .....:64137] PHP Fatal error: Uncaught TypeError: Return value of Symfony\\Component\\Dotenv\\Dotenv::populate() must be an instance of

paramconverter not converting parameters

五迷三道 提交于 2019-12-24 18:50:36
问题 I have a problem with symfony 4. i'm migrating an existing app from symfony 3.3 to symfony 4 and I get an error I can't correct. here is my controller : BaseController is the controller responding to sm_admin routes class HomeController extends BaseController { public function __construct(ParamBagService $parambag, CacheService $cache) { parent::__construct($parambag, $cache); $this->routePrefix = 'sm_adminarea_'; } /** * @Route("/", name="adminarea_index") * @Template("@SMAdmin/Home/index

Symfony 4 include another project from different directory

和自甴很熟 提交于 2019-12-24 18:23:23
问题 So, I have an application that consists of 5 different projects. Each of the projects is a new Symfony 4 project, since I need to host them on separate domains. My structure is like this: Admin project: /var/www/html/admin Client project: /var/www/html/client Owners project: /var/www/html/owners Each of the project has its own symfony skelet (src,public,config,bundles,public, etc...) I know this can be done through bundle, but, what I want to do is to create a new Symfony project (Common) and

Symfony 4 nor install correct version

江枫思渺然 提交于 2019-12-24 14:25:36
问题 So now I have been working with symfony 3.3 Try to follow the instructions to install symfony 4 with composer but install symfony 3.4.6 How can I achieve it? 回答1: try : composer create-project symfony/skeleton "dev-master" if it doesn't work, so you should update your composer version composer self-update if the problem remains clear composer cache and retry composer clearcache 来源: https://stackoverflow.com/questions/48851068/symfony-4-nor-install-correct-version

Symfony 4 : Default value for parameters with a class type can only be

廉价感情. 提交于 2019-12-24 09:41:20
问题 I am currently working on an application in symfony 4. I encounter a problem for deploy in prod. when I get to the navigator I get this error : Fatal error: Default value for parameters with a class type can only be NULL in /var/www/html/project/vendor/symfony/config/ResourceCheckerConfigCache.php on line 40. public function __construct(string $file, iterable $resourceCheckers = array()) { $this->file = $file; $this->resourceCheckers = $resourceCheckers; } I specify that the site works

Symfony 4 - 3rd-party bundle commands are no longer automatically discovered

筅森魡賤 提交于 2019-12-23 16:05:18
问题 According to the documentation, a command class must extend Command or ContainerAwareCommand to be automatically discovered and registered (provided its bundle is registered in the Kernel, of course). Since Symfony 4+, this discovery doesn't work as expected. Try this: composer create-project symfony/skeleton test-maxmind-sf4 cd test-maxmind-sf4 composer req cravler/maxmind-geoip-bundle dev-master php bin/console list You will notice that: cravler:maxmind:geoip-update is not registered

Symfony form: Uploaded file - “This value should be of type string”

折月煮酒 提交于 2019-12-23 09:30:02
问题 [UPDATED]: 2019/06/24 - 23;28 Uploading a file with a form, I encounter the following error: This value should be of type string The form builder is set to FileType as it should: FormType class DocumentType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { /** @var Document $salle */ $document=$options['data']; //Unused for now $dataRoute=$options['data_route']; //Unused for now $builder->add('nom') ->add('description') ->add('fichier', FileType

Api-Platform: Using Yaml config instead of annotations in SF 4

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 09:27:53
问题 I'd like to use YAML instead of annotations in Api-Platform. Instead of using the Api-Platform distribution, I have added the api-pack into my existing Symfony Flex project ( composer req api ). The documentation says the YAML file should take place in /config/api_platform/resources.yaml but my entities aren't discovered. Should I configure something somewhere else? Thank you, Ben 回答1: The only thing you need to do is to add the following configuration: api_platform: mapping: paths: ['%kernel