Wordpress Bundle
  • What is Wordpress Bundle?
  • Getting started
    • Installation
    • Wordpress
    • Router
    • Cron job
    • Templates
  • Reference
    • Argument resolver
    • Controller
      • AdminAction
      • BlogController
      • FrontAction
      • WordpressAction
    • Entity
      • Block
      • Blog
      • Comment
      • File
      • Image
      • Menu
      • MenuItem
      • Post
      • Term
      • User
    • Repository
      • CommentRepository
      • PostRepository
      • TermRepository
      • UserRepository
    • Service
      • PaginationService
      • BreacrumbService
  • Guides
    • Server requirements
    • Install plugins
    • Use Multisite
    • Gutenberg
    • WP Steroids plugin
      • Image options
      • Maintenance
      • Admin pages removal
      • WYSIWYG Editor
      • Feature Support
      • Multi-site configuration
      • Constants definition
      • ACF configuration
      • Menu
      • Custom Post type
      • Advanced permalink settings
      • Custom Taxonomy
      • Templates
      • Page states
      • External table viewer
      • Roles
      • Optimisations
      • Security
      • Search
    • Twig Cookbook
    • Inject variables in all templates
    • Internationalization
    • Extending Wordpress Bundle
    • Error pages
    • Site health
  • Integrations
    • Advanced Custom Fields
      • Install ACF PRO
  • Extras
    • Migrating from 1.x to 2.0
    • Roadmap
    • Changelog
    • Alternatives
Powered by GitBook
On this page
  • Methods
  • Example

Was this helpful?

  1. Reference
  2. Repository

TermRepository

PreviousPostRepositoryNextUserRepository

Last updated 1 year ago

Was this helpful?

Wordpress wrapper to query objects

Methods

count()

Counts entities by a set of criteria.

find($id)

Finds an entity by its primary key / identifier.

findAll($orderBy, $public=true)

Finds all public entities in the repository.

findBy(, $orderBy, $limit, $offset)

Finds entities by a set of criteria.

findOneBy(, $orderBy)

Finds a single entity by a set of criteria.

findQueried()

Finds a single entity related to the main query

findTaxonomies($args=[], $output='names', $operator='and')

Retrieves a list of registered taxonomy names or objects.

Example

public function pageAction(Post $post, TermRepository $termRepository)
{
  $context = [
    'post'=>$post,
    'tags'=>$termRepository->findBy(['taxonomy'=>'tag'],['title'=>'ASC'], 3)
  ];
  
  return $this->render('single.html.twig', $context);
}
WP_Term_Query
$criteria
$criteria
$criteria