public function findUserMetasBy($criteria)
 {
     if ($criteria instanceof User) {
         $criteria = ['user' => $criteria];
     }
     return $this->manager->getRepository('KayueWordpressBundle:UserMeta')->findBy($criteria);
 }
 /**
  * @param int $blogId
  *
  * @return WordpressEntityManager
  */
 public function getManager($blogId = null)
 {
     if ($blogId !== null && $blogId !== $this->currentBlogId) {
         $this->currentBlogId = $blogId;
     }
     if (!isset($this->entityManagers[$this->currentBlogId])) {
         $config = Setup::createAnnotationMetadataConfiguration([], 'prod' !== $this->environment, null, null, false);
         $config->addEntityNamespace('KayueWordpressBundle', 'Kayue\\WordpressBundle\\Entity');
         $config->setAutoGenerateProxyClasses(true);
         $config->setProxyDir($this->defaultEntityManager->getConfiguration()->getProxyDir());
         $em = WordpressEntityManager::create($this->connection, $config);
         $this->eventDispatcher->dispatch(WordpressEvents::CREATE_ENTITY_MANAGER, new GenericEvent($em));
         $em->setBlogId($this->currentBlogId);
         $em->getMetadataFactory()->setCacheDriver($this->getCacheImpl('metadata_cache', $this->currentBlogId));
         $em->getConfiguration()->setQueryCacheImpl($this->getCacheImpl('query_cache', $this->currentBlogId));
         $em->getConfiguration()->setResultCacheImpl($this->getCacheImpl('result_cache', $this->currentBlogId));
         $this->entityManagers[$this->currentBlogId] = $em;
     }
     return $this->entityManagers[$this->currentBlogId];
 }