Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a list of instructions how to switch from symfony 1.4.20 to FriendsOfSymfony1 #244

Open
klemens-u opened this issue Jan 15, 2021 · 6 comments

Comments

@klemens-u
Copy link

Hi everybody, and thanks for your effort to maintain symfony1.

Up until now I only cherry picked files from this repository e.g. for PHP version updates.
I now tried to switch over completely and had a few issues.

Could you please provide some information on the steps necessary to get started with 1.5.14?
Obviously some libs have been extracted.

  • Which Doctrine repo do you recommend?

  • Which Propel repo and version do you recommend?

  • Which Swiftmailer repo and version do you recommend? Here I noticed, that the version included in 1.4.20 does not work out of the box.

  • Any other repo's needed?

  • There were some BC changes. What changes are usually necessary to account for them?

Thank you!

@klemens-u
Copy link
Author

In the meantime found some information in the composer.json file. Could you please explain on how to get started with composer on an existing symfony 1.4.20 project?

@alquerci
Copy link
Contributor

alquerci commented Jan 15, 2021

Hello @klemens-u

I am going to answer all usual question that have the answer on the hand.

Which Doctrine repo do you recommend?

https://packagist.org/packages/friendsofsymfony1/doctrine1

There were some BC changes. What changes are usually necessary to account for them?

Not so much, but it depends on what features your project use.

Which Swiftmailer repo and version do you recommend?

It is installed on its latest version by composer (you saw the composer.json).

@fabd
Copy link

fabd commented Apr 23, 2021

Hi guys

Thanks a lot ! I am still maintaining a symfony 1.x app.

After updating all the files I added the following to factories.yml as indicated in WHATS_NEW

  mailer:
    class: sfNoMailer

I cleared cache with sf cache:clear --app=the_app_name --type=config

However my app is still trying to load SwiftMailer , I see this when I refresh the page:

Warning: require_once(/var/www/html/lib/vendor/symfony/lib/vendor/swiftmailer/lib/swift_required.php): failed to open stream: No such file or directory in /var/www/html/cache/koohii/dev/config/config_factories.yml.php on line 138

Is that normal?

Is sfNoMailer just disabling the initialization but it still requires the file? I was hoping to maybe just completely remove that folder as I don't use any of this features.

@alquerci
Copy link
Contributor

Hello @fabd

Is that normal?

After looking for #17

I found that following.

$instances[] = sprintf(
"if (!class_exists('Swift')) {\n".
" \$swift_dir = sfConfig::get('sf_swiftmailer_dir', sfConfig::get('sf_symfony_lib_dir').'/vendor/swiftmailer/lib');\n".
" require_once \$swift_dir.'/swift_required.php';\n".
"}\n".

So I can answer:
Yes, it is normal regarding the current implementation.

Solution 1

A workaround is to define an empty class Swift on your project.

Solution 2

You are welcome to contribute with a PR.

cc @damienalexandre what do you think about this issue?

@damienalexandre
Copy link
Contributor

I agree, SF1 require SwiftMailer classes, and sfNoMailer was only a workaround for performance (classes are loaded but not called / initialized). So you will have to keep the code even if you don't use it, or patch the ConfigHandler 👍

@fabd
Copy link

fabd commented Apr 27, 2021

Thank you both 👍 I created an empty class in my appConfiguration.class.php file, just class Swift { }. I thought this may have been why there is a conditional in the ConfigHandler code for mailer, but I wasn't sure. Either way it works, this old project uses Zend Mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants