<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oxid-professional-services / oxid-console example snippets
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
/**
* My own command
*
* Demo command for learning
*/
class MyOwnCommand extends Command
{
/**
* {@inheritdoc}
*/
public function configure()
{
$this->setName('my:own');
$this->setDescription('Demo command for learning');
$this->addOption('demo', 'd', InputOption::VALUE_NONE, 'run demo');
}
/**
* {@inheritdoc}
*/
public function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('demo')) {
$output->writeln('You typed in --demo or -d also');
}
$output->writeln('My demo command finished');
}
}
class AddAmountFieldToDemoModuleMigration extends oxMigrationQuery
{
/**
* {@inheritdoc}
*/
public function up()
{
// TODO: Implement up() method.
}
/**
* {@inheritdoc}
*/
public function down()
{
// TODO: Implement down() method.
}
}
// FILE: 20140414085723_adddemoculumntooxuser.php
class AddDemoCulumnToOxUserMigration extends oxMigrationQuery
{
/**
* {@inheritdoc}
*/
public function up()
{
if ($this->_columnExists('oxuser', 'OXDEMO')) {
return;
}
$sSql = "ALTER TABLE `oxuser`
ADD `OXDEMO`
CHAR( 32 )
CHARACTER SET utf8
COLLATE utf8_general_ci
NULL
DEFAULT NULL
COMMENT 'Demo field for migration'";
oxDb::getDb()->execute($sSql);
}
/**
* {@inheritdoc}
*/
public function down()
{
if (!$this->_columnExists('oxuser', 'OXDEMO')) {
return;
}
oxDb::getDb()->execute('ALTER TABLE `oxuser` DROP `OXDEMO`');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.