Adds the demo data to the database.

@throws MShop_Exception If the file isn't found
163927
protected function _addDemoData()
	{
		$ds = DIRECTORY_SEPARATOR;
		$path = __DIR__ . $ds . 'data' . $ds . 'demo-product.php';

		if( ( $data = include( $path ) ) == false ) {
			throw new MShop_Exception( sprintf( 'No file "%1$s" found for product domain', $path ) );
		}

		$context =  $this->_getContext();
		$manager = MShop_Factory::createManager( $context, 'product' );

		foreach( $data as $entry )
		{
			$item = $manager->createItem();
			$item->setTypeId( $this->_getTypeId( 'product/type', 'product', $entry['type'] ) );
			$item->setCode( $entry['code'] );
			$item->setLabel( $entry['label'] );
			$item->setSupplierCode( $entry['supplier'] );
			$item->setDateStart( $entry['start'] );
			$item->setDateEnd( $entry['end'] );
			$item->setStatus( $entry['status'] );

			$manager->saveItem( $item );

			$this->_addRefItems( $entry, $item->getId() );
		}
	}
555069
def add_dep(self, ):
        
        i = self.dep_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            dep = item.internal_data()
            dep.projects.add(self._project)
            self.deps.append(dep)
            item.set_parent(None)
619000
protected function addFileReports()
    {
        $sCode = $this->html->sequence();

        $output = false;
        $filenames = $this->_getFilenames();
        foreach ($filenames as  $filename) {
            $output = $this->addFileReport($filename) || $output;
        }
        if ($this->appNamespaceError) {
            $sCode->h3('Code change issues found');
            $sCode->pInfo('The application code has code change issues. You can try to fix them by running this phing script:');
            $sCode->pre(
                    'cd ' . APPLICATION_PATH . "\n" .
                    'phing -f ' . GEMS_LIBRARY_DIR . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'namespacer.xml'
                    );
            $p = $sCode->pInfo('To use this script you have to install ');
            $p->a('https://www.phing.info/', 'Phing');
            $p->append('. Then run the script and check again for issues not fixed by the script.');

        } elseif (! $output) {
            $this->html->h3('Code change report');
            $this->html->pInfo('No compatibility issues found in the code for this project.');
        }
    }
