What is the best practice way to handle changes to configuration parameters (kept in yml) that have to happen at runtime?
I am working on a site where the owner wants to change various settings in his admin back end.
For example, enabling/disabling the confirmation email and link sent by FOS User bundle when a new user registers for an account.
Thanks for your time
For those operations you need the use Compiler Pass.
https://symfony.com/doc/current/service_container/compiler_passes.html
Here sample Custom Compiler pass;
https://symfony.com/doc/current/components/dependency_injection/compilation.html#creating-separate-compiler-passes
Here is a good example for compiler passes; ( Usually using with service tags )
https://symfony.com/doc/current/service_container/tags.html
Related
create a new project Symfony
preparing users for enrollment setup symfony console make:user
create a registration form symfony console make:registration-form
do symfony composer require symfonycasts/verify-email-bundle to send emails upon registration
in .env write MAILER_DSN=...
make migrations and all that.
go to automatic route /register
I fill out the form and submit...
mail is sent via
$this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
(new TemplatedEmail())
->from(new Address('***#***.com', 'My_Sender'))
->to($user->getEmail())
->subject('Please Confirm your Email')
->htmlTemplate('registration/confirmation_email.html.twig')
);
everything is standard. the code is fully automatic, I haven't changed it by hand yet.
all OK. no mistakes
BUT! there are no letters.
but in the table messenger_messages a new message appears.
I'm just studying symfony, and it's generally not clear to me how to force the letter to be sent, instead of (well, or at least after) saving it in a table messenger_messages.
in video, at the prompt of which I do all this, instead of saving it in a table - everything sent fine :(
how can i send a letter?
if you just tell me how to turn off messenger so that letters are sent without his help, it will work too :)
I read the documentation, but so far I still don’t understand how to send a letter past the messenger.
So far, the only thing I have come up with is to create a new project with a minimum number of bundles, and install them manually one by one in order to skip the messenger.
but that's not a solution at all :)
Try to put: message_bus: false
in your file config/packages/mailer.yaml
like this:
framework:
mailer:
dsn:'%env(MAILER_DSN)%'
message_bus: false
I have an XF app that I'm trying to provide multiple languages for using resx/AppResources files. However, I have a need to be able to access the English (default language values) at runtime for logging purposes. Basically the app has Activities that the user can complete. Each activity has a title that is translated. When an activity is completed by the user I want to log it too my server so I can see which activities are being used the most. Obviously I'd rather not log the Chinese titles.
What are the best way(s) I can retrieve the default language values regardless of what the App's current language is set to?
Regards,
Sean
On Android:
Locale.Default.GetDisplayLanguage(Locale.Default)
On IOS:
var te = NSLocale.CurrentLocale.LocaleIdentifier;
First, thanks Hasura for incredible good product! I love it.
I have issue with derive action with Hasura Console. My use case:
I enable anonymous role for subscribe function (everybody can send email to subscribe)
I have configured permission on my subscribe table, everything is fine.
I want to validate the user input on server side, for example, validate email format. I have followed by this guide about derive action. I found no mistake here.
But I got the error "Type query_root must define one or more fields." when I hit "Derive action" at the first time.
According to this question, as I understand, I need to have object type for root query.
Of course, I will have object type for root query eventually. I can work around by giving some dummy queries for anonymous role. But I do not like that cheat anyway.
Any idea on that? Any help will be highly appreciated.
Edited:
My related current version:
Hasura 1.3.2
One click deployment using Docker on Digital Ocean.
I have some config variables on the .env file. I want to create a page on my web application to allow the administrators to modify the value of some .env variables (for example the mail configured to send mails). For this purpose, I have:
MAILER_SENDER_ADDRESS=backoffice#example.com
MAILER_SENDER_NAME="Application Name"
MAILER_URL=gmail://firstname.lastname#gmail.com:ijfxxiencrrdqihe#localhost
I am able to read the current values on my controller but I don't know how to save back the values filled by the user on my form.
Please, any help would be really apreciated.
Environment variables are there to help you specify variables for the particular environment your application runs on, for example you could have your app sitting locally on your computer which you develop on, and you could have it in the cloud running the production version of your app, version which will actually send emails correctly using real data.
What you need to do is have somewhere to store the settings you let your users customise, for example in a database. When it comes to sending the emails, you will then have to do the following:
$message = (new Swift_Message())
->setFrom(['john#doe.com' => 'John Doe'])
...
How to get a list of active workflows/tasks of current user in Alfresco by JavaScript API ?
It is require to create a rule which will write active tasks to the some file and hang/attach this rule to/on a folder.
Yes it is possible to get the list of workflows.
You can do that with the following api.
GET /alfresco/service/api/task-instances?authority={authority?}&state={state?}&priority={priority?}&pooledTasks={pooledTasks?}&dueBefore={dueBefore?}&dueAfter={dueAfter?}&properties={properties?}&maxItems={maxItems?}&skipCount={skipCount?}&exclude={exclude?}
GET /alfresco/service/api/workflow-instances/{workflow_instance_id}/task-instances?authority={authority?}&state={state?}&priority={priority?}&dueBefore={isoDate?}&dueAfter={isoDate?}&properties={prop1, prop2, prop3...?}&maxItems={maxItems?}&skipCount={skipCount?}&exclude={exclude?}
Note: You can set your own parameters according to your requirements in the request
See the documentation.