daos

Write and debug Doctrine QueryBuilder DAO classes in OrangeHRM plugins.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill daos-snow-gift111
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: daos
Source: https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone/tree/main/.agents/skills/daos
Command: npx skills add https://github.com/snow-gift111/orangehrm-ai-sdlc-capstone --skill daos-snow-gift111

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing data-access code in OrangeHRM requires following a strict, codebase-wide convention: plugin-specific DAO classes extending BaseDao, QueryBuilder patterns, Paginator-based counts, and FilterParams-driven filtering. This Skill encodes all of those conventions so new DAO methods match the existing ~99 DAOs instead of introducing divergent patterns. ## Core Features & Use Cases - DAO authoring guidance: Covers BaseDao, EntityManagerHelperTrait's 13 methods, the persist-plus-flush convention, and when to use find/findOneBy/findBy versus QueryBuilder. - Query patterns: Documents joins via relation aliases, expression-builder usage (orX/andX/like/concat/in/isNull), conditional joins, parameter binding, and the array_column result-extraction trick. - Pagination and transactions: Explains Paginator for accurate counts on joined queries, QueryBuilderWrapper for returning buildable queries, and begin/commit/rollback transaction handling. - Blob handling: Describes the Partial<EntityName> DTO projection pattern and the dedicated-endpoint-plus-ETag approach for serving binary content like employee pictures. - Use Case: When asked to add a new filtered, paginated list endpoint for an entity, use this Skill to produce a DAO with a private paginator-builder method shared by the list and count methods, matching the EmployeeDao pattern. ## Quick Start Ask the agent to write a new DAO method for an OrangeHRM plugin following the daos skill conventions, for example a paginated employee search filtered by subunit.

Frequently Asked Questions about daos

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a new DAO method in OrangeHRM?

Create a class extending OrangeHRM\Core\Dao\BaseDao and use createQueryBuilder with an entity alias, then add filters via andWhere with named parameters. For simple equality lookups, use getRepository with find, findOneBy, or findBy instead of building a query.

When should I use findBy versus QueryBuilder in Doctrine DAOs?

Use findBy or findOneBy when the criteria are flat field-equals-value AND conditions. Anything more complex, such as LIKE, OR conditions, joins, IN clauses, NULL checks, or sorting and pagination, should go through QueryBuilder for visibility and control.

How do I get an accurate count for a joined Doctrine query?

Use the Paginator returned by getPaginator rather than replacing SELECT with COUNT, because joins and DISTINCT distort naive counts. Pair the list and count methods through the same private paginator-builder method so filters never drift apart.

Can I use raw SQL or createNativeQuery in OrangeHRM DAOs?

No, the codebase has zero createNativeQuery usages in plugin DAOs. Queries should be expressed in DQL, possibly with custom DQL functions; raw SQL only appears in migrations, which are a separate layer.

How do I avoid loading blob columns in Doctrine list queries?

Define a Partial<EntityName> DTO with only the non-blob columns and project to it using the NEW FQCN(...) DQL syntax in the select clause. The blob column never appears in the SELECT, so it is never fetched from the database.

How are transactions handled in OrangeHRM DAO code?

Use beginTransaction, commitTransaction, and rollBackTransaction from EntityManagerHelperTrait in a try/catch block, always rethrowing after rollback. The closure-based EntityManager::transactional API exists in Doctrine but is not used in this codebase.