879888
public function saveItem( MShop_Common_Item_Interface $item, $fetch = true )
	{
		$iface = 'MShop_Common_Item_Address_Interface';
		if( !( $item instanceof $iface ) ) {
			throw new MShop_Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
		}

		$dbm = $this->_context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$id = $item->getId();

			if ( $id === null ) {
				$sql = $this->_config['insert'];
				$type = 'insert';
			} else {
				$sql = $this->_config['update'];
				$type = 'update';
			}

			$stmt = $this->_getCachedStatement($conn, $this->_prefix . $type, $sql);

			$stmt->bind( 1, $this->_context->getLocale()->getSiteId(), MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->bind( 2, $item->getRefId(), MW_DB_Statement_Abstract::PARAM_STR ); //reference id
			$stmt->bind( 3, $item->getCompany(), MW_DB_Statement_Abstract::PARAM_STR ); //company
			$stmt->bind( 4, $item->getVatID(), MW_DB_Statement_Abstract::PARAM_STR ); //vatid
			$stmt->bind( 5, $item->getSalutation(), MW_DB_Statement_Abstract::PARAM_STR ); //salutation
			$stmt->bind( 6, $item->getTitle(), MW_DB_Statement_Abstract::PARAM_STR ); //title
			$stmt->bind( 7, $item->getFirstname(), MW_DB_Statement_Abstract::PARAM_STR ); //firstname
			$stmt->bind( 8, $item->getLastname(), MW_DB_Statement_Abstract::PARAM_STR ); //lastname
			$stmt->bind( 9, $item->getAddress1(), MW_DB_Statement_Abstract::PARAM_STR ); //address1
			$stmt->bind( 10, $item->getAddress2(), MW_DB_Statement_Abstract::PARAM_STR ); //address2
			$stmt->bind( 11, $item->getAddress3(), MW_DB_Statement_Abstract::PARAM_STR ); //address3
			$stmt->bind( 12, $item->getPostal(), MW_DB_Statement_Abstract::PARAM_STR ); //postal
			$stmt->bind( 13, $item->getCity(), MW_DB_Statement_Abstract::PARAM_STR ); //city
			$stmt->bind( 14, $item->getState(), MW_DB_Statement_Abstract::PARAM_STR ); //state
			$stmt->bind( 15, $item->getCountryId(), MW_DB_Statement_Abstract::PARAM_STR ); //countryid
			$stmt->bind( 16, $item->getLanguageId(), MW_DB_Statement_Abstract::PARAM_STR ); //langid
			$stmt->bind( 17, $item->getTelephone(), MW_DB_Statement_Abstract::PARAM_STR ); //telephone
			$stmt->bind( 18, $item->getEmail(), MW_DB_Statement_Abstract::PARAM_STR ); //email
			$stmt->bind( 19, $item->getTelefax(), MW_DB_Statement_Abstract::PARAM_STR ); //telefax
			$stmt->bind( 20, $item->getWebsite(), MW_DB_Statement_Abstract::PARAM_STR ); //website
			$stmt->bind( 21, $item->getFlag(), MW_DB_Statement_Abstract::PARAM_INT ); //generic flag
			$stmt->bind( 22, $item->getPosition(), MW_DB_Statement_Abstract::PARAM_INT ); //position
			$stmt->bind( 23, date('Y-m-d H:i:s', time()));//mtime
			$stmt->bind( 24, $this->_context->getEditor());// editor

			if ( $id !== null ) {
				$stmt->bind( 25, $id, MW_DB_Statement_Abstract::PARAM_INT );
				$item->setId( $id ); //is not modified anymore
			} else {
				$stmt->bind( 25, date('Y-m-d H:i:s', time()));// ctime
			}

			$stmt->execute()->finish();

			if ( $id === null && $fetch === true) {
				$item->setId( $this->_newId( $conn, $this->_config['newid'] ) );
			}

			$dbm->release( $conn, $dbname );
		}
		catch ( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
770786
public function insertDemoData()
    {
        $testConfig = new TestConfig();
        $testDirectory = $testConfig->getEditionTestsPath($testConfig->getShopEdition());
        $this->getDbHandler()->import($testDirectory . "/Fixtures/testdemodata.sql");
    }
382021
public function add()
    {
        $record = $this->addNewModel();
        $form = $this->addGetForm($record);

        if ($form->execute()) {
            $this->addRedirect($record);
        }

        $this->getView()->set('item', $record);
        $this->getView()->set('form', $form);
        $this->getView()->set('title', $this->getModelManager()->getLabel('add'));

        $this->getView()->Breadcrumbs()
            ->addItem($this->getModelManager()->getLabel('add'));

        $this->getView()->TinyMCE()->setEnabled();
        $this->getView()->append('section', '.add');
    }
1192423
private function createTable(): void
    {
        $statement = 'CREATE TABLE tests (
                          id INTEGER PRIMARY KEY,
                          command TEXT NOT NULL UNIQUE,
                          file_name TEXT NOT NULL,
                          reserved_by_process_id INTEGER,
                          completed INTEGER DEFAULT 0
                        )';

        if ($this->db->exec($statement) === false) {
            throw new Exception('Error while creating sqlite database table: ' . $this->db->errorCode());
        }
    }
209868
def add_data(self, *args):
        """"""
        for data in args:
            self._data.append(to_binary(data))
343699
private function addCommonMetaData()
    {
        $this->bugsnag->registerCallback(function ($report) {
            $report->addMetaData([
                'META DATA' => [
                    'store_url' => $this->storeManager->getStore()->getBaseUrl(
                        \Magento\Framework\UrlInterface::URL_TYPE_WEB
                    )
                ]
            ]);
        });
    }
1100040
protected function _process()
	{
		$iface = 'MShop_Context_Item_Interface';
		if( !( $this->_additional instanceof $iface ) ) {
			throw new MW_Setup_Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
		}

		$this->_msg( 'Adding performance data for MShop locale domain', 0 );
		$this->_status( '' );


		// Set editor for further tasks
		$this->_additional->setEditor( 'unitperf:core' );


		$ds = DIRECTORY_SEPARATOR;
		$filename = dirname( __FILE__ ) . $ds . 'data' . $ds . 'locale.php';

		if( ( $testdata = include( $filename ) ) == false ) {
			throw new MW_Setup_Exception( sprintf( 'No data file "%1$s" found', $filename ) );
		}


		$localeManager = MShop_Locale_Manager_Factory::createManager( $this->_additional );
		$localeSiteManager = $localeManager->getSubManager( 'site' );
		$siteIds = array();


		$search = $localeSiteManager->createSearch();
		$search->setConditions( $search->compare( '==', 'locale.site.code', 'unitperf' ) );

		foreach( $localeSiteManager->searchItems( $search ) as $site )
		{
			$this->_additional->setLocale( $localeManager->bootstrap( $site->getCode(), '', '', false ) );
			$localeSiteManager->deleteItem( $site->getId() );
		}


		if( isset( $testdata['locale/site'] ) ) {
			$siteIds = $this->_addLocaleSiteData( $localeManager, $testdata['locale/site'] );
		}

		if( isset( $testdata['locale'] ) ) {
			$this->_addLocaleData( $localeManager, $testdata['locale'], $siteIds );
		}
	}
246055
public function add() {
		$this->out('CakePHP Queue Example task.');
		$this->hr();
		$this->out('This is a very simple example of a QueueTask.');
		$this->out('I will now add an example Job into the Queue.');
		$this->out('This job will only produce some console output on the worker that it runs on.');
		$this->out(' ');
		$this->out('To run a Worker use:');
		$this->out('	bin/cake queue runworker');
		$this->out(' ');
		$this->out('You can find the sourcecode of this task in: ');
		$this->out(__FILE__);
		$this->out(' ');
		/*
		 * Adding a task of type 'example' with no additionally passed data
		 */
		$this->QueuedJobs->createJob('Example');
		$this->success('OK, job created, now run the worker');
	}
1107595
protected function _process()
	{
		$iface = 'MShop_Context_Item_Interface';
		if( !( $this->_additional instanceof $iface ) ) {
			throw new MW_Setup_Exception( sprintf( 'Additionally provided object is not of type "%1$s"', $iface ) );
		}

		$this->_msg( 'Adding default plugin data', 0 );
		$this->_status( '' );


		$ds = DIRECTORY_SEPARATOR;
		$pluginManager = MShop_Plugin_Manager_Factory::createManager( $this->_additional, 'Default' );


		$filename = dirname( __FILE__ ) . $ds . 'default'.  $ds . 'data'. $ds . 'plugin.php';

		if( ( $data = include( $filename ) ) == false ) {
			throw new MW_Setup_Exception( sprintf( 'No data file "%1$s" found', $filename ) );
		}

		if( isset( $data['plugin'] ) ) {
			$this->_addPluginData( $pluginManager, $data['plugin'] );
		}
	}
159289
public function addAttrArticle()
    {
        $aAddArticle = $this->_getActionIds('oxarticles.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sArticleTable = $this->_getViewName('oxarticles');
            $aAddArticle = $this->_getAll($this->_addFilter("select $sArticleTable.oxid " . $this->_getQuery()));
        }

        $oAttribute = oxNew(\OxidEsales\Eshop\Application\Model\Attribute::class);

        if ($oAttribute->load($soxId) && is_array($aAddArticle)) {
            foreach ($aAddArticle as $sAdd) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oNewGroup->init("oxobject2attribute");
                $oNewGroup->oxobject2attribute__oxobjectid = new \OxidEsales\Eshop\Core\Field($sAdd);
                $oNewGroup->oxobject2attribute__oxattrid = new \OxidEsales\Eshop\Core\Field($oAttribute->oxattribute__oxid->value);
                $oNewGroup->save();

                $this->onArticleAddToAttributeList($sAdd);
            }
        }
    }
