Skip to main content

Articles tagged with "quick tips"

Quick tips: Adding an empty master branch

21st Feb 2012

When I create a git repository for a new project on Drupal.org I don't bother to create a master branch, branches named 6.x-1.x or 7.x-1.x have special meanings and are the ones that we're encouraged to use. However, drupal.org doesn't allow us to [change the default branch][branch-issue] on d.o itself, so even though there may be no branch called 'master', it's still the default branch, so sometimes cloning a repo will fail:


git clone http://git.drupal.org/sandbox/darthsteven/1268648.git
Cloning into 1268648...
remote: Counting objects: 177, done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 177 (delta 103), reused 0 (delta 0)
Receiving objects...

Read more

Quick tips: Inspecting a Solr Document

22nd Feb 2011

Another quick tip here: if you're working with the Apache Solr module, specifically looking at the documents that are being created from your nodes, and you want to print out the document and have a look at what fields and values are on your $document then if you did this:


// Print the $document using the devel dpm function.
dpm($document);

Then you would get a very unhelpful output from Krumo, because all the fields on the $document are protected, and so the devel module can't access them. Instead you can do this:


dpm(array_combine($document->getFieldNames(), $document->getFieldValues()));

And you'll get a nice array...

Read more