Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created March 3, 2014 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EclipseGc/9331657 to your computer and use it in GitHub Desktop.
Save EclipseGc/9331657 to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* Contains \Drupal\Core\Database\Query\PlaceholderTrait.
*/
namespace Drupal\Core\Database\Query;
/**
* @see \Drupal\Core\Database\Query\PlaceholderInterface
*/
trait PlaceholderTrait {
/**
* A unique identifier for this query object.
*/
protected $uniqueIdentifier;
/**
* The placeholder counter.
*/
protected $placeholder = 0;
/**
* Implements \Drupal\Core\Database\Query\PlaceholderInterface::uniqueIdentifier().
*/
public function uniqueIdentifier() {
if (!isset($this->uniqueIdentifier)) {
$this->uniqueIdentifier = uniqid('', TRUE);
}
return $this->uniqueIdentifier;
}
/**
* {@inheritdoc}
*/
public function nextPlaceholder() {
return $this->placeholder++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment