Frequently asked questions

Concrete answers about Codara’s PHP, Symfony and SQL training.

General

Who is this PHP, Symfony and SQL certification platform for?

The platform targets experienced developers preparing for a technical certification or looking to benchmark their level. Questions cover advanced topics: typing, performance, PHP internals, Symfony architecture, indexing and SQL query optimization. Each session produces a per-topic score, so you can target precisely where to improve.

How does an online certification session work?

Three modes are available: free practice, timed quiz and mock exam. The mock exam mixes the three topics, applies a time budget per question and returns a global score plus a per-skill breakdown at the end. Detailed corrections and explanations are only revealed after submission, to preserve the pedagogical validity of the assessment.

Which topics are covered by the questions?

The question bank is organized around three hubs: PHP (typing, memory management, streams, concurrency and modern best practices), Symfony (service container, HTTP lifecycle, Doctrine, security and performance) and SQL (indexes, execution plans, transactions, isolation and window functions). Questions require an understanding of how the tools actually behave, not just familiarity with their syntax.

Are free practice and the mock exam different?

Yes. Free practice lets you pick a topic, answer without a time limit and get immediate per-question feedback. The mock exam reproduces certification conditions: limited duration, random order, no intermediate feedback and a final report broken down by topic. The timed mode sits in between: chosen topic, controlled time, deferred feedback.

PHP

When should I use a native enum instead of a class of constants?

A native enum brings typing: a parameter of type `Status::PENDING` is checked at compile time and cannot receive an arbitrary value, unlike a class constant. It also provides shared methods, backing values for persistence and an iterable `cases()`. A constants class remains relevant for simple groups of values without business semantics; as soon as the state drives behavior, an enum is safer.

Do readonly properties replace immutable value objects?

They make them easier to write but do not enforce deep immutability: an array or a mutable object stored in a readonly property can still be modified. For a value object, combine readonly with strict types, immutable collections and methods that return new instances. Readonly promoted properties cut boilerplate but do not remove the need for defensive copying at the object boundary.

How do I avoid memory spikes with large data volumes?

Replace full in-memory loading with iterative processing: `yield` in generators, `fgets()` line by line for files, and database cursors for large queries. Measure actual usage with `memory_get_peak_usage()` before optimizing. Drop references explicitly in long loops, because a retained variable prevents the garbage collector from reclaiming the previous object.

Which OpCache settings should a PHP production app use?

Enable `opcache.enable_cli` only when needed, size `opcache.memory_consumption` according to the number of files and set `opcache.max_accelerated_files` above the real script count. Validation must match your deployment cycle: `validate_timestamps=1` in shared environments with a low `revalidate_freq`, or timestamps disabled after a deployment that purges the cache. Monitor `opcache_get_status()` to catch a saturated cache that causes constant recompilation.

What are WeakReference and WeakMap used for in practice?

`WeakReference` lets you observe an object without extending its lifetime, for example in a metadata cache table. `WeakMap` goes further: its keys are objects and are not counted as strong references, which prevents memory leaks in caches keyed by instance. Note the semantics: an entry disappears as soon as the key object is collected, so client code must handle absence.

Symfony

How do I diagnose a misconfigured Symfony service?

Use `debug:container` to check the existence, visibility and definition of a service, and `debug:container <service> --show-arguments` to inspect its dependencies. For dependency cycles, look for services built at load time instead of on demand. The compiler reports configuration errors when the container is dumped; prefer container diagnostics before adding global services or ad hoc locators.

What is the difference between an event subscriber and a listener?

A listener registers one method for a specific event; a subscriber declares the events it listens to through `getSubscribedEvents()`. The difference is mostly organizational: a subscriber is self-documenting and discovered automatically, while a listener is more discreet and fits simple cases. For priority and execution order, both mechanisms follow exactly the same rules.

How do I handle transactions and consistency with Doctrine?

Wrap multi-aggregate writes in an explicit transaction through `EntityManagerInterface::transactional()`, which handles commit and automatic rollback on exception. Do not catch a persistence exception to hide it: let it bubble up so the rollback happens. After an exception, the EntityManager may be in an inconsistent state; call `reset()` before continuing.

How do I secure a route that accesses a user resource?

Beyond authentication checks, always verify resource ownership. In a controller, use a dedicated Symfony voter for the action (`can`, `edit`, `delete`) instead of comparing identifiers in the route. For API Platform operations, express the rule in the operation and in a processor that reloads the entity from the repository. A resource loaded directly from the URL without an ownership check is an access vulnerability.

What caching strategy should a Symfony application use?

Layer your approach: HTTP caching (public, with invalidation via `Cache-Control` and validation via ETag), then application caching through `CacheInterface` with an explicit TTL and a key that includes context (locale, page). For data that rarely changes, use the Doctrine second-level cache with controlled write strategy. The golden rule stays the same: never cache a response that depends on the authenticated user without an identity key.

SQL

B-tree, hash, full-text indexes: how do I choose?

The B-tree is the default for equality and range comparisons. A hash index only helps with exact equality and is rarely necessary in MySQL. A FULLTEXT index is designed for word search in text; it does not replace a regular index for prefix search. For analytical queries, a composite index whose columns match the predicate order is often more profitable than multiplying single-column indexes.

How do I order the columns of a composite index?

Put equality columns (`=`, `IN`) first, then range columns (`>`, `<`, `BETWEEN`) and finally sort columns. This order maximizes the selectivity at each level of the index. If a range column appears in the middle, the following columns can no longer be used for lookup, only possibly for sorting. Always validate with `EXPLAIN`: the optimizer may choose another index depending on statistics.

How do I read a MySQL execution plan efficiently?

Start with the `type` column: `ALL` signals a full scan, `range` or `ref` indicate proper index usage. Then check `key`, `rows` and `Extra`: `Using filesort` or `Using temporary` betray an expensive sort or grouping. Fix gaps between estimated and actual row counts by refreshing statistics. `EXPLAIN ANALYZE` (MySQL 8.0.18+) provides real costs, which are more reliable than estimates.

Which isolation level should I choose and why?

READ COMMITTED is a good default compromise: every read sees committed data and avoids expensive phantom-read protection via range locks. SERIALIZABLE guarantees full isolation but locks ranges and reduces concurrency. REPEATABLE READ, the MySQL default, provides consistent snapshots but can hide anomalies during reads. The choice depends on the tradeoff between consistency and throughput: measure real lock contention before hardening isolation.