Magento 2.3 Declarative Schema

In an effort to simplify the Magento installation and upgrade process, 2.3 introduces declarative schema.

With the new declarative schema approach allows,  developers are no longer forced to write scripts for each new version of a module. Using declarative schema, developers declare the final desired state of the database, and the system adjusts to it automatically, without performing redundant operations. In addition, this approach allows data to be easily deleted when a module is uninstalled.

There are two parts to using declarative schema: the db_schema.xml file and the bin/magento command to register it.

Once you use declarative schema in a module, you cannot use setup/upgrade scripts again. In the future, upgrade scripts will be phased out in favor of declarative schema.

The following example, extracted from the Catalog/etc/db_schema.xml file, defines the catalog_product_entity_datetime table:

<table name="catalog_product_entity_datetime" resource="default" engine="innodb"
           comment="Catalog Product Datetime Attribute Backend Table">
        <column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" comment="Value ID"/>
        <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false"default="0" comment="Attribute ID"/>
        <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/>
        <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"/>
        <column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/>
        <constraint xsi:type="primary" name="PRIMARY">
            <column name="value_id"/>
        </constraint>
</table>

https://magento-devdocs.github.io/devdocs-for-tests/guides/v2.3/extension-dev-guide/declarative-schema/db-schema.html

Magento 2 Knockout JS in a Nutshell

We have defined a module with a simple module.xml and a registration.php file,

to call upon the regular flow of M2 merged XML layouts, to define a Block class that feeds data into a PHTML template,

which is then outputting a JSON configuration array that was inserted into the Block class using an XML argument-array,

and which is then used to initialize a custom AMD-style JS component through the Magento_Ui/js/core/app component,

which connects our require JS component to our KnockoutJS component.

Then, our JS component injects the customer-data component to collect a bit of information about the customer, which is fetched through a kind of local-storage-cached-AJAX-call to the backend,

which is configured through a DI type that injects an array of section sources into a backend class,

that fetches data from various sources, including our own, to then send back a bundled response, if possible, to the JS component, with the major feature being JavaScript AJAX lazy loading.

Namespace

/Module

/Block

Block.php

/etc

module.xml

/view

/frontend

/layouts

somelayout_file.xml

/templates

template.phtml

registration.php

Add Quantity to Product Widget Grid in Category Edit in Magento 2

Event/Observer

Event: backend_block_widget_grid_prepare_grid_before

Create Module

Namespace\Module\registration.php
Namespace\Module\composer.json
Namespace\Module\etc\module.xml
Namespace\Module\etc\adminhtml\events.xml
Namespace\Module\Model\Observer\BackendBlockWidgetGridPrepareGrid.php

events.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="backend_block_widget_grid_prepare_grid_before">
        <observer name="category_product_picker_grid"
                  instance="Namespace\Module\Model\Observer\BackendBlockWidgetGridPrepareGrid"
        />
    </event>
</config>

BackendBlockWidgetGridPrepareGrid.php

namespace Namespace\Module\Model\Observer;

use Magento\Framework\Event\ObserverInterface;

class BackendBlockWidgetGridPrepareGrid implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $grid = $observer->getEvent()->getGrid();
        $grid->addColumn(
            'qty',
            [
                'header' => __('Quantity'),
                'type' => 'number',
                'index' => 'stock'
            ]
        );
        return $this;
    }
}

Magento 1 Front controller reached 100 router match iterations

a:5:{i:0;s:52:"Front controller reached 100 router match iterations";i:1;s:499:"#0 /www/sites/*/app/code/core/Mage/Core/Controller/Varien/Front.php(183): Mage::throwException('Front controlle...')

#1 /www/sites/*/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()

#2 /www/sites/*/app/Mage.php(683): Mage_Core_Model_App->run(Array)

#3 /www/sites/*/index.php(90): Mage::run('gloso_public', 'website')

#4 {main}";s:3:"url";s:17:"/admin";s:11:"script_name";s:16:"/index.php";s:4:"skin";s:17:"default";}

https://github.com/convenient/magento-ce-ee-config-corruption-bug#the-fix

Spanish Vocabulary 1

la manzana – apple

el mono – monkey

vegetariano/vegetariana – vegetarian

el cangrejo – crab

el cerdo – pig

el conejo – rabbit

el pengüino – penguin

tú – you (informal)

desayuno – breakfast

sí – yes

el pájaro – bird

la sopa – soup

beber – to drink

leer – to read

querer – to want, love, wish, will, like, cherish

comer – to eat

perdón – excuse me, sorry

la comida – food

tu – your (informal)

usted – you (formal)

nosotros – we

nuestras – our

la leche – milk

hablar – to speak

ser – to be (soy, eres, es, somos, sois, son)

el arroz – rice

los vegetales – vegetables

el león – lion

la pasta – pasta

la tortuga – turtle

el tomate – tomato

el vino – wine

la cerveza – beer

su – his/her

el hombre – man

el huevo – egg

más – more

el limón – lemon

el sal – salt

el jugo – juice

beber – to drink

el ratón – mouse

almuerzo – lunch

azúcar – sugar

el gato – cat

la persona – person

escribir – to write

la fruta – fruit

la salsa – sauce

la naranja – orange

el pato – duck

la mujer – woman

el agua – water

cocinar – to cook

el caballo – horse

ell pollo – chicken

el queso – cheese

la cebolla – onion

el carne – meat

necesitar – to need

cena – dinner

el pan – bread

suyo – your

 

 

Spanish Idioms

Del tal palo tal astilla.

Like father like son.

Consejos vendo y para mí no tengo.

Do as I say, not as I do.

En tierra de ciegos, el tuerto es rey.

In the land of the blind, the one-eyed is king.

Soldado avisado no muere en guerra.

Forewarned is forearmed.

Borrón y cuenta nueva.

Let bygones be bygones.

En boca cerrada no entran moscas.

A closed mouth gathers no flies.

Donde hay humo, hay fuego.

Where there’s smoke there’s fire.

Más vale tarde que nunca.

Better late than never.

Mucho ruido y pocas nueces.

All talk and no action.

Cada loco con su tema.

To each their own.

Camarón que se duerme, se lo lleva la coriente.

You snooze, you lose.

El amor es ciego, pero los vecinos no.

Love is blind, but the neighbors aren’t.

Barriga llena, corazón contento.

A fully belly, happy heart.