969018
protected function addDoInsertBodyRaw()
    {
        $this->declareClasses('Propel', 'PDO');
        $table = $this->getTable();
        $peerClassname = $this->getPeerClassname();
        $platform = $this->getPlatform();
        $primaryKeyMethodInfo = '';
        if ($table->getIdMethodParameters()) {
            $params = $table->getIdMethodParameters();
            $imp = $params[0];
            $primaryKeyMethodInfo = $imp->getValue();
        } elseif ($table->getIdMethod() == IDMethod::NATIVE && ($platform->getNativeIdMethod() == PropelPlatformInterface::SEQUENCE || $platform->getNativeIdMethod() == PropelPlatformInterface::SERIAL)) {
            $primaryKeyMethodInfo = $platform->getSequenceName($table);
        }
        $query = 'INSERT INTO ' . $platform->quoteIdentifier($table->getName()) . ' (%s) VALUES (%s)';
        $script = "
        \$modifiedColumns = array();
        \$index = 0;
";

        foreach ($table->getPrimaryKey() as $column) {
            if (!$column->isAutoIncrement()) {
                continue;
            }
            $constantName = $this->getColumnConstant($column);
            if ($platform->supportsInsertNullPk()) {
                $script .= "
        \$this->modifiedColumns[] = $constantName;";
            }
            $columnProperty = strtolower($column->getName());
            if (!$table->isAllowPkInsert()) {
                $script .= "
        if (null !== \$this->{$columnProperty}) {
            throw new PropelException('Cannot insert a value for auto-increment primary key (' . $constantName . ')');
        }";
            } elseif (!$platform->supportsInsertNullPk()) {
                $script .= "
        // add primary key column only if it is not null since this database does not accept that
        if (null !== \$this->{$columnProperty}) {
            \$this->modifiedColumns[] = $constantName;
        }";
            }
        }

        // if non auto-increment but using sequence, get the id first
        if (!$platform->isNativeIdMethodAutoIncrement() && $table->getIdMethod() == "native") {
            $column = $table->getFirstPrimaryKeyColumn();
            $columnProperty = strtolower($column->getName());
            $script .= "
        if (null === \$this->{$columnProperty}) {
            try {";
            $script .= $platform->getIdentifierPhp('$this->' . $columnProperty, '$con', $primaryKeyMethodInfo, '				');
            $script .= "
            } catch (Exception \$e) {
                throw new PropelException('Unable to get sequence id.', \$e);
            }
        }
";
        }

        $script .= "

         // check the columns in natural order for more readable SQL queries";
        foreach ($table->getColumns() as $column) {
            $constantName = $this->getColumnConstant($column);
            $identifier = var_export($platform->quoteIdentifier($column->getName()), true);
            $script .= "
        if (\$this->isColumnModified($constantName)) {
            \$modifiedColumns[':p' . \$index++]  = $identifier;
        }";
        }

        $script .= "

        \$sql = sprintf(
            '$query',
            implode(', ', \$modifiedColumns),
            implode(', ', array_keys(\$modifiedColumns))
        );

        try {
            \$stmt = \$con->prepare(\$sql);
            foreach (\$modifiedColumns as \$identifier => \$columnName) {
                switch (\$columnName) {";
        foreach ($table->getColumns() as $column) {
            $columnNameCase = var_export($platform->quoteIdentifier($column->getName()), true);
            $script .= "
                    case $columnNameCase:";
            $script .= $platform->getColumnBindingPHP($column, "\$identifier", '$this->' . strtolower($column->getName()), '						');
            $script .= "
                        break;";
        }
        $script .= "
                }
            }
            \$stmt->execute();
        } catch (Exception \$e) {
            Propel::log(\$e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', \$sql), \$e);
        }
";

        // if auto-increment, get the id after
        if ($platform->isNativeIdMethodAutoIncrement() && $table->getIdMethod() == "native") {
            $column = $table->getFirstPrimaryKeyColumn();
            $columnProperty = strtolower($column->getName());
            $script .= "
        try {";
            $script .= $platform->getIdentifierPhp('$pk', '$con', $primaryKeyMethodInfo);
            $script .= "
        } catch (Exception \$e) {
            throw new PropelException('Unable to get autoincrement id.', \$e);
        }";
            if ($table->isAllowPkInsert()) {
                $script .= "
        if (\$pk !== null) {
            \$this->set" . $column->getPhpName() . "(\$pk);
        }";
            } else {
                $script .= "
        \$this->set" . $column->getPhpName() . "(\$pk);";
            }
            $script .= "
";
        }

        return $script;
    }
963847
public function insert(Model $m, $data)
    {
        if (!$this->mode) {
            $this->mode = 'w';
        } elseif ($this->mode == 'r') {
            throw new Exception(['Currently reading records, so writing is not possible.']);
        }

        if (!$this->handle) {
            $this->saveHeader($m);
        }

        $line = [];

        foreach ($this->header as $name) {
            $line[] = $data[$name];
        }

        $this->putLine($line);
    }
1132492
public function add()
    {
        $dashboard = $this->Dashboards->newEntity();

        /**
         * @var \Search\Model\Table\WidgetsTable $widgetsTable
         */
        $widgetsTable = TableRegistry::get('Search.Widgets');
        $widgets = $widgetsTable->getWidgets();

        if ($this->request->is('post')) {
            $data = (array)$this->request->getData();

            $widgets = [];

            $dashboard = $this->Dashboards->patchEntity($dashboard, [
                'name' => $data['name'],
                'role_id' => $data['role_id'],
            ]);

            $resultedDashboard = $this->Dashboards->save($dashboard);

            if ($resultedDashboard) {
                $this->Flash->success((string)__('The dashboard has been saved.'));

                $dashboardId = $resultedDashboard->id;

                $data['widgets'] = !empty($data['options']) ? json_decode($data['options'], true) : [];

                if (!empty($data['widgets'])) {
                    $widgetsTable->saveDashboardWidgets($dashboardId, $data['widgets']);
                }

                return $this->redirect(['action' => 'view', $dashboard->id]);
            } else {
                $this->Flash->error((string)__('The dashboard could not be saved. Please, try again.'));
            }
        }

        $roles = $this->Dashboards->Roles->find('list', ['limit' => 200]);
        $savedWidgetData = [];

        $this->set(compact('dashboard', 'roles', 'widgets', 'savedWidgetData'));
        $this->set('columns', Configure::readOrFail('Search.dashboard.columns'));
        $this->set('_serialize', ['dashboard']);
    }
359414
protected function addAddCart()
    {
        if (!$this->isError()) {
            $id = $this->cart->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }