Miscellaneous Flashcards
(40 cards)
Which PSR does Cache-Component follow?
PSR-6 & PSR-16
Which interfaces/classes does the PSR-6 Cache-Component include?
- CacheException
- CacheItemInterface
- CacheItemPoolInterface
- InvalidArgumentException
How will a value be set for a cache-item?
Within the method “get”
How will a value be selected for a cache-item?
Within the method “get”
What is stampede protection?
Protecting cold cache from being written by multiple clients at a time
What are the 2 ways of symfony’s stampede protection?
- lock
- refresh before expiring
Whats the difference between PSR-6 and PSR-16?
PSR-16 is the simplified and more performant way of caching, while PSR-6 allows more complex possibilities for caching (e.g. getItem, getDeferred etc.)
Which Interfaces / Classes do the cache-contracts (PSR-16) include?
- CacheInterface
- ItemInterface
What are ways to react on events?
EventSubscriber
EventListener
Which interfaces / classes are part of the event-dispatcher component?
- EventDispatcherInterface (to dispatch the event)
- EventSubscriberInterface
- Event
Which PSR defines the event-dispatcher component?
PSR-14
https://www.php-fig.org/psr/psr-14/
Which method is implemented in the EventSubscriberInterface?
::getSubscribedEvents()
What are ways to make an EventListener to listen to an Event?
EventListener
Registering with ->addEventListener
How to add priority to an Event-listener / -subscriber?
with the parameter $priority
How can you make sure the DI-Container is configured in a valid way?
php bin/console lint:container
What are 2 ways to access services lazily from the DI-Container instead of using autowiring?
- service locator
- public service (not best practice)
How and where can global parameters be configured?
In the services.yaml / services.php in the section “parameters:”
parameters: app.admin_email:'something@example.com'
How can globally configured parameters be used in other configuration files?
config/packages/some_package.yaml
some_package: # any string surrounded by two % is replaced by that parameter value email_address: '%app.admin_email%'
Where are additional packages being configured?
your-project/ ├─ config/ │ ├─ packages/
Where can the service container be configured?
your-project/ ├─ config/ │ └─ services.yaml
Where can routes be configured?
your-project/ ├─ config/ │ ├─ routes.yaml
Which configuration formats does symfony support?
PHP
XML
YAML
How is the current environment defined in symfony?
Via the “APP_ENV” variable in the current .env
How can you store and show custom data inside the toolbar?
Create an own datacollector by using the DataCollectorInterface