Skip to content

Instantly share code, notes, and snippets.

@mikeyp
Created October 15, 2013 15:48
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 mikeyp/6993726 to your computer and use it in GitHub Desktop.
Save mikeyp/6993726 to your computer and use it in GitHub Desktop.
<?php
protected function get_entity_type() {
$class = get_class($this);
$types = entity_get_info();
foreach ($types as $entity_type => $info) {
if (isset($info['entity class']) && $class == $info['entity class']) {
return $entity_type;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment