In an install script, you can follow the below example:
<?php
/**
* Pan_JewelryDesigner Extension| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| /** | |
| * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
| * @author Phuong LE <sony@menincode.com> <@> | |
| * @copyright Copyright (c) 2018 Menincode (http://www.menincode.com) | |
| */ | |
| /** MyNamespace/MyModule/view/frontend/web/js/call-custom-js-everywhere.js */ | |
| /** check the requirejs-config.js file */ |
| <?php | |
| /** | |
| * @param $attributeCode | |
| * @param $newOptionValues | |
| * @internal param $attributeData | |
| */ | |
| public function addSwatchValuesToSwatchAttribute($attributeCode, $newOptionValues) | |
| { | |
| $this->eavConfig->clear(); |
| sudo apt-get update | |
| sudo apt-get install nodejs | |
| sudo apt-get install npm | |
| ## Use n module from npm in order to upgrade node | |
| sudo npm cache clean -f | |
| sudo npm install -g n | |
| sudo n stable |
| <?php | |
| /** | |
| * This file is part of Namespace for Magento. | |
| * | |
| * @license All rights reserved | |
| * @author Phuong LE <phuong.le@agence-soon.fr> <@> | |
| * @category Namespace | |
| * @package Namespace_Core | |
| * @copyright Copyright (c) 2016 Agence Soon (http://www.agence-soon.fr) | |
| */ |
| <?php | |
| /** @var $coll \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection */ | |
| $coll = $this->_objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class); | |
| // add filter by entity type to get product attributes only | |
| // '4' is the default type ID for 'catalog_product' entity - see 'eav_entity_type' table) | |
| // or skip the next line to get all attributes for all types of entities | |
| $coll->addFieldToFilter(\Magento\Eav\Model\Entity\Attribute\Set::KEY_ENTITY_TYPE_ID, 4); | |
| $attrAll = $coll->load()->getItems(); |
| # To be pasted in ~/.profile | |
| vagrant() { | |
| if [[ $@ == "halt all" ]]; then | |
| command vagrant global-status | grep running | colrm 8 | xargs -L 1 -t vagrant halt | |
| else | |
| command vagrant "$@" | |
| fi | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| <?php | |
| declare(strict_types = 1); | |
| namespace Training5\VendorRepository\Controller\Test; | |
| use Magento\Catalog\Api\Data\ProductInterface; | |
| use Magento\Catalog\Api\ProductRepositoryInterface; | |
| use Magento\Framework\Api\Filter; | |
| use Magento\Framework\Api\FilterBuilder; |