I hope you take something away...

If you do please leave something for me :)

MySQL screwed up after brew upgrade

PROBLEM
I ran 

brew upgrade

It updated my mysql installation to  8.0.12. Previously I was working with 5.7.22. Now each time I start mysql using the following commands

mysql.server start

OR

brew services mysql restsrt 

MySQL does not start properly

 Most probably the error you will face is 

.. ERROR! The server quit without updating PID file

SOLUTION 

When I run 

Add a NOT IN condition and a nested query to your views WHERE condition

PROBLEM: 

I needed to add a NOT IN condition with a nested query for the WHERE condition. The usual method wont work

 

$view->query->where[1]['conditions'][] = array(
            ['field'] => 'groups_group_membership.type'
            ['value'] => array
                (
                    [0] => 'SELECT_QUERY_HERE'
                  
                )

            ['operator'] => IN
        );

SOLUTION :

The way that works

 

A future waiting to know...

Submitted by nmeegama on Sat, 02/17/2018 - 16:28

A lifetime a lifetime of mistakes and courage

the People the people that surround you each day

It hurts it hurst when you know you will leave them

its best, its best if you go first and not see them go

Selfish is it selfish to feel this way or is it fear to just let go

 

to think, to think if you did do the right thing

If not, if not just turn back and say sorry

You wish, you wish you could go back in time

Just fix, just fix what you left there to die

But no, you just cannot go back and lie

 

Drupal 8 - get blocks assigned to a region

Problem: There is no specific function in Drupal 8 which we can use to get all blocks assigned to a region. We used to have a function called block_get_blocks_by_region in Drupal 7 to do this

 

Solution : Although we don't have a specific function we have the tools in Drupal 8 s Object oriented hierarchy to do the same. Here is the code

 

function my_module_get_blocks_by_region($region) {

  $blocks = \Drupal::entityTypeManager()

    ->getStorage('block')->loadByProperties([