To achieve:
class LoadUserData implements FixtureInterface, ContainerAwareInterface {Private $ container; / ** * {@inheritDoc} * / Public Function Load (ObjectManager $ Manager) {} Public Function setContainer (ContainerInterface $ Container = Faucet) {$ this- & gt; Container = $ Container; }}
Any suggestions?
So if you've expanded Principle: Bundle \ FixturesBundle \ Command \ LoadDataFixtures DoctrineCommand
and then you can set the value that is passed as a container parameter, managed to add an additional logic
< Code> & lt ;? Php namespace is your \ bundle \ command; Use Symfony \ Component \ Console \ Input \ InputInterface; Use Symfony \ Component \ Console \ Output \ OutputInterface; Use the principle \ bundle \ fixture bundle \ command \ loaded data fixtures dottrin command; Class LoadDataFixersMododatDataFixContentDococrydom Commands Extended {/ ** * {@ Inherit Doc} * / Configure Protected Function () {parent :: configure (); $ This- & gt; Add option ('custom option', blank, input options :: VALUE_OPTIONAL, 'your custom option'); } / ** * {@inheritDoc} * / Perform the protected function (InputInterface $ input, OutputInterface $ production) {$ this- & gt; GetContainer () - & gt; SetParameter ('custom option', $ input- & gt; getOption ('custom option')); Original: Execution ($ input, $ output); }}
Then get the container parameter in its fixtures class.
Comments
Post a Comment