Alan has written a great tutorial object manager argument replacement through di.xml . Everything works fine for me except nested arrays:
<type name="Pulsestorm\TutorialObjectManagerArguments\Model\Example">
<arguments>
<argument name="thearray" xsi:type="array">
<item name="baz" xsi:type="string">
<item name="0" xsi:type="string">one</item>
<item name="1" xsi:type="string">two</item>
</item>
</argument>
</arguments>
</type>
After using above di.xml configuration and running php bin/magento ps:tutorial-object-manager-arguments it says
There are no commands defined in the "ps" namespace
I'm missing something or the process of nesting arrays is changed now ?
1 Answer 1
Seems this error related to bin/magento utility. It tries to find command "tutorial-object-manager-arguments" in "ps". It is possible, that you have not installed a module or something went wrong with the module.
UPD. baz cannot be a string, it should be an array
<type name="Pulsestorm\TutorialObjectManagerArguments\Model\Example">
<arguments>
<argument name="thearray" xsi:type="array">
<item name="baz" xsi:type="array">
<item name="0" xsi:type="string">one</item>
<item name="1" xsi:type="string">two</item>
</item>
</argument>
</arguments>
</type>
-
This module is installed and working except my above configuration. After making baz to an array type, it shows other values but with error
[ErrorException] Array to string conversionamitshree– amitshree2016年02月03日 14:57:49 +00:00Commented Feb 3, 2016 at 14:57 -
1maybe cause the code waits, that $thearray should contain elements that can be converted to a string. look at Command classArkadii Chyzhov– Arkadii Chyzhov2016年02月03日 15:16:46 +00:00Commented Feb 3, 2016 at 15:16
Explore related questions
See similar questions with these tags.