Acquia Developer (D10) common mistakes
Acquia Developer (D10) · Understand the traps and how to avoid them.
Using the render cache without specifying cache tags and contexts, leading to stale or incorrectly cached output for authenticated users.
Candidates often focus only on setting max-age and forget that cache tags (for content changes) and contexts (for user/role variations) are required for correct invalidation.
What to do instead
Always add appropriate cache tags (e.g., node:ID, user:ID) and cache contexts (e.g., user.roles, url.query_args) to render arrays; use the CacheableMetadata object to merge metadata from dependencies.
Writing SQL queries directly with db_query() or using the database abstraction layer without proper placeholders, leading to SQL injection vulnerabilities.
Candidates familiar with older Drupal versions or general PHP may default to raw queries, overlooking Drupal's Database API and its support for prepared statements.
What to do instead
Use the Database API with placeholders (e.g., :id) or the Entity Query API; never concatenate user input into SQL strings. For dynamic queries, use the query builder's condition() method with proper arguments.
Placing business logic in theme templates or preprocess functions instead of using hooks or services, making the site harder to maintain and test.
Candidates may be more comfortable with theming and try to solve problems in Twig or preprocess, not realizing that logic belongs in modules.
What to do instead
Move business logic to custom modules using hooks (e.g., hook_entity_presave) or services; keep templates presentational. Use preprocess functions only to prepare variables, not to perform complex operations.
Failing to declare dependencies in a module's .info.yml file, causing missing modules or themes and unexpected behavior.
Candidates may test only after enabling the module in an environment where dependencies are already present, so they don't notice the missing declarations.
What to do instead
List all required modules and themes in the dependencies key of the .info.yml file, including core and contributed projects, and ensure version constraints are correct.
Using the default cache bin for all caching needs, leading to inefficient cache invalidation and performance issues.
Candidates may not be aware of the multiple cache bins (e.g., render, data, discovery) and their specific purposes, so they default to the generic cache backend.
What to do instead
Use the appropriate cache bin for the data type: render for renderable arrays, data for custom data, discovery for plugin definitions. Inject the cache backend service and use cache tags for invalidation.
Not writing update hooks (hook_update_N) for database schema changes or configuration changes, causing errors on existing sites.
Candidates focus on new installations and forget that existing sites need updates when the module's schema or configuration changes.
What to do instead
Always provide update hooks in a .install file for any changes that affect the database or configuration, and test them by updating from a previous version.
Misconfiguring the settings.php file for Acquia environments, such as hardcoding database credentials or not using environment-specific includes.
Candidates may not be familiar with Acquia's best practices for settings.php, which requires using includes for environment-specific settings and avoiding version control of sensitive data.
What to do instead
Use the Acquia-provided settings.php includes (e.g., settings.acquia.php) and environment variables for sensitive data; never commit credentials. Follow Acquia's documentation for local and cloud settings.
Failing to properly use the Drupal configuration system (e.g., using variable_set() instead of configuration API), leading to non-exportable settings.
Candidates may be accustomed to older Drupal versions or use quick fixes without realizing the importance of configuration management in Drupal 8+.
What to do instead
Use the Configuration API (getEditableConfigNames, config factory) to store and retrieve configuration; define default configuration in config/install and config/schema.
Ignoring Drupal coding standards and not using dependency injection, resulting in code that fails automated checks or is hard to maintain.
Candidates may prioritize functionality over code quality and not realize that Acquia certification exams often test adherence to best practices.
What to do instead
Follow Drupal coding standards, use dependency injection for services, and run code sniffer tools (e.g., phpcs with Drupal standard) before submission.
Not understanding the deployment workflow on Acquia, such as committing to the wrong branch or not using Acquia Cloud hooks for database updates.
Candidates may be unfamiliar with Acquia's Git-based workflow and the role of Cloud hooks in automating deployment tasks.
What to do instead
Learn the Acquia Cloud workflow: use feature branches, deploy via the Acquia Cloud interface or CLI, and implement Cloud hooks (e.g., post-code-deploy) for running update.php and importing configuration.