non-existant parameter "mcx" when using app/console - symfony

I am currently trying to go through the api-platform tutorial on https://api-platform.com/doc/1.0/getting-started/api but at the point where I use the console script (database creation), I just get the following error:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
You have requested a non-existent parameter "mcx".
They mention to use the [api-platform] tag here, but it apparently does not yet exist.

Anyone who runs into this kind of issue, check your parameters.yml file. I apparently chose too complex of a "secret" as it doesn't like percent (%) symbols in values and tries to parse them as separate parameters to be injected.

Related

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

Cannot locate document specification because multiple schemas matched the message type while using a pipeline

I have 7 schemas lacking namespace and with the same root node. I know this results in an error when using the standard xml pipeline. So i made 7 receive pipelines that that have the schema as "Document Schema" (as described here wordpress in solution 3). I have done this before and then had it work but this time, it remained giving me the same error.
I tried looking into what could cause the error but haven't found anything yet and google searches come up with the problem of not using a custom receive pipeline.
I "solved" the issue by enabling AllowUnrecognisedMessage on the receivepipeline but i am not finding it a satisfying solution.

Installanywhere silent install is not respecting several properties in the response file?

I am trying to run a silent installation of an application using Installanywhere's silent install and response file functions. I have recorded a response file multiple times, and then run a silent install using that response file, yet certain properties are not used. The target directory always ends up being correct, but things like a passphrase or a server port are completely ignored. I have researched the vendor's boards and found nothing helpful on the topic. Can anyone with Installanywhere experience be of assistance?
If those panels are custom, it is a vendor bug: storing variable to response file is an additional action that should be added to custom panel code
it is possible though to investigate the installer and find out what variable to add to response file
The problem might be that the installer you are using relies on "merge modules". It seems that variable values are not passed to-and-from merge modules when running in silent mode.
I have unfortunately encountered this issue with the installers I'm working on, but the Flexera forums don't provide much help either:
silent installation with merge modules
merge module variable are accessible in silent install
The vendor may not even be aware of this either.
Just put to blank your default value in your "Set installanywhere variable"'s action, Otherwise values from your properties file (for silent install) will be overwrite by values define in action 'Set installAnywhere variable".
As stated in Flexera's documentation, you will need to set the variable both in your proxy's 'setVariable' method, and ReplayService 'register' method.
The 'register' method is responsible on writing the variable to the response file:
customCodePanelProxy.setVariable("MY_VAR", "MY_VALUE");
ReplayVariableService replayService = (ReplayVariableService)customCodePanelProxy.getService(ReplayVariableService.class);
// This will do the trick:
replayService.register("MY_VAR", "MY_VALUE");
For further details refer to this IA guide:
http://helpnet.flexerasoftware.com/InstallAnywhereAPI/IA2010/javadoc/com/zerog/ia/api/pub/ReplayVariableService.html

Upload Image file using Symfony2 without guessers?

I am using Symfony2 framework for one of my project. In this one, I want to upload an image. This is really easy to do so while following the Symfony2's cookbook. It works very well on my local machine. But when I put the whole application on my remote server (Planethoster.net shared hosting), it doesn't work because of the Type-Mime extension guessers. In fact, they are not enable on their servers... (phpinfo shows --disable-fileinfo)
So, basically the idea is to know if there is a solution to do the same action (uploading an image) without any extension guessers?
Thanks
What do you think of filtering the filename ? With the last three characters, you'll know the extension. Check out UploadedFile, there is a getClientOriginalName() method. What I would do is to explode it by the ., fetch the second entry of the resulting array, and then parse it to do what you want to do.
Would you like an example of code ?
To fix exception while uploading file using framework Symfony 2
Unable to guess the mime type as no guessers are available.
enable PHP extension php_fileinfo, to do this find your php.ini file and uncomment following line
; windows
extension=php_fileinfo.dll
or
; linux
extension=php_fileinfo.so

Invalid Type Error Occasionally in Symfony 2 Console

I have a Symfony 2 environment in which I am using a custom data type with Doctrine's MongoDB ODM mappings. This all works, except occasionally; when I go to clear the cache or install the assets I sometimes receive the following error:
[InvalidArgumentException]
Invalid type specified "..."
This seems to always happen with the next command I issue to the console after I have cleared the cache, later operations all succeed. Doctrine seems to have issues intermittently finding it, and I suspect it has to do with where I'm registering the type and when that occurs with relationship to when Doctrine processes the mappings.
The type is being added as part of the boot() method in another bundle which may not always be included.
What is happening here?
Can I somehow ensure that the type is loaded earlier, or provide it in a configuration file? As far as I can tell there is no way, at present, using the MongoDB configuration to specify custom types in a .yml file as described for the ORM here.
I found a good solution in this post.
The short answer is to add
\Doctrine\ODM\MongoDB\Mapping\Types\Type::registeredType('mytype', 'My\Type\Class');
in MyBundleClass::__consruct(). This will get the type registered before any warmup happens with the cache.
Using Type::registeredType() instead of Type::addType() will avoid checking to see if the type is already registered. In the case of Type::addType() will throw an exception if it has already been added.
To answer the second of my two questions above, I seem to have found a work-around for this, but I don't like it very much. It feels more like a hack than a proper solution.
In app/autoload.php after I register the annotation registry and driver, I call:
\Doctrine\ODM\MongoDB\Mapping\Types\Type::addType('mytype', 'My\Type\Class');
... and this appears to ensure that the type is registered when calling the console commands.

Resources