This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Database connection in loop memory leak

I have a function with a loop that in the loop calls a subfunction to update a database.  The subfunction use a query that connects with \Drupal::database() and everything sems to work fine.  But, when the loop ran into thousands of instances, it crashed and it turns out there is a memory leak for every \Drupal::database() you call since the memory is not released at the end of the function.

Invalid parameter number: no parameters were bound

This is my context: In Drupal 8.7.5 I've set up an additional database in settings.php that is my old Drupal 7 db so that I can make some targeted migrations from it.

This works in mysql:

select * from file_managed as f  
left join field_data_field_person_photo as p on p.field_person_photo_fid = f.fid
where p.entity_id = 500;

Which returns the values I expect. Now, inside Drupal 8 I attempted this:

Get ID of unpublished node for non-logged-in users

I've tried the following:

  • arg(1) returns 'denied'
  • $node is empty
  • $path_args = explode('/', current_path()); $path_args[1] is 'denied' as well

Thanks in advance!

EDIT: I was able to figure it out

$path = explode('/',$GLOBALS['_GET']['destination']);
print $path[1];

Fields in custom form

Hi,

the following is my code, I have just pasted the part where I am having trouble:

<?php
namespace Drupal\heritage_bulk_upload\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Archiver\Zip;

server side validation

Hello there how is all

i am using web form to get user data but i can't create primary key one of the field. please help me

How to access libraries installed via 'composer require library/name'

Hello Friends,

I am trying to use the Google Api PHP client library in my drupal 8 custom module.

I have installed the library using 

composer require google/apiclient:^2.0

In vinilla PHP , I am able to access the installed library using

require_once __DIR__ . '/vendor/autoload.php';
 

After that, I am able to create a new google client using the installed library with the following code:

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions