Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @param array $data
* @throws ProductImportException
*/
public function createProduct(array $data)
{
$originalProduct = $this->productRepository->findOneByCode($data['code']);
@nicanaca0
nicanaca0 / CleanUpCommand.php
Created July 5, 2017 16:08
Simple command to remove ALL products (1.0.0-beta.2)
<?php
namespace AppBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class CleanUpCommand extends ContainerAwareCommand
{
@nicanaca0
nicanaca0 / ImportProductsCommand.php
Last active May 1, 2024 11:05
Simple CSV Product importer for Sylius. Includes the product, the variant, channel pricing, taxons images and associations (1.0.0-beta.2)
<?php
namespace AppBundle\Command;
use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Product\Model\ProductAssociationInterface;
use Sylius\Component\Product\Model\ProductAssociationTypeInterface;
use Sylius\Component\Taxonomy\Model\TaxonInterface;
@nicanaca0
nicanaca0 / playground.rs
Created May 2, 2017 15:52 — forked from anonymous/playground.rs
Shared via Rust Playground
fn to_celcius(value: f64) -> f64 {
(value - 32.0) * (5.0 / 9.0)
}
fn to_fahrenheit(value: f64) -> f64 {
(value * (9.0 / 5.0)) + 32.0
}
fn main() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Isotope Test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>