All posts by Pramod T P

YAML

YAML stands for “Yet Another Markup Language”. It’s a strict superset of JSON, which means that YAML can do everything JSON can and more.

  • Configuration files: YAML is a popular choice for creating configuration files because it’s human-readable and works with any programming language. YAML files are often used in Kubernetes to configure pods, services, and deployments.
  • Data serialization: YAML is a data serialization language that can be used to convert data to and from other formats, such as JSON. YAML is a good choice when human readability is important.
  • Documentation: YAML’s human-readable format makes it a good choice for documentation.
  • Log files: YAML can be used to create clean, intuitive log files.
  • API and web services: YAML can be used to write API definitions for popular API specifications, such as OpenAPI and AsyncAPI.
  • Metadata: YAML can be used to store and organize metadata and content structure.
  • Machine learning: YAML can be used to define and orchestrate the steps involved in the machine learning lifecycle, such as data ingestion, model training, and evaluation.

Install Elasticsearch

Import the Elasticsearch GPG key:
# wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg –dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

Add the Elasticsearch repository:
# echo “deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main” | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

Update the apt package manager and install Elasticsearch:
# apt update && apt install elasticsearch

Start and enable the Elasticsearch service:
# systemctl start elasticsearch
# systemctl enable elasticsearch

Open the elasticsearch.yml file for editing:

sudo nano /etc/elasticsearch/elasticsearch.yml

Replace the following setting with ‘false’ to disable Magento security features:
# Enable security features
xpack.security.enabled: false
Save the changes to the elasticsearch.yml file.

Restart the Elasticsearch service to apply the configuration:

# systemctl restart elasticsearch.service

Verify that Elasticsearch runs correctly using the curl command:

# curl -X GET “localhost:9200/”
If Elasticsearch is working correctly, you’ll receive an output like this:
{
“name” : “ubuntu”,
“cluster_name” : “elasticsearch”,
“cluster_uuid” : “KPbFKCVLT9uu-RFxzxH_Bw”,
“version” : {
“number” : “8.6.2”,
“build_flavor” : “default”,
“build_type” : “deb”,
“build_hash” : “2d58d0f136141f03239816a4e360a8d17b6d8f29”,
“build_date” : “2023-02-13T09:35:20.314882762Z”,
“build_snapshot” : false,
“lucene_version” : “9.4.2”,
“minimum_wire_compatibility_version” : “7.17.0”,
“minimum_index_compatibility_version” : “7.0.0”
},
“tagline” : “You Know, for Search”
}

Data fixture

A data fixture is a PHP script that sets data you want to reuse in your test. The script can be defined in a separate file or as a local test case method.

Use data fixtures to prepare a database for tests. The Integration Testing Framework (ITF) reverts the database to its initial state automatically. To set up a date fixture, use the @magentoDataFixture annotation.

Constructor Property Promotion

Constructor Property Promotion is a simple shorthand syntax to declare and assign class properties from the constructor. It basically tells the way data has to be treated in code. Constructor Property Promotion is a new syntax provided in the newer version of PHP 8 that allows class property declaration and constructor assignment, variable assignment right from the constructor without getting in the condition of boilerplate code. This avoids having to type the class property name and property type from many to just once. It also avoids using repeated types. Promoted properties can only be used in constructors. Properties will be assigned before the rest of the constructor code is executed.

Named Arguments

Named arguments is a new feature introduced in PHP 8.0, which allows you to pass arguments to a function or method by specifying the parameter name along with the value. This feature provides developers with more flexibility and improves code readability.

Traditionally, in PHP, function parameters are passed by position, which means the order in which arguments are passed to a function must match the order of the parameters in the function signature. In contrast, named arguments allow you to specify which parameter you are passing the argument to, without being constrained by the order.

Customer Attributes

Customer attributes provide the information that is required to support the order, fulfillment, and customer management processes. Because your business is unique, you might need fields in addition to those provided by the system. You can add custom attributes to the Account Information, Address Book, and Billing Information sections of the customer’s account. Customer address attributes can also be used in the Billing Information section during checkout, or when guests register for an account.

https://docs.magento.com/user-guide/v2.3/stores/attributes-customer.html

 

Payment Method Facade

Payment facade it is an instance of Payment Adapter configured with virtual types and allows to process payment actions between Magento Sales Management and payment processor.

Add the dependency injection (DI) configuration for payment method facade in your %Vendor_Module%/etc/di.xml.

https://devdocs.magento.com/guides/v2.3/payments-integrations/base-integration/facade-configuration.html

Content Staging

Content staging gives your business team the ability to easily create, preview, and schedule a wide range of content updates for your store directly from the Admin. For example, rather than thinking in terms of a static page, consider a page to be a collection of different elements that can be turned on or off based on a schedule. You can use content staging to create a page that changes automatically throughout the year on schedule.

Content staging is a feature that allows creating, previewing, and scheduling content updates for your store
directly from the Admin . You can use content staging to create campaigns that include changes to products,
categories, pages, blocks, widgets, price rules, and more.