What is the difference difference between AwsS3 and Amazon S3 (amazon_s3) for KnpGaugretteBundle? - symfony

I'm trying to use Gaufrette and S3 in my Symfony project and it doesn't work. I got the error:
PHP Fatal error: Class 'AmazonS3' not found in /var/www/headoo/app/cache/dev/appDevDebugProjectContainer.php on line 514
So I guessed that maybe I am using the wrong version of the adapter. But I don't understand what is the difference between AwsS3 and Amazon S3. The doc seems a little short for those who are starting with S3.
I use one of the latest versions of aws-sdk-php which is 3.2.*.

I'm using this set of bundles in latest symfony and it works great:
"knplabs/gaufrette": "dev-master",
"knplabs/knp-gaufrette-bundle": "dev-master",
"amazonwebservices/aws-sdk-for-php": "dev-master",
"cybernox/amazon-webservices-bundle": "dev-master",
"aws/aws-sdk-php": "~2.7#dev"

Related

doctrine migrations configuration: kernel.project_dir is not interpolated

I'm trying to generate and execute migrations using doctrine/doctrine-migrations-bundle.
Project specs:
Project deployed in docker. Mapping configured successfully.
Framework: symfony.
Kernel::getProjectDir() overrided successfully.
Project dependencies (not all, only important for this topic) from composer.json:
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.7",
"symfony/framework-bundle": "5.1.*",
My project has migrations for two databases. There are 2 config files for this. An example of one of them for understanding (absolute path in container /opt/app/config/packages/migrations/some_config.yaml):
custom_template: '%kernel.project_dir%/config/migration_template.txt' # <- this not works
# custom_template: '/opt/app/config/migration_template.txt' # <- this works
em: some_em
transactional: false
migrations_paths:
'DoctrineMigrations': '%kernel.project_dir%/src/DoctrineMigrations' # <- this not works
#'DoctrineMigrations': '/opt/app/src/DoctrineMigrations' # <- this works
Problem:
I'm trying to generate migration, using following command:
bin/console doctrine:migrations:generate --configuration='/opt/app/config/packages/migrations/some_config.yaml'
An exception is thrown with an message:
The specified template "%kernel.project_dir%/config/migration_template.txt" cannot be found or is not readable
For absolute path everything works fine.
I have tried to debug doctrine-migrations package code and found, that path %kernel.project_dir%/config/migration_template.txt does not turn into /opt/app/config/migration_template.txt
I think the problem is that the command is implemented in the doctrine/migrations lib and is unaware of Symfony, and therefore doesn't know about container parameters. The Doctrine migrations docs have an example for such a path, so you might try this:
'./src/DoctrineMigrations'
(didn't try myself though).
The relevant part in the docs is here: https://www.doctrine-project.org/projects/doctrine-migrations/en/3.6/reference/configuration.html#configuration

Symfony 4.2 override translation bundle doesn't work

Symfony 4.2 documentation :
"
For example, to override the translations defined in the Resources/translations/FOSUserBundle.es.yml file of the FOSUserBundle, create a<your-project>/translations/FOSUserBundle.es.yml file.
"
That's doesn't work for me and i clean my cache ! Any one have some idea ?
Symfony take always the FOSUserBundle.es.yml of vendor.
Create a folder in /translations/FOSUserBundle/, move the translations you need and redo it.
"friendsofsymfony/user-bundle": "^2.1"
"symfony": "require": "4.2.*"

After a vendor update the Login from FosuserBundle returns Call to a member function has() on nu

in Januar I have the similar problem, and actually I'm wondering why the problem comes again:
It's a symfony 2.8 project, and I'm using the fosuserbundle, in the config.json is the version
"friendsofsymfony/user-bundle": "~2.1",
So its not a dev-Version. On 5th Januar I make a vendor update - all works fine.
Yesterday i make an vendor update, and on calling the /login I got
Call to a member function has() on null
at
[path_to_my_project] /vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php line 184
I have tested to downgrade the fosuserbundle, but that does not help. I assume, it has to with some update on the symfony sources after the 5th Janaur 2018.
Has somebody acutally the same problem?
Cheers
Thomas
For those, who has the similar problem: It seems it has to do with some changes from
"friendsofsymfony/user-bundle": "2.0.2" to "friendsofsymfony/user-bundle": "2.1.0".
So i write in the composer.json the Version 2.0.2 until i find exactly, why this problem occurs.

Add phpexcel to my project

I need to generate Excel files, I did a search and phpexcel seems to be good and stable. I'd like to know:
* how to integrate it into my project given that it's a symfony2.0 project
* if I can do all what I do normally on excel file through this php library (cells colors, adding lists ...)
Thanks,
If you are using composer, and since PHPExcel is registered with Packagist, then this is simply a matter of adding PHPExcel to your composer.json config, for example:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
...
"phpoffice/phpexcel": "~1.8.0",
This is from a Symfony 2.4 configuration, but should work equally well for any version of Symfony.
Run $ php composer.phar update to grab the package and it should then be autoloaded into your project. You can then use PHPExcel immediately, say in a controller:
<?php
namespace SomeProject\SomeBundle\Controller;
use PHPExcel;
Or just reference \PHPExcel directly from within your code.
Update:
Note that composer found it's way into Symfony from around version 2.0.4, and was used as an alternative to the old deps and deps.lock files until the deps approach was deprecated from 2.1.
If you're still using deps, you can append this to your deps file:
[PHPExcel]
git=git://github.com/PHPOffice/PHPExcel.git
target=phpexcel
and run php bin/vendors install. This will put the PHPExcel in vendors/phpexcel.
Register PHPExcel with the registerPrefixes array in app/autoload.php and it should be available to your project as described above.
$loader->registerPrefixes(array(
'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
'Twig_' => __DIR__.'/../vendor/twig/lib',
'PHPExcel' => __DIR__.'/../vendor/phpexcel/Classes'
));

Installing EWZRecaptchaBundle in Symfony2

I'm using symfony 2.4.0, and I want to install the EWZRecaptchaBundle to add a captcha to my forms, so I added this line to composer.json
"require": {
//...
"excelwebzone/recaptcha-bundle": "2.0.*"
//...
}
And I run this command
composer update
But it doesn't install the bundle successfully, and this is the error message I get, in the command
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package excelwebzone/recaptcha-bundle could not be found in
any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
problems.
For the record, this is the Github link to the bundle I want to install :
https://github.com/excelwebzone/EWZRecaptchaBundle
Any idea??
Notes:
I use the command line as an Administrator.
I tested also with this line : ""excelwebzone/recaptcha-bundle": "dev-master"
The same result when I set minimum stability setting to : "dev" or "stable"
Try to use this require:
"excelwebzone/recaptcha-bundle": "dev-master"
Because 2.0.x-dev are in development now. or use old stable version:
"excelwebzone/recaptcha-bundle": "v1.0.0"
Victor you are completely right. However some might still encounter issues with the versioning.
You will still have an issue unless you use the exact 1.0 version.
So after doing the require:
composer require "excelwebzone/recaptcha-bundle"
you will have do add the version 1.0 like:
Please provide a version constraint for the excelwebzone/recaptcha-bundle requirement: 1.0.*

Resources