Is it possible to use cli command to build translation if I use constant in $translator->trans(); - symfony

Is it possible to use Symfony CLI command (ex: php bin/console translation:update --force -en) to build translation if I use a constant in a translator like that:
$translator->trans(self::ANY_CONSTANT);
That doesn't work for me now... But, if I put a string on it, that's work!
I am using Symfony 5 with twig.
I am not used Symfony for long and english is my second language, so, please, be indulgent.
Thanks in advance for your answers. ;)
PS: I did many research before asking this question. I found many things about translation, but no good information about how work this CLI command.

Translator and Console are two different component of symfony. Problem doesn't come from Console, please check if your CONSTANT value is an existing translation key.
If you got an error, please put here also your error message

Related

'XrmFakedContext' does not cointain a definition for 'ExecutePluginWith'

I'm trying to upgrade a unit test project to the latest version of FakeXrmEasy 2.1.2 and I'm getting the error below:
'XrmFakedContext' does not cointain a definition for 'ExecutePluginWith' and no accessible extension method 'ExecutePluginWith' accepting a first argument of type 'XrmFakedContext' could be found
Any ideas what I'm missing?
This might happen because some methods were moved into dedicated namespaces and so some extra using statements might be necessary.
Please try adding these usings:
using FakeXrmEasy.Abstractions.Plugins;
using FakeXrmEasy.Plugins;
Also please check the documentation site with other steps that might be useful. In particular the Quick Guide to migrate in 6 steps is probably an essential resource:
https://dynamicsvalue.github.io/fake-xrm-easy-docs/quickstart/migrating-from-1x/

Dump Documentation [NelmioApiDocBundle] v3.0

I'm using the NelmioApiDocBundle (v3.0) in my symfony 4 project and I want to dump the documentation of my Api project.
I see it's possible to do with older version of NelmioApiDocBundle with this command :
php bin/console api:swagger:dump destination_folder
but I got this error :
There are no commands defined in the "api:swagger" namespace
I don't know if it's still posible to dump the documentation with the new version of NelmioApiDocBundle
Seeing NelmioApiDocBundle makes me almost sure you are using FOSRestBundle, if you are I'd change to api-platform, you make ask why? First of all you get the API doc by default on route /api (no matter what format etc you always get full doc) second of all the bundle is easy to configure even if you need some custom funcionality like access to property per operation and even depending on role more here I've tried FOSRestBundle on Symfony 5.0 but it couldnt provide with the funcionality and configuration I desired and then I found out about the API platform. In case I missed your desired answer let me know in the comment and I'll provide the answer as good as I can

Map an entity in symfony 4

How about, I have a problem and it is before in symfony3 was run in the console:
php bin/console doctrine:mapping:import MiBundle yml
and generated and map an entity of the database but in Symfony 4 the command in the console is always the same, but the bundles are no longer occupied in the latest version so the previous command as it is does not work anymore, Someone could help me...
likewise generate the get and set
When using the new Symfony 4 directory structure without bundles the commands for importing the mapping and creating entities from an existing schema in the DoctrineBundle will no longer work properly. There is currently an ongoing discussion whether to update them, but the Doctrine team considers those tools counterproductive. You are not meant to blindly map the schema 1:1 to your domain model.
The best advice I can give for now is to temporarily create a bundle and then move the resulting files. This is also the workaround suggested in the github-issue regarding this: https://github.com/doctrine/DoctrineBundle/issues/729
The Symfony team is moving some of those commands into their own MakeBundle, but I don't think this command is already in there. Maybe you want to follow their progress.

symfony deployment error: mapped superclass

When I deploy a symfony website including mapped superclass entities online, I get the following error:
AnnotationException: [Semantical Error] The annotation "#Doctrine\ORM\Mapping\MappedSuperClass" in class Acme\DemoBundle\Entity\Foo does not exist, or could not be auto-loaded.
Worst is, this error doesn't show if we use web/app.php (with debugging mode true), whereas it blocks the programm if you use web/app_dev.php.
I should add that, locally, this error does not show up while using either web/app.php or web/app_dev.php.
Does anyone have a clue about this dark mystery?
Thanks in advance for any hints.
Ok,
I will be answering to my own question, for the sake of future deployment processed by any fellow programmer.
the problem was in the doctrine annotation.
I put:
#MappedSuperClass
whereas it is:
#MappedSuperclass
REMEMBER:
on mac, it doesn't make a difference. But also on linux if in prod mode (with debug option at true). that is why it was working with web/app.php.
However, in dev mode (web/app_dev.php), it doesn't work on a linux environment, which makes a difference between capitalized and normal letters.
I hope it will save you the headaches it caused me ;)
Regards,
Wisebes
[issue solved]

Symfony2 install ChillDevProxyTemplatingBundle - Cannot import resource

i´ve just installed the ChillDevProxyTemplating Bundle for symfony2, described here:
https://github.com/chilloutdevelopment/ChillDevProxyTemplatingBundle/blob/master/Resources/doc/installation.md
My templates was rennamed correctly by the bundle (from 'default' to 'php'), but when i try to call my controller I get the following error:
Cannot import resource "." from (...)app/cache/dev/assetic/routing.yml". (The following loader(s) are not registered: default).
Has anyone an idea how to fix??
Thanks a lot !
As explained here: https://github.com/chilloutdevelopment/ChillDevFileManagerBundle/issues/27
You might just need to install ChillDevViewHelpersBundle to get it working.
I previously added answer to this question, but it was removed by moderator since my reputation was not high enough to post a comment.
But now thanks to support of community I was able to investigate this problem:
https://github.com/chilloutdevelopment/ChillDevProxyTemplatingBundle/issues/2
It's now fixed :). Thank you for pointing the problem.
The problem was, that Assetic, in dev environment tries to parse all the templates based on templating engine name so it needs loader for each templating engine - of course for "default" there was no loader and thus caused an exception.

Resources