url stringlengths 50 196 | text stringlengths 3 17.2k | heading stringlengths 2 103 | embeddings list |
|---|---|---|---|
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Database_Model#field-collections | Field Collections
Table/View
Purpose
object_collection_(collection-name)_(object-id)
Stores data of the field collections fields and the order (index)
| Field Collections | [
-0.1327991783618927,
0.11018892377614975,
-0.256404846906662,
0.28320419788360596,
-0.09936650842428207,
0.2288346290588379,
-0.044346291571855545,
0.29355573654174805,
-0.011532874777913094,
0.009997750632464886,
-0.03870077431201935,
0.38439449667930603,
0.14753025770187378,
-0.052693806... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#logging | Logging
There are several different kinds of logs in Pimcore. All of them are located under /var/log and get rotated
as well as compressed automatically on every day (7 days retention) by the maintenance command. | Logging | [
-0.11878006905317307,
-0.2664104700088501,
-0.12995761632919312,
0.16914919018745422,
-0.08502047508955002,
-0.1100929006934166,
-0.07280944287776947,
-0.06766480207443237,
-0.42346447706222534,
0.2753187119960785,
-0.09683484584093094,
0.40245282649993896,
0.12288045883178711,
-0.10385333... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#<env>.log | <env>.log
This is definitely one of the most important logs and also the default logging location.
Pimcore uses Symfony default monolog logging with following channels: pimcore, pimcore_api, session.
For details see Symfonys monolog docs. | <env>.log | [
0.005115716252475977,
-0.38840559124946594,
-0.0195180531591177,
-0.06277313828468323,
-0.1383923888206482,
-0.06614908576011658,
0.05283834785223007,
-0.12218073755502701,
-0.09163595736026764,
-0.03463650867342949,
-0.24160264432430267,
0.2976023554801941,
0.21129514276981354,
-0.0058028... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#php.log | php.log
By default Pimcore writes PHP-Engine Log Messages to the file php.log.
You can change this by add the following to your symfony config:
monolog:
handlers:
error:
type: stream
path: "%kernel.logs_dir%/own_php.log"
level: error
| php.log | [
-0.20369797945022583,
0.0032367410603910685,
-0.033971358090639114,
0.196555957198143,
0.04732615128159523,
-0.3921268582344055,
0.23716174066066742,
0.12487668544054031,
-0.2904694378376007,
0.030529843643307686,
-0.045056749135255814,
0.3186618387699127,
-0.044268351048231125,
-0.0070545... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#usagelog.log | usagelog.log
In this log you can find every action done within the Pimcore Backend Interface. It can be deactivated by configuring disable_usage_statistics in config/config.yaml:
pimcore:
general:
disable_usage_statistics: true
| usagelog.log | [
-0.2556174397468567,
-0.1875167042016983,
-0.1565176397562027,
0.010804283432662487,
0.13323257863521576,
-0.27284741401672363,
0.15046538412570953,
0.02972877211868763,
-0.3719640374183655,
0.18166089057922363,
-0.13288798928260803,
0.3477315306663513,
0.09751491993665695,
0.0635807290673... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#example-entry: | Example Entry:
2021-04-26T13:18:35+0200 : 2|Pimcore\Bundle\AdminBundle\Controller\Admin\Document\PageController::saveAction|pimcore_admin_document_page_save|{"task":"publish","id":"1","data":"{\"cImage_0\":{\"data\":{\"id\":337,\"path\":\"\\\/..."}
2021-04-26T13:18:35+0200 : 2|Pimcore\Bundle\AdminBundle\Controller\Admin\Asset\AssetController::getImageThumbnailAction|pimcore_admin_asset_getimagethumbnail|{"id":"3","alt":"","height":"undefined","thumbnail":"portalCarousel","pimcore_editmode":"1"}
| Example Entry: | [
-0.14240333437919617,
-0.02986554242670536,
-0.35311803221702576,
0.19198563694953918,
-0.020907660946249962,
-0.184583842754364,
0.2199346274137497,
0.34409016370773315,
-0.18596170842647552,
0.20264047384262085,
0.06347890943288803,
0.3872843384742737,
-0.04371565952897072,
0.15603649616... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#explanation | Explanation
Value (from the example above)
Description
2021-04-26T13:18:35+0200
Timestamp
2
User-ID
Pimcore\Bundle\AdminBundle\Controller\Admin\Document\PageController::saveAction
Module\Controller::Action
pimcore_admin_document_page_save
Route name
{"task":"pub ....
Request Parameters (shortened & censored)
| Explanation | [
-0.10427407920360565,
-0.2991999685764313,
-0.12193875759840012,
-0.0018070953665301204,
0.014238051138818264,
-0.4291849136352539,
0.19783546030521393,
-0.0572013296186924,
-0.4178485572338104,
0.2106626033782959,
0.16142451763153076,
0.4141954779624939,
0.06584633886814117,
0.22733651101... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#redirect.log | redirect.log
Sometimes it's necessary to debug redirects, for example when a redirect ends in an infinite loop.
In this log you can see every request where a redirect takes action. | redirect.log | [
-0.011066446080803871,
-0.37959668040275574,
-0.13186992704868317,
-0.046276677399873734,
-0.0311106089502573,
-0.27591609954833984,
0.08853640407323837,
-0.11118272691965103,
-0.18730668723583221,
-0.027969589456915855,
0.2278802990913391,
0.06641706824302673,
-0.09800317883491516,
-0.116... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#example | Example
2021-04-26T14:03:20+0200 : 10.242.2.255 Custom-Redirect ID: 1, Source: /asdsad/redirectsource/asd -> /en/Events
:::info
Redirects are logged into a redirect monolog log channel at info level. By default, Pimcore logs that channel into var/log/redirect.log.
Of course, the corresponding monolog handler configuration can be adapted as needed.
::: | Example | [
-0.2660245895385742,
-0.4764360189437866,
0.007291300687938929,
0.12303508073091507,
-0.31946420669555664,
-0.4805658459663391,
0.17696018517017365,
-0.3215027153491974,
-0.49479785561561584,
-0.20480847358703613,
-0.180959552526474,
0.3821806013584137,
-0.216422438621521,
0.16640532016754... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Logging#writing-your-own-log-files | Writing Your Own Log Files
To create a custom log entry, we need to create the monolog log channels and log handlers configuration. Here is an example on how to log in a custom filename called custom.log
monolog:
handlers:
custom_handler:
level: debug
type: stream
path: '%kernel.logs_dir%/custom.log'
channels: [custom_log]
channels: [custom_log, some_other_channel]
It is possible to inject the Psr\Log\LoggerInterface by changing the variable name eg. $customLogLogger (camel case channel name + Logger) and Symfony will automatically wire the specified channel.
class SomeService {
public function __construct(\Psr\Log\LoggerInterface $customLogLogger)
{
$customLogLogger->debug('Test Message');
}
}
For more, please refer to Monolog Documentation | Writing Your Own Log Files | [
0.027808109298348427,
-0.10571637004613876,
0.10904747247695923,
0.023759061470627785,
-0.1489536464214325,
-0.13824886083602905,
0.5027438402175903,
-0.1274976283311844,
-0.04708249121904373,
0.0787355974316597,
-0.003740356070920825,
0.2759791910648346,
-0.2412455976009369,
0.02290746383... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#full-page-cache-(output-cache) | Full Page Cache (Output Cache) | Full Page Cache (Output Cache) | [
-0.158166766166687,
-0.45365819334983826,
-0.26129135489463806,
0.031429748982191086,
-0.10090979933738708,
0.2539728879928589,
0.12083999067544937,
0.11187135428190231,
-0.005383430980145931,
0.1083809956908226,
0.08384623378515244,
-0.18435771763324738,
0.05838177725672722,
0.12059256434... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#overview | Overview
| Overview | [
-0.3182433843612671,
-0.32859840989112854,
-0.24390918016433716,
0.2532045245170593,
0.25265389680862427,
-0.08190099149942398,
0.23746146261692047,
0.06466557085514069,
-0.4879758656024933,
0.19646817445755005,
-0.03667168691754341,
-0.13152003288269043,
0.0016724041197448969,
0.226947218... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#configure-the-full-page-cache | Configure the Full Page Cache
Please Note
The full page cache is disabled by default if you're logged in in the admin interface or in the case
the debug mode ('APP_ENV=dev') is on.
The full page cache only works with GET request, it takes the whole response (only for the frontend)
including the headers from a request and stores it into the cache. The next request to the same
page (hostname and request-uri are used to build the checksum/hash identifier) will be served
directly by the cache.
You can check if a request is served by the cache or not checking the response headers of the
request. If there are X-Pimcore-Cache-??? (marked orange below) headers in the response they the
page is coming directly from the cache, otherwise not.
If you have specified a lifetime, the response also contains the Cache-Control and the Expires
header (perfect for HTTP accelerators like Varnish, ... ).
You can configure full page cache in config/config.yaml, as in e.g.:
# config/config.yaml
pimcore:
full_page_cache:
enabled: true
lifetime: 120
exclude_cookie: 'pimcore_admin_sid'
exclude_patterns: '@^/test/de@'
Option
Description
Enable
Set to true to enable to full page cache.
Lifetime
You can optionally define a lifetime (in seconds) for the full page cache. If you don't do, the cache is evicted automatically when there is a modification in the Pimcore Backend UI. If there is a lifetime the item stays in the cache even when it is changed until the TTL is over. The lifetime is useful if you have embedded some items which are not directly in the cms, like rss feeds, or twitter messages over the API. It is also highly recommended to specify a lifetime on high traffic websites so that the frontend (caches) isn't affected by changes in the admin-UI. Otherwise on every change in the admin-UI the whole output-cache is flushed, what can have drastic effects to the server environment.
Exclude Patterns
You can define some exclude patterns where the cache doesn't affect. The patterns have to be valid regular expressions (including delimiters) and different patterns should be seperated by ,
Disable Cookie
You can define an additional cookie-name which disables the cache. The cookie "pimcore_admin_sid" (used for the Pimcore admin UI) ALWAYS disables the output-cache to make editor's life easier ;-)
| Configure the Full Page Cache | [
-0.25535544753074646,
-0.18065960705280304,
-0.14382587373256683,
0.04937924072146416,
0.06335465610027313,
-0.32409465312957764,
-0.04363406449556351,
0.2300289273262024,
-0.05705473572015762,
0.10075493156909943,
0.02855086885392666,
0.08530118316411972,
0.1907045543193817,
0.13734245300... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-in-your-code | Disable the Full Page Cache in your Code
Sometimes it is more useful to deactivate the full page cache directly in the code, for example when
it's not possible to define an exclude-regex, or for similar reasons. | Disable the Full Page Cache in your Code | [
-0.0326639860868454,
-0.2229466587305069,
-0.17321108281612396,
-0.12379096448421478,
0.09741438925266266,
-0.10431599617004395,
0.1127762421965599,
0.27122464776039124,
0.05108913779258728,
0.31766271591186523,
0.10182016342878342,
-0.012261718511581421,
0.1386622190475464,
-0.11782035231... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-caching-via-the-response-headers | Disable caching via the response headers
Adding the Cache-Control: no-cache, Cache-Control: private or Cache-Control: no-store header to your response will disable the full page cache as well as any other
middleware and browser caching:
<?php
$response->headers->addCacheControlDirective('no-cache');
// and/or
$response->headers->addCacheControlDirective('private');
// and/or
$response->headers->addCacheControlDirective('no-store');
| Disable caching via the response headers | [
-0.14667373895645142,
-0.28829336166381836,
-0.23015710711479187,
0.06433596462011337,
0.09000074863433838,
0.11265922337770462,
0.03542401269078255,
0.35126399993896484,
0.15336813032627106,
0.24201124906539917,
0.08196655660867691,
-0.17072150111198425,
0.32258668541908264,
-0.1918932497... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-via-an-event-listener | Disable the full page cache via an event listener
The full page cache can be disabled via an event listener on FullPageCacheEvents::CACHE_RESPONSE:
<?php
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
class DetermineFullPageCacheEventListener
{
#[AsEventListener(\Pimcore\Event\FullPageCacheEvents::CACHE_RESPONSE)]
public function determineFullPageCache(\Pimcore\Event\Cache\FullPage\CacheResponseEvent $event): void
{
$response = $event->getResponse();
if (true) { // Replace with your custom condition
$event->setCache(false);
}
}
}
| Disable the full page cache via an event listener | [
-0.10842936486005783,
-0.17244575917720795,
-0.1831783950328827,
0.10343991219997406,
-0.04316265881061554,
0.0022238309029489756,
-0.02565639652311802,
0.3341462314128876,
0.09451700747013092,
0.21454674005508423,
-0.014540494419634342,
-0.1616031676530838,
0.24876411259174347,
-0.1649716... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-listener-entirely | Disable the full page cache listener entirely
You can obtain the full page cache service from the container and disable it, e.g. in a Controller via DI:
<?php
use Pimcore\Bundle\CoreBundle\EventListener\Frontend\FullPageCacheListener;
public function portalAction(Request $request, FullPageCacheListener $fullPageCacheListener)
{
$fullPageCacheListener->disable('Your disable reason');
return $this->redirect('de');
}
| Disable the full page cache listener entirely | [
-0.3040983974933624,
-0.18752524256706238,
-0.08746863156557083,
0.061563216149806976,
0.13303999602794647,
-0.038604166358709335,
0.030881088227033615,
0.17190657556056976,
-0.18017227947711945,
0.20170891284942627,
-0.19864359498023987,
0.19815213978290558,
0.1978028118610382,
-0.0619931... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-via-your-request | Disable the Full Page Cache via your request | Disable the Full Page Cache via your request | [
0.06090192869305611,
-0.32310959696769714,
-0.3491096496582031,
0.022235188633203506,
-0.1275463104248047,
0.12866421043872833,
-0.09914033114910126,
0.17893944680690765,
-0.03582737594842911,
0.2625191807746887,
0.15326666831970215,
-0.26058506965637207,
0.16017737984657288,
-0.0963375866... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-for-a-single-request-(only-in-debug-mode) | Disable the Full Page Cache for a Single Request (only in DEBUG MODE)
Just add the parameter ?pimcore_outputfilters_disabled=true to the URL. | Disable the Full Page Cache for a Single Request (only in DEBUG MODE) | [
-0.32378649711608887,
-0.31346049904823303,
-0.17819377779960632,
-0.041769254952669144,
-0.03255811333656311,
-0.28262606263160706,
0.10409737378358841,
0.22803521156311035,
-0.2957390546798706,
0.2987145185470581,
-0.141739159822464,
0.2460922747850418,
0.25100791454315186,
0.13768972456... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#disable-the-full-page-cache-with-a-cookie-and-a-bookmarklet | Disable the Full Page Cache with a Cookie and a Bookmarklet
Per default the disable-cookie configuration is set to pimcore_admin_sid.
That means that if you're logged into Pimcore (have a session-id cookie) you will always get the
content live and not from the cache. | Disable the Full Page Cache with a Cookie and a Bookmarklet | [
-0.14807632565498352,
-0.22143226861953735,
-0.18212859332561493,
0.06018853560090065,
-0.15569211542606354,
-0.10229259729385376,
-0.019230933859944344,
0.2677036225795746,
-0.16557030379772186,
0.11550367623567581,
-0.28414997458457947,
0.21517610549926758,
0.13804282248020172,
0.1847315... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache/Full_Page_Cache#bookmarklet | Bookmarklet
If you have the cookie pimcore_admin_sid in your system configuration you can use the following
bookmarklet to disable the full page cache without having an active admin session in another tab.
To use the bookmarklet, just drag the following Link into your bookmark toolbar (any browser):
Disable Pimcore Cache
Enable Pimcore Cache
| Bookmarklet | [
-0.22062627971172333,
-0.2836383581161499,
-0.09697416424751282,
-0.08768156170845032,
0.011187851428985596,
0.13303102552890778,
-0.059824179857969284,
0.07279086858034134,
0.17469613254070282,
0.14895714819431305,
-0.1880004107952118,
-0.15121714770793915,
0.13390931487083435,
0.03053717... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#cache | Cache
Pimcore uses extensively caches for differently types of data. The primary cache is a pure object
cache where every element (document, asset, object) in Pimcore is cached as it is (serialized objects).
Every cache item is tagged with dependencies so the system is able to evict dependent objects if
a referenced object changes.
The second cache is the output cache, which you can use either as pure page cache (configurable
in system settings), or as in-template cache (see more at template extensions).
The third cache is used for add-ons like the glossary, translations, database schemes, and so on.
The behavior of the caches is controlled by the add-on itself.
All of the described caches are utilizing the Pimcore\Cache interface to store their objects. Pimcore\Cache utilizes
a Pimcore\Cache\Core\CoreCacheHandler to apply Pimcore's caching logic on top of a PSR-6
cache implementation which needs to implement cache tagging. | Cache | [
0.04266154766082764,
-0.25275927782058716,
-0.19365152716636658,
0.26884642243385315,
-0.1423598825931549,
0.08075830340385437,
-0.23408769071102142,
0.0031041994225233793,
-0.08167322725057602,
0.0422087162733078,
-0.28111106157302856,
0.20192363858222961,
0.2860226333141327,
-0.127912595... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#configuring-the-cache | Configuring the cache
Pimcore uses the pimcore.cache.pool Symfony cache pool, you can configure it according to your needs, but it's crucial
that the pool supports tags.
# config/packages/cache.yaml
framework:
cache:
pools:
pimcore.cache.pool:
public: true
#tags: true
default_lifetime: 31536000 # 1 year
#adapter: pimcore.cache.adapter.doctrine_dbal
#provider: 'doctrine.dbal.default_connection'
adapter: cache.adapter.redis_tag_aware
provider: 'redis://localhost'
By default, the cache will reuse the Doctrine connection and write to your DB's cache_items tables. You can override
the used connection by setting connection setting to a known Doctrine connection (see
DoctrineBundle Reference
for further information).
If you enable the redis cache configuration, the Redis cache will be used instead of the Doctrine one, even if Doctrine
is enabled as well.
IMPORTANT! It is crucial to test and verify your Redis configuration, if Pimcore is unable to connect to Redis, the entire system will stop working.
| Configuring the cache | [
-0.25151869654655457,
0.010365638881921768,
-0.06378638744354248,
-0.0265369676053524,
-0.14574608206748962,
-0.045756928622722626,
0.02183154970407486,
0.1802285760641098,
-0.12434255331754684,
-0.0410013273358345,
-0.3806588053703308,
0.15893246233463287,
0.39081302285194397,
-0.10072521... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#recommended-redis-configuration-(redis.conf) | Recommended Redis Configuration (redis.conf)
# select an appropriate value for your data
maxmemory 768mb
# IMPORTANT! Other policies will cause random inconsistencies of your data!
maxmemory-policy volatile-lru
save ""
With the default settings, the minimum supported Redis version is 3.0.
Please note that the Redis adapter currently doesn't properly support Redis Cluster setups.
| Recommended Redis Configuration (redis.conf) | [
-0.45885226130485535,
-0.5872018337249756,
-0.17574496567249298,
0.06686089187860489,
-0.19027766585350037,
-0.030341094359755516,
-0.026104101911187172,
0.4336003363132477,
0.1921769380569458,
0.0017931313486769795,
-0.06404070556163788,
-0.16384482383728027,
-0.0019461221527308226,
0.098... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#element-cache-workflow-(asset,-document,-object) | Element Cache Workflow (Asset, Document, Object)
| Element Cache Workflow (Asset, Document, Object) | [
-0.1349610686302185,
-0.10497783124446869,
-0.27238449454307556,
-0.04050217196345329,
-0.0783442035317421,
-0.06702369451522827,
0.4620247185230255,
0.25314638018608093,
0.34315025806427,
0.09964539110660553,
0.14318807423114777,
-0.01717788726091385,
-0.13234879076480865,
0.0306190401315... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#using-the-cache-for-your-application | Using the Cache for your Application
Use the Pimcore\Cache facade to interact with the core cache or directly use the Pimcore\Cache\Core\CoreCacheHandler service.
You can use this functionality for your own application, and also to control the behavior of the Pimcore cache (but be
careful!).
If you don't need the transactional tagging functionality as used in the core you're free to use a custom cache system as
provided by Symfony but be aware that custom caches are not
integrated with Pimcore's cache clearing functionality. | Using the Cache for your Application | [
-0.3262699544429779,
-0.0003434983373153955,
-0.1440851390361786,
0.12734705209732056,
-0.12737539410591125,
-0.06831679493188858,
0.0005751426215283573,
0.12556086480617523,
0.07708367705345154,
0.15543586015701294,
-0.36192935705184937,
0.315440833568573,
0.25893229246139526,
-0.01564822... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#example-of-custom-usage-in-an-action | Example of custom usage in an action
$lifetime = 99999;
$cacheKey = md5($uri);
if(!$data = \Pimcore\Cache::load($cacheKey)) {
$data = \Pimcore\Tool::getHttpData('http://www.pimcore.org/...');
\Pimcore\Cache::save(
$data,
$cacheKey,
["output","tag1","tag2"],
$lifetime);
}
| Example of custom usage in an action | [
-0.14315305650234222,
-0.3151763081550598,
-0.13737612962722778,
0.08263684064149857,
-0.06940936297178268,
-0.20524956285953522,
0.24075835943222046,
0.021774671971797943,
0.03640960901975632,
0.06949155032634735,
-0.02332353964447975,
0.14739283919334412,
-0.11540970951318741,
0.24662695... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#overview-of-functionalities | Overview of functionalities
// disable the cache globally
\Pimcore\Cache::disable();
// enable the cache globally
\Pimcore\Cache::enable();
// invalidate caches using a tag
\Pimcore\Cache::clearTag("mytag");
// invalidate caches using tags
\Pimcore\Cache::clearTags(["mytag","output"]);
// clear the whole cache
\Pimcore\Cache::clearAll();
// disable the queue and limit and write immediately
\Pimcore\Cache::setForceImmediateWrite(true);
| Overview of functionalities | [
-0.2357395738363266,
-0.28075361251831055,
-0.17100968956947327,
0.020866969600319862,
0.12976400554180145,
-0.1237836703658104,
0.06921551376581192,
0.22769615054130554,
-0.07662581652402878,
0.1952252984046936,
-0.23944243788719177,
0.2796160578727722,
0.19839318096637726,
0.142095908522... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#disable-the-cache-for-a-single-request | Disable the Cache for a Single Request
Sometimes it's useful to deactivate the cache for testing purposes for a single request. You
can do this by passing the URL parameter pimcore_nocache=true. Note: This is only possible if you have
enabled the DEBUG MODE in Settings > System
For example: http://www.pimcore.org/download?pimcore_nocache=true
This will disable the entire cache, not only the output-cache. To disable only the output-cache
you can add this URL parameter: ?pimcore_outputfilters_disabled=true
Here you can find more magic parameters.
If you want to disable the cache in your code, you can use:
\Pimcore\Cache::disable();
This will disable the entire cache, not only the output-cache. WARNING: Do not use this in production code!
It is also possible to just disable the output-cache in your code, read more here. | Disable the Cache for a Single Request | [
-0.4089416265487671,
-0.2646625339984894,
-0.19892717897891998,
-0.13218024373054504,
0.09700378030538559,
-0.2856822609901428,
0.0002789940917864442,
0.3777373731136322,
-0.1343751847743988,
0.3667975664138794,
-0.0982169434428215,
0.3909150958061218,
0.2635929584503174,
-0.02181077189743... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Cache#further-reading | Further Reading
Details about output-cache - see Output Cache.
| Further Reading | [
-0.3397251069545746,
-0.3663656413555145,
-0.24978558719158173,
-0.1524716466665268,
0.13461704552173615,
-0.238888680934906,
0.43401503562927246,
0.14164021611213684,
0.08214498311281204,
0.33056047558784485,
-0.02516389824450016,
0.08404095470905304,
0.07010490447282791,
-0.0464504659175... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Configure_Password_Hashing_Algorithm#configure-password-hashing-algorithm | Configure Password Hashing Algorithm
Pimcore uses PHP's default password hashing algorithm by default, which currently equals to BCrypt with a cost of 10
(see PASSWORD_DEFAULT), but the algorithm
can also be configured (see here for possible algorithms and their options),
for example:
pimcore:
security:
password:
algorithm: !php/const PASSWORD_BCRYPT
options:
cost: 13
This config will be used for Pimcore's backend users and fields of type Password in custom Pimcore Objects. | Configure Password Hashing Algorithm | [
-0.2449772208929062,
-0.37728822231292725,
-0.16786447167396545,
-0.0050008296966552734,
0.10939489305019379,
-0.41069403290748596,
0.019220978021621704,
-0.08314576745033264,
-0.22963400185108185,
0.427939772605896,
0.10441958159208298,
0.15370437502861023,
0.1828465759754181,
0.222537681... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticate_Pimcore_Objects#authenticate-against-pimcore-objects | Authenticate Against Pimcore Objects
As Symfony's security component is quite complex, Pimcore provides base implementations to facilitate integrating the security
configuration with users stored as Pimcore objects.
As example, assume we have a user object which is defined in a App\Model\DataObject\User class and stores its password
in a field named password (field type Password). The password field is configured to use the password_hash algorithm
which is the standard way to handle passwords in PHP these days (internally it uses bcrypt). The class definition looks
like this (you can find a working example in the demo-basic install profile):
As a user object needs to implement the UserInterface provided by Symfony, we override the generated class and implement
the remaining methods which are not implemented by field getters:
<?php
// src/Model/DataObject/User.php
namespace App\Model\DataObject;
use Pimcore\Model\DataObject\ClassDefinition\Data\Password;
use Pimcore\Model\DataObject\User as BaseUser;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Our custom user class implementing Symfony's UserInterface.
*/
class User extends BaseUser implements UserInterface
{
/**
* Trigger the hash calculation to remove the plain text password from the instance. This
* is necessary to make sure no plain text passwords are serialized.
*
* {@inheritdoc}
*/
public function eraseCredentials(): void
{
/** @var Password $field */
$field = $this->getClass()->getFieldDefinition('password');
$field->getDataForResource($this->getPassword(), $this);
}
}
Next, we configure Pimcore to use our overridden class:
# config/config.yaml
pimcore:
models:
class_overrides:
'Pimcore\Model\DataObject\User': 'App\Model\DataObject\User'
| Authenticate Against Pimcore Objects | [
-0.09637991338968277,
-0.027707839384675026,
-0.04594709351658821,
0.08124177157878876,
0.18465889990329742,
-0.31965863704681396,
0.3961682915687561,
-0.1530870944261551,
-0.16606882214546204,
0.2385323941707611,
-0.045066386461257935,
0.013117306865751743,
0.06691385060548782,
-0.1056526... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticate_Pimcore_Objects#loading-users-with-a-user-provider | Loading users with a User Provider
A user provider is responsible for finding matching user objects for a given username. Pimcore ships an ObjectUserProvider
which loads users from a defined class type and searches the username for a configured property. In our case, we want to
load users from the App\Model\DataObject\User and query the username field. To be able to use our user class in the
security configuration, we define a user provider service which is configured to load our user implementation (make sure
your bundle is able to load service definitions, see
Loading Service Definitions):
# config/services.yaml
services:
# The user provider loads users by Username.
# Pimcore provides a simple ObjectUserProvider which is able to load users from a specified class by a configured
# field. The website_demo.security.user_provider will load users from the App\Model\DataObject\User by looking at
# their username field.
website_demo.security.user_provider:
class: Pimcore\Security\User\ObjectUserProvider
arguments: ['App\Model\DataObject\User', 'username']
We'll use this service later in our security configuration to tell the firewall where to load its users from. For details
have a look at ObjectUserProvider which is basically calling User::getByUsername($username, 1) internally. If you have
more complex use cases you can extend the ObjectUserProvider or ship your completely custom implementation.
For more information see How to Create a custom User Provider
on the Symfony docs. | Loading users with a User Provider | [
0.1851549744606018,
0.09955070912837982,
-0.06904257088899612,
0.13181544840335846,
-0.0033331450540572405,
-0.28668177127838135,
0.5883035063743591,
-0.38506364822387695,
-0.070435531437397,
0.15186452865600586,
-0.2791113555431366,
0.08385013788938522,
0.32678619027137756,
-0.06894470751... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticate_Pimcore_Objects#password-hashing | Password hashing
The standard approach of hashing and verifying a user's password in Symfony is to delegate the logic to a PasswordHasherInterface
which is responsible for calculating and verifying password hashes. As Pimcore's Password field definition already provides
this logic, the password hasher needs to be configured to delegate the logic to the user object.
Symfony builds and caches one password hasher instance per user type (class). To be able to delegate the calculation to the user
object it is necessary to build an password hasher instance which is scoped to the user object and can access the user's properties
at runtime. Pimcore adds this as additional layer of configuration which allows to specify a password hasher factory per user
type which in turn can decide if it needs to build dedicated instances of password hashers per user.
To be able to integrate our user object, we need 2 integration points:
A PasswordFieldHasher which has access to the user instance and delegates calculation and verification of the password
hash to the password field definition. The password hasher needs to be configured with the name of the field it should operate
on (password in our case).
A UserAwarePasswordHasherFactory which builds a dedicated instance of a PasswordFieldHasher per user object.
To achieve this, we define a factory service which builds PasswordFieldHasher instances as specified above:
# The password hasher factory is responsible for verifying the password hash for a given user. As we need some special
# handling to be able to work with the password field, we use the UserAwarePasswordHasherFactory to build a dedicated
# hasher per user. This service is configured in pimcore.security.password_hasher_factories to handle our user model.
services:
website_demo.security.password_hasher_factory:
class: Pimcore\Security\Hasher\Factory\UserAwarePasswordHasherFactory
arguments:
- Pimcore\Security\Hasher\PasswordFieldHasher
- ['password']
Now, instead of configuring the password hasher in security.password_hashers as it is the standard Symfony way, configure your password hasher
factory service instead in pimcore.security.password_hasher_factories. This is just an additional way of building password hashers - if
you don't need any user specific handling, just stick to the standard Symfony way.
pimcore:
security:
# the password hasher factory as defined in services.yaml
password_hasher_factories:
App\Model\DataObject\User: website_demo.security.password_hasher_factory
When a password hasher is loaded for a App\Model\DataObject\User object, the UserAwarePasswordHasherFactory will build a dedicated
instance of PasswordFieldHasher instead of always returning the same instance for all users. | Password hashing | [
0.04584929347038269,
0.059434015303850174,
0.008434603922069073,
0.12099004536867142,
0.26205015182495117,
-0.3871854841709137,
0.5933374762535095,
-0.10290370881557465,
0.015943236649036407,
0.3748863637447357,
0.06366823613643646,
0.06919340789318085,
0.013428612612187862,
-0.13891462981... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticate_Pimcore_Objects#configuring-the-firewall | Configuring the firewall
As all our needed services are in place, we can start to use them from the firewall configuration. As an example, let's
configure a simple firewall which authenticates via HTTP basic auth. Our final configuration looks like the following:
pimcore:
security:
# the password hasher factory as defined in services.yaml
password_hasher_factories:
App\Model\DataObject\User: website_demo.security.password_hasher_factory
security:
providers:
# the user provider as defined in services.yaml
demo_cms_provider:
id: website_demo.security.user_provider
firewalls:
# demo_cms firewall is valid for the whole site
demo_cms_fw:
# the provider defined above
provider: demo_cms_provider
http_basic: ~
This should get you started with a custom authentication system based on Pimcore objects. For further information see:
The Demo which acts as base for
this guide and implements a form/session login.
The Symfony Security Component documentation
| Configuring the firewall | [
-0.15067072212696075,
0.026026513427495956,
-0.12176722288131714,
-0.11513277888298035,
-0.05390714854001999,
-0.2881419360637665,
0.48430135846138,
-0.1744445264339447,
-0.12115177512168884,
0.001289819716475904,
-0.24721704423427582,
-0.07173074036836624,
0.22658179700374603,
0.249974533... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticator_Based_Security#authenticator-based-security | Authenticator Based Security
Note: This feature is available since v10.5
As Pimcore uses the Symfony Security Component for authentication/authorization of Admin interface and also
provides the capabilities to use the same security component on frontend websites. It is important to adapt the ongoing
changes in Symfony security component.
As starting with Symfony 5.3, a new Authenticator based security is introduced and old authentication system is
deprecated. It is highly recommended to migrate to new Authentication system.
By default, Pimcore uses old authentication system for backward compatibility reasons.
To use new authenticator, add symfony config:
security:
enable_authenticator_manager: true
and refactor security.yaml to adapt new changes. See demo changes here | Authenticator Based Security | [
-0.20696090161800385,
-0.05116435885429382,
-0.11481086164712906,
-0.13404035568237305,
-0.035770103335380554,
-0.5311654806137085,
0.414598286151886,
-0.07518279552459717,
-0.10826057940721512,
0.2934977412223816,
-0.17311815917491913,
0.2392512410879135,
0.18001703917980194,
0.0266395714... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication/Authenticator_Based_Security#points-to-consider-when-moving-to-new-authenticator: | Points to consider when moving to new Authenticator:
New authentication system works with Password Hasher Factory instead of Encoder Factory.
BruteforceProtectionHandler will be replaced with Login Throttling.
Custom Guard Authenticator will be replaced with Http\Authenticator.
Anonymous user no longer exist.
For more information on new Authenticator Based Security, please read the
Symfony Security Component documentation. | Points to consider when moving to new Authenticator: | [
-0.09220744669437408,
0.3681255877017975,
-0.05181038752198219,
-0.13252690434455872,
0.09518958628177643,
-0.4290092885494232,
0.4674532115459442,
0.22148387134075165,
-0.06133730709552765,
0.028512874618172646,
-0.2719018757343292,
-0.09279932081699371,
0.012219876050949097,
-0.151816979... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication#security-and-authentication | Security and Authentication
You can make full use of the Symfony Security Component to handle complex
authentication/authorization scenarios.
Please be aware that also the Pimcore admin UI uses the Security component, so be careful
when changing/modifying the configuration. | Security and Authentication | [
-0.13551545143127441,
0.1134830117225647,
-0.19749966263771057,
0.00720495730638504,
-0.09925110638141632,
-0.43397659063339233,
0.28792595863342285,
-0.19190546870231628,
-0.15693971514701843,
0.1750858873128891,
-0.09858110547065735,
0.05936789512634277,
0.19299845397472382,
0.1951464861... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Security_Authentication#login-example | Login example
The Demo CMS profile provides a simple login
example using a User Pimcore object and a form_login authenticator which allows a site-wide login with public and
secured areas:
security.yaml
AccountController
A simplified guide to this setup is illustrated in Authenticate against Pimcore Objects.
For more complex examples, custom user providers and a full configuration reference please read the
Symfony Security Component documentation. | Login example | [
-0.002275654813274741,
-0.029868606477975845,
-0.048900797963142395,
-0.11318063735961914,
0.10698763281106949,
-0.38393768668174744,
0.4296627640724182,
-0.42851418256759644,
-0.27177610993385315,
0.20656542479991913,
0.06848400086164474,
-0.16667388379573822,
0.19025520980358124,
0.31392... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#cli-and-pimcore-console | CLI and Pimcore Console
Pimcore can be executed headless and has a very powerful PHP API. As a consequence of these two aspects,
it is possible to automate pretty much every task within Pimcore.
Pimcore implements the Symfony\Console component and provides bin/console as single
entry point to console commands registered to the Symfony\Console application. | CLI and Pimcore Console | [
-0.334004282951355,
-0.2928517162799835,
-0.14000967144966125,
-0.21575234830379486,
-0.24760682880878448,
-0.027519293129444122,
0.0893699899315834,
0.08872117102146149,
-0.14939384162425995,
0.3067847788333893,
-0.0522138848900795,
0.20318816602230072,
0.0438661202788353,
0.0674253329634... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#implementing-own-commands | Implementing Own Commands
Have a look at the Symfony\Console documentation
for details how commands are implemented. However, it makes sense to let your command classes extend
Pimcore\Console\AbstractCommand to get some defaults like a helper for the
Symfony VarDumper Component
set up automatically (see below). | Implementing Own Commands | [
-0.0645122081041336,
-0.1397075057029724,
-0.1185939684510231,
-0.27470260858535767,
0.10548967868089676,
-0.2165416181087494,
0.24713818728923798,
-0.14158737659454346,
-0.37376704812049866,
0.3843425214290619,
-0.12587474286556244,
0.2935160994529724,
0.12534557282924652,
-0.135582983493... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#registering-commands | Registering Commands
Command must be registered as services and tagged with the console.command tag. If you're using the default services.yaml
of Pimcore skeleton (or demos) for configuration, this is already done for you for the App. , thanks to autoconfiguration. | Registering Commands | [
-0.10320926457643509,
-0.2701340317726135,
-0.03534368798136711,
-0.537002444267273,
0.30451714992523193,
-0.11990968883037567,
0.42097538709640503,
-0.10674875229597092,
-0.23772166669368744,
0.2362663447856903,
-0.16551955044269562,
0.4148324131965637,
0.10389585047960281,
0.101624727249... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#helpers-provided-by-pimcore\console\abstractcommand | Helpers Provided By Pimcore\Console\AbstractCommand
The AbstractCommand base class provides helpers which make your life easier. | Helpers Provided By Pimcore\Console\AbstractCommand | [
-0.3612252175807953,
-0.3409593105316162,
-0.20599302649497986,
-0.1318836212158203,
0.0045900847762823105,
-0.13654150068759918,
0.12188208103179932,
0.12412121146917343,
-0.4381137788295746,
0.44860440492630005,
0.09696123003959656,
0.20483610033988953,
-0.10704827308654785,
0.0307914577... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#--ignore-maintenance-mode | --ignore-maintenance-mode
The console application implicitly adds the --ignore-maintenance-mode option to all commands.
Pimcore checks for the option and prevents starting the command if the system is in maintenance
mode and the option is not set. | --ignore-maintenance-mode | [
-0.2118404358625412,
-0.5820161700248718,
-0.07592113316059113,
-0.3109170198440552,
0.07366576790809631,
-0.12694944441318512,
-0.06486286222934723,
-0.11382057517766953,
-0.3845256268978119,
0.29682400822639465,
0.2494150698184967,
0.46122825145721436,
-0.07455576211214066,
-0.0674149841... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#--maintenance-mode | --maintenance-mode
The console application implicitly adds the --maintenance-mode option to all commands.
With this option set, Pimcore is set into maintenance mode while that command is executed. | --maintenance-mode | [
-0.22726944088935852,
-0.5102687478065491,
-0.11778552830219269,
-0.3370165228843689,
0.055212054401636124,
0.029113929718732834,
-0.06859225034713745,
-0.05494232475757599,
-0.44779616594314575,
0.3290615379810333,
0.049978237599134445,
0.5859546065330505,
0.11509346216917038,
-0.13482482... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#dump()-and-dumpverbose() | dump() and dumpVerbose()
Better var_dump through VarDumper. | dump() and dumpVerbose() | [
-0.36695173382759094,
-0.37167826294898987,
-0.2349807620048523,
0.17140869796276093,
0.18297840654850006,
-0.2643219530582428,
-0.03285524621605873,
0.27518221735954285,
-0.06814009696245193,
0.2099030762910843,
-0.14527784287929535,
0.2779281437397003,
-0.08188258856534958,
-0.1492430716... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#example | Example
<?php
namespace App\Command;
use Pimcore\Console\AbstractCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AwesomeCommand extends AbstractCommand
{
protected function configure(): void
{
$this
->setName('awesome:command')
->setDescription('Awesome command');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
// dump
$this->dump("Isn't that awesome?");
// add newlines through flags
$this->dump("Dump #2");
// only dump in verbose mode
$this->dumpVerbose("Dump verbose");
// Output as white text on red background.
$this->writeError('oh noes!');
// Output as green text.
$this->writeInfo('info');
// Output as blue text.
$this->writeComment('comment');
// Output as yellow text.
$this->writeQuestion('question');
}
}
| Example | [
-0.1968490183353424,
-0.37737056612968445,
-0.1173277273774147,
0.046438440680503845,
0.14802977442741394,
-0.345753937959671,
0.151797354221344,
0.2744239866733551,
-0.343488872051239,
0.3263443410396576,
0.04995163157582283,
0.2716294229030609,
0.059798095375299454,
-0.11696185171604156,... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#usage | Usage
Call bin/console list script from the command line to get a list of available commands. To call
a command, use bin/console <subcommand>.
Be sure to run the console with the PHP user to prevent writing permissions issues later by switching to the appropriate user, for instance on Debian system su -l www-data -s /bin/bash.
| Usage | [
-0.04944580793380737,
-0.09341985732316971,
-0.30002880096435547,
-0.00938326958566904,
-0.005634534638375044,
-0.07641072571277618,
0.12491365522146225,
0.16578827798366547,
-0.16942285001277924,
0.33622923493385315,
0.13312460482120514,
-0.1289423406124115,
-0.05016281455755234,
-0.08637... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Console_CLI#examples: | Examples:
# get a list of all registered commands
$ ./bin/console list
# call the foo:bar command
$ ./bin/console foo:bar
| Examples: | [
-0.02888701856136322,
-0.2547025680541992,
-0.22854170203208923,
-0.27271074056625366,
-0.09250853210687637,
0.07139237970113754,
0.3667556643486023,
0.3336479365825653,
-0.05973408371210098,
0.1759176403284073,
0.09277237206697464,
0.10327309370040894,
-0.16189952194690704,
-0.03879716619... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#debugging-pimcore | Debugging Pimcore
In this chapter, a few insights, tips and tricks for debugging Pimcore are shown. This should give you a
head start when developing with Pimcore. | Debugging Pimcore | [
-0.07026109844446182,
-0.2931203544139862,
-0.1593162566423416,
0.17834770679473877,
0.03462304547429085,
-0.41348814964294434,
0.17861928045749664,
-0.22188661992549896,
-0.4568728506565094,
0.22332562506198883,
-0.11600011587142944,
0.4279136657714844,
0.09693402796983719,
0.167044252157... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#debug-mode | Debug Mode
In order to include some specific debugging tools (profiler, toolbar, ...), Pimcore relies on environment
variable APP_ENV in .env file in your project root directory. APP_ENV=dev
Additionally you can set the debug flag on the kernel by using APP_DEBUG=1.
More details on that see Symfony docs | Debug Mode | [
-0.367480993270874,
-0.3058220148086548,
-0.09575760364532471,
0.026417851448059082,
0.09222035855054855,
-0.0799742192029953,
0.19256725907325745,
0.05414624139666557,
-0.24384762346744537,
0.360739529132843,
-0.14926104247570038,
0.5009679198265076,
0.08199477195739746,
0.085463240742683... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#dev-mode | Dev Mode
The development mode enables some debugging features. This is useful if you're developing on the core of Pimcore or when
creating a bundle. Please don't activate it in production systems!
What exactly does the dev mode:
Loading the source javascript files (uncompressed & commented)
Disables some caches (Cache, ...)
extensive logging into log files
... and some more little things
Add the following line to your .env file to enable dev mode.
PIMCORE_DEV_MODE=true | Dev Mode | [
-0.45056959986686707,
-0.5407741069793701,
-0.25164204835891724,
-0.23661287128925323,
0.03848912566900253,
-0.05228184908628464,
0.16059166193008423,
0.16548915207386017,
-0.24292360246181488,
0.3428332209587097,
-0.0007257581455633044,
0.30314987897872925,
0.10355909913778305,
0.26566272... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#server-side-debugging | Server-Side Debugging
For server side debugging, standard php and Symfony framework debugging tools like the following can be used.
Reading log files as described here
Using Symfony profiler console depending on the active environment.
Details see Symfony docs
Using Xdebug and a proper IDE for stepwise debugging, more information see Xdebug docs
| Server-Side Debugging | [
-0.27454933524131775,
-0.2042216807603836,
-0.1514199823141098,
0.2855527102947235,
-0.07248362898826599,
-0.22651605308055878,
0.2942027747631073,
0.13205990195274353,
-0.08596096932888031,
0.16177572309970856,
0.11112771928310394,
0.07955756038427353,
-0.20920026302337646,
0.110730312764... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#client-side-debugging | Client-Side Debugging
For proper debugging of Pimcore backend UI activate the DEV-Mode in system settings.
By doing so, all javascript files are delivered uncompressed and commented. Thus debugging tools provided by browsers
(like actual error lines, debugger, stack trace, etc.) can be used. | Client-Side Debugging | [
-0.17093011736869812,
-0.3401198983192444,
-0.11899065971374512,
-0.057344403117895126,
0.11839407682418823,
-0.24993088841438293,
0.3310405910015106,
0.2623105049133301,
-0.19502972066402435,
0.2592962682247162,
-0.019691694527864456,
0.5986886620521545,
0.2902495265007019,
0.169514909386... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Debugging#http-headers | HTTP Headers
Pimcore might add following headers to its responses to provide additional debug information, especially concerning full
page cache:
If response is delivered directly from full page cache:
X-Pimcore-Output-Cache-Tag:output_<SOME_HASH>: Cache tag of delivered information.
X-Pimcore-Cache-Date:<CACHE_DATE>: Date when information was stored to cache.
If response could be delivered from full page cache, but is not:
X-Pimcore-Output-Cache-Disable-Reason:<SOME REASON>: Describes reason why response is not delivered directly from full
page cache. Reasons can be in debug mode, backend user is logged in, exclude path patter in system-settings matches,
exclude cookie in system-setings matches, etc.
One additional header to identify that response is sent by Pimcore.
X-Powered-By:pimcore: Added to every request.
| HTTP Headers | [
-0.12245408445596695,
-0.4516037702560425,
-0.1330633908510208,
0.052882466465234756,
0.034395746886730194,
-0.12764060497283936,
-0.03898613527417183,
0.11304713785648346,
-0.16422230005264282,
0.1351926177740097,
0.027294643223285675,
0.36695560812950134,
0.35792383551597595,
-0.10852627... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#magic-parameters | Magic Parameters
Pimcore supports some magic parameters which can be added as parameter to every request. | Magic Parameters | [
-0.28134214878082275,
-0.3705078363418579,
-0.2797982096672058,
-0.1965797394514084,
0.06685581058263779,
-0.5397698283195496,
0.06355742365121841,
0.12371516227722168,
-0.36518558859825134,
0.19259949028491974,
-0.019801173359155655,
0.4397338330745697,
-0.059308718889951706,
0.1907223761... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#pimcore_nocache | pimcore_nocache
Setting this parameter disables every kind of cache, eg.: http://www.example.com/my/page?pimcore_nocache
This parameter only works if DEBUG MODE is on. | pimcore_nocache | [
-0.2620123028755188,
-0.3840738832950592,
-0.17256368696689606,
-0.16666802763938904,
-0.10179965198040009,
-0.026145175099372864,
0.022531038150191307,
0.3359048068523407,
-0.1884472817182541,
0.22464054822921753,
-0.052096590399742126,
0.16916720569133759,
0.2404632717370987,
-0.12841762... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#pimcore_outputfilters_disabled | pimcore_outputfilters_disabled
Disables all output filters, incl. the output-cache. But this doesn't disable the internal object cache,
eg.: http://www.example.com/my/page?pimcore_outputfilters_disabled=1
This parameter only works if DEBUG MODE is on. | pimcore_outputfilters_disabled | [
-0.22149710357189178,
-0.3478527367115021,
-0.12744508683681488,
-0.052973367273807526,
0.020072001963853836,
-0.18845009803771973,
0.05897512286901474,
0.23451773822307587,
0.04319784790277481,
0.200383260846138,
-0.3626788854598999,
0.473989874124527,
0.13138793408870697,
-0.040871106088... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#unminified_js | unminified_js
Disables the JavaScript minifier. Useful for ExtJS debugging. Disabled by default if in DEV MODE.
This parameter only works if DEBUG MODE is on. | unminified_js | [
-0.15977801382541656,
-0.6052138209342957,
-0.1309742033481598,
-0.2760169506072998,
0.2667689919471741,
0.041353579610586166,
0.5025292634963989,
0.21050404012203217,
-0.32017695903778076,
0.3267039358615875,
0.180166095495224,
0.3127783536911011,
0.037012387067079544,
0.22801893949508667... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#pimcore_disable_host_redirect | pimcore_disable_host_redirect
Disables the "redirect to main domain" feature. This is especially useful when using Pimcore behind
a reverse proxy. | pimcore_disable_host_redirect | [
-0.2041446417570114,
-0.5110629796981812,
-0.09051039069890976,
-0.42294344305992126,
-0.0318533331155777,
-0.19233490526676178,
0.19678953289985657,
0.03597774729132652,
-0.11958490312099457,
0.2156073898077011,
-0.4359695613384247,
0.03341764584183693,
0.2701525390148163,
0.0307341404259... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Magic_Parameters#pimcore_debug_translations | pimcore_debug_translations
Configures the translator to return the given translation key instead of actually translating the message. This can be
useful to debug translations or to get an overview over used translation keys. Example: http://www.example.com/my/page?pimcore_debug_translations=1
This parameter is only available when debug mode is active or an active admin session is present.
It is possible to disable this feature completely or individualize the name of the GET parameter using the
following configuration options.
pimcore:
translations:
debugging:
enabled: false
# you could also change the parameter from pimcore_debug_translations to something else
parameter: my_custom_parameter
| pimcore_debug_translations | [
-0.026549480855464935,
-0.43809667229652405,
-0.10977233946323395,
0.143112450838089,
0.01510066632181406,
-0.1996493637561798,
0.15785130858421326,
0.19316774606704712,
-0.3877876102924347,
0.40304768085479736,
0.08665202558040619,
0.2537802755832672,
0.3665724992752075,
-0.21531459689140... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#static-helpers | Static Helpers
Pimcore offers some static helpers: | Static Helpers | [
-0.24318349361419678,
-0.4514511227607727,
-0.2835644781589508,
-0.19288843870162964,
0.038930829614400864,
-0.1978427916765213,
0.46952030062675476,
0.15133224427700043,
-0.187421515583992,
0.1881522387266159,
-0.046819984912872314,
0.30580273270606995,
-0.153980553150177,
-0.099971689283... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#pimcore-tool | Pimcore Tool
The Pimcore\Tool class is a collection of general service methods. Their names should be self-explaining, just have a look at the class source file.
Particular useful can be following methods:
isValidPath()
getValidLanguages()
getHostname()
getHostUrl()
classExists()
getMail()
| Pimcore Tool | [
-0.07319890707731247,
-0.4186152517795563,
-0.1505913883447647,
0.28655514121055603,
0.11431022733449936,
0.04245016723871231,
0.008495011366903782,
0.16879026591777802,
-0.2896507680416107,
0.0902395024895668,
-0.03888393193483353,
0.41303008794784546,
0.05213448405265808,
-0.035106733441... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#e-mail | E-Mail
There is a convenience function which allows any Pimcore system component or plugin to use a
preconfigured Symfony\Component\Mime\Email instance based on the Pimcore system settings' email configuration.
$mail = Pimcore\Tool::getMail($recipients, $subject);
// For any plugin or website applications it might be convenient to use this mail configuration instead of having to care for these settings themselves.
| E-Mail | [
-0.191661074757576,
-0.22605232894420624,
-0.05478522554039955,
0.2552332580089569,
0.10729183256626129,
-0.09834597259759903,
0.27807217836380005,
0.09662295132875443,
-0.07243818789720535,
0.35232940316200256,
-0.08374668657779694,
0.2155517041683197,
0.06534701585769653,
0.2198828160762... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#element-service | Element Service
The Pimcore\Model\Element\Service class is a collection of service methods for elements (documents, assets, objects).
Their names should be self-explaining, just have a look at the class source file.
Particular useful can be following methods:
getElementByPath()
getSafeCopyName()
pathExists()
getElementById()
getElementType()
createFolderByPath()
getValidKey()
Also have a look at the sub classes Pimcore\Model\Asset\Service, Pimcore\Model\Document\Service and
Pimcore\Model\DataObject\Service. | Element Service | [
0.023124339058995247,
-0.2471592277288437,
-0.19069430232048035,
0.26453298330307007,
0.18846653401851654,
0.03176860138773918,
0.18741244077682495,
0.004786086268723011,
-0.15004196763038635,
0.009621967561542988,
0.0002903060521930456,
0.39888063073158264,
0.03320058807730675,
0.30170005... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#document-service | Document-Service
A useful service method for documents is Pimcore\Model\Document\Service::render().
You can use this helper to render a page outside of a view, for example to send mails. | Document-Service | [
-0.218683123588562,
-0.37786203622817993,
-0.08010029792785645,
0.016496757045388222,
-0.11464057117700577,
-0.07385814189910889,
0.08873225748538971,
0.3058689832687378,
-0.03240794688463211,
0.04047973081469536,
0.10776200890541077,
0.47543781995773315,
0.2312217652797699,
0.134679391980... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Helpers#example: | Example:
$optionalParams = ['foo' => 'bar', 'hum'=>'bug'];
$useLayout = true;
$content = Document\Service::render(Document::getById(2), $optionalParams, $useLayout);
echo $content;
| Example: | [
0.07794494181871414,
-0.6060985326766968,
-0.19377076625823975,
0.039098069071769714,
-0.16406580805778503,
-0.09638433903455734,
0.19208848476409912,
0.301709920167923,
-0.014554401859641075,
0.30260559916496277,
0.3471103608608246,
0.19855594635009766,
-0.006580122746527195,
-0.258847564... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/UUID_Support#uuid-support | UUID Support
Note
This feature requires UUID bundle to be active. Please make sure that you have \Pimcore\Bundle\UuidBundle\PimcoreUuidBundle::class entry in your config/bundles.php and make sure that the bundle is installed and enabled.
Pimcore provides a toolkit for UUID-support. To activate the UUID-support, an instance identifier
has to be set manually in the config.yaml file.
pimcore_uuid:
instance_identifier: 'your_unique_instance_identifier'
Once set, Pimcore automatically creates an UUID for each newly created document, asset, class and object.
With the class Tool\UUID you have access to the UUIDs as follows:
use Pimcore\Bundle\UuidBundle\Model\Tool;
//get UUID for given element (document, asset, class, object)
$uuid = Tool\UUID::getByItem($document);
//get element for given UUID
$document = Tool\UUID::getByUuid($uuid);
//create and save uuid for given element
$uuid = Tool\UUID::create($document);
| UUID Support | [
-0.2701447308063507,
-0.1765698492527008,
-0.08764959871768951,
0.07039567083120346,
0.15295644104480743,
-0.0957598090171814,
0.5300824642181396,
-0.050828855484724045,
-0.3466954529285431,
0.32228219509124756,
-0.05877934768795967,
0.3624997138977051,
-0.17622044682502747,
0.108147569000... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#static-page-generator | Static Page Generator
Pimcore offers a Static Page Generator service, which is used to generate HTML pages from Pimcore documents. This generator service works by taking a Pimcore document with content and templates and renders them into a full HTML page, that can served directly from the server without the intervention of templating engine. | Static Page Generator | [
0.055105093866586685,
-0.5174928307533264,
-0.05620584636926651,
0.10296397656202316,
-0.1451956331729889,
-0.09543938934803009,
0.05788020044565201,
-0.0062554157339036465,
-0.4482668936252594,
0.09530630707740784,
-0.04792971909046173,
0.4239056706428528,
0.2369813770055771,
0.1556004136... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#enable-static-page-generator-for-a-document | Enable Static Page generator for a Document
To enable automatic static page generation on document save or by CLI command, go to Document -> Settings -> Satic Page Generator.
Mark enable checkbox and define optional lifetime for static pages (which regenerates static page after lifetime) and save document.
Once, the static page generator is enabled, the document icon changes to grey icon:
and last generated information is displayed in document settings, when the generation is requested from frontend or cli command.
In addition, if you are using default local storage for static pages, then make sure your project .htaccess has this below section (after the # Thumbnails section), which is responsible for looking up static page before passing to templating engine.
# static pages
SetEnvIf Request_URI ^(.*)$ STATIC_PAGE_URI=$1
SetEnvIf Request_URI / STATIC_PAGE_URI=/%home
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)
RewriteCond %{QUERY_STRING} !(pimcore_editmode=true|pimcore_preview|pimcore_version)
RewriteCond %{DOCUMENT_ROOT}/var/tmp/pages%{STATIC_PAGE_URI}.html -f
RewriteRule ^(.*)$ /var/tmp/pages%{STATIC_PAGE_URI}.html [PT,L]
If you are using NGINX as web server, this must be added before the server block
map $args $static_page_root {
default /var/tmp/pages;
"~*(^|&)pimcore_editmode=true(&|$)" /var/nonexistent;
"~*(^|&)pimcore_preview=true(&|$)" /var/nonexistent;
"~*(^|&)pimcore_version=[^&]+(&|$)" /var/nonexistent;
}
map $uri $static_page_uri {
default $uri;
"/" /%home;
}
and the following modification must be done to the location block that matches all requests
server {
...
location / {
error_page 404 /meta/404;
try_files $static_page_root$static_page_uri.html $uri /index.php$is_args$args;
}
...
}
| Enable Static Page generator for a Document | [
-0.2033361941576004,
-0.247110053896904,
-0.15885592997074127,
-0.12049973756074905,
-0.04035378247499466,
-0.17626401782035828,
0.13751842081546783,
0.3780146539211273,
-0.35076233744621277,
0.21329627931118011,
0.050752993673086166,
0.23788055777549744,
0.29175350069999695,
0.05354091152... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#processing | Processing
Once the static generator option is enabled, Pimcore generates static pages on following actions:
First request to the page, after updating and saving the document in admin.
Maintenance job
CLI command
In background, maintenance job takes care of generating static pages for documents on regular intervals. However, you can also use CLI command to generate static pages on demand:
php bin/console pimcore:documents:generate-static-pages
also, you can filter the documents by parent path, which should processed for static generation:
php bin/console pimcore:documents:generate-static-pages -p /en/Magazine | Processing | [
-0.03930709883570671,
-0.20953530073165894,
-0.06347589939832687,
0.007323203608393669,
-0.18746612966060638,
-0.13417503237724304,
0.04030866548418999,
-0.0676814466714859,
-0.5422239303588867,
0.14262455701828003,
-0.00009639358904678375,
0.444314569234848,
0.29833871126174927,
-0.166690... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#storage | Storage
By default, Pimcore stores the generated HTML pages on local path: 'document_root/public/var/tmp/pages'.
It is possible to customize the local storage path for static pages by defining Flysystem config in config.yaml:
flysystem:
storages:
pimcore.document_static.storage:
# Storage for generated static document pages, e.g. .html files generated out of Pimcore documents
# which are then delivered directly by the web-server
adapter: 'local'
visibility: public
options:
directory: '%kernel.project_dir%/public/var/tmp/pages'
| Storage | [
-0.046766869723796844,
-0.23998206853866577,
-0.11261078715324402,
0.15309149026870728,
0.06028950959444046,
-0.09095407277345657,
0.11214271932840347,
0.0738239511847496,
-0.2755597233772278,
0.02121005393564701,
-0.2973270118236542,
0.43656089901924133,
0.1555958241224289,
0.065892107784... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#static-page-generate-router | Static Page Generate Router
In case, you are using custom remote storage for static pages and need to serve pages from this remote location, then you would need to enable the static page router with following configuration in config.yaml:
pimcore:
documents:
static_page_router:
enabled: true
route_pattern: '@^/(en/Magazine|de/Magazin)@'
config
Description
enabled
Set it true to enable Static Page Router
route_pattern
Regular expression to match routes for static page rendering
| Static Page Generate Router | [
0.028295425698161125,
-0.42741838097572327,
-0.01939794048666954,
-0.10768299549818039,
0.12624123692512512,
-0.26077234745025635,
0.2247397005558014,
0.07622872292995453,
-0.46244561672210693,
0.12260189652442932,
-0.09253312647342682,
0.39437174797058105,
0.4333416521549225,
0.0695689022... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Static_Page_Generator#static-page-generation-with-ajax-request | Static Page Generation With Ajax Request
The static pages with XMLHttpRequest fetches the data and displays it on the page, just like a standard document page.
However, if you are using the Fetch API to request the data, then must add the XMLHttpRequest header as shown below,
otherwise the sub-request will replace the content of the generated static page.
fetch('/test/page', {
headers: {
'X-Requested-With': 'XMLHttpRequest',
}
})
| Static Page Generation With Ajax Request | [
0.2383001297712326,
-0.6469048261642456,
-0.15366406738758087,
0.17349873483181,
-0.09912911057472229,
-0.1904577612876892,
0.026725344359874725,
0.19828057289123535,
0.05933866277337074,
0.052311938256025314,
0.02378653921186924,
0.42876577377319336,
0.5337591767311096,
-0.389946848154068... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Adaptive_Design_Helper#adaptive-design-helper | Adaptive Design Helper
The DeviceDetector helper makes it easy to implement the adaptive design approach in Pimcore. | Adaptive Design Helper | [
-0.4131569266319275,
-0.5322349667549133,
-0.25146928429603577,
-0.11464089900255203,
0.022258184850215912,
-0.3767601251602173,
0.5150302648544312,
-0.1422886848449707,
-0.25456756353378296,
0.3890232443809509,
0.027590403333306313,
0.5280629992485046,
-0.14929388463497162,
0.224645853042... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Adaptive_Design_Helper#using-it-anywhere-in-your-code | Using It Anywhere in Your Code
use Pimcore\Tool\DeviceDetector;
use Symfony\Component\HttpFoundation\Response;
class TestController extends Action
{
public function testAction(): Response
{
$device = DeviceDetector::getInstance();
$device->getDevice(); // returns "phone", "tablet" or "desktop"
if($device->isDesktop() || $device->isTablet()) {
// do something
}
// ...
}
}
| Using It Anywhere in Your Code | [
-0.22298310697078705,
-0.5998651385307312,
-0.2886672914028168,
0.03997655585408211,
0.16275538504123688,
-0.2985104024410248,
0.306277871131897,
0.1276918202638626,
0.06263332813978195,
0.12346633523702621,
0.042421724647283554,
0.09948879480361938,
0.16130433976650238,
-0.059380304068326... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Adaptive_Design_Helper#force-a-device-type | Force a Device Type
Sometimes it's necessary to force a device type. A typical use case is a "Back to Desktop Version"
or vice versa link.
To do so, just add the parameter forceDeviceType to your request:
/your/link?forceDeviceType=desktop
/another/link?forceDeviceType=tablet
/a/mobile/link?forceDeviceType=phone
This will set the device to the specified value and Pimcore will remember this setting using a
cookie (name: forceDeviceType) till the browser session ends. | Force a Device Type | [
-0.058313652873039246,
-0.4686940312385559,
-0.04383954778313637,
-0.2865365743637085,
0.12352818995714188,
-0.3899644911289215,
0.41671043634414673,
-0.09360886365175247,
-0.10147901624441147,
-0.05872297286987305,
-0.16894611716270447,
0.11405612528324127,
0.28288957476615906,
-0.0735389... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Adaptive_Design_Helper#caching | Caching
The Pimcore output-cache is aware of this feature and just works as expected.
If you're using a caching proxy like Varnish you have to take the value of the cookie
forceDeviceType into the hash calculation, otherwise there's just one hash for different contents
of an URL (phone, tablet, desktop). | Caching | [
-0.0018148015951737761,
-0.40822458267211914,
-0.15064948797225952,
-0.08315324038267136,
0.15407176315784454,
-0.3807309865951538,
0.6686989068984985,
-0.031916357576847076,
0.017476601526141167,
-0.02317972294986248,
-0.2991367280483246,
0.03578250855207443,
0.17083603143692017,
0.006726... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework/Pimcore_Mail#pimcore-mail | Pimcore Mail
The Pimcore\Mail Class extends the Symfony\Component\Mime\Email
Class and adds some features for the usage with Pimcore.
If email settings are configured in your config/config.yaml then on initializing
Pimcore\Mail object, these settings applied automatically. It is required to configure email settings prior to using Pimcore\Mail.
The Pimcore\Mail Class automatically takes care of the nasty stuff (embedding CSS,
normalizing URLs and Twig expressions ...). Note that all CSS files are embedded
to the html with a <style> tag because the image paths are also normalised. | Pimcore Mail | [
0.12223128229379654,
-0.3970232903957367,
0.013615475967526436,
0.16907252371311188,
0.07435828447341919,
0.0889933705329895,
0.27085980772972107,
0.05361675098538399,
-0.02143632248044014,
0.22805537283420563,
0.05667020007967949,
0.19948416948318481,
-0.042305540293455124,
-0.01164043974... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework/Pimcore_Mail#useful-methods | Useful Methods
Method
Description
disableLogging()
Disables email logging - by default it is enabled
setParams(array)
Sets the parameters to the request object and the Twig engine
setParam($key, $value)
Sets a single parameter to the request object and the Twig engine
isValidEmailAddress(emailAddress)
Static helper to validate a email address
setDocument(Document_Email)
Sets the email document
getDocument()
Returns the Document
getSubjectRendered()
Renders the content as a Twig template with the provided params and returns the resulting Subject
getBodyHtmlRendered()
Renders the content as a Twig template with the content and returns the resulting HTML
getBodyTextRendered()
Renders the content as a Twig template with the content and returns the resulting text if a text was set with $mail->text(). If no text was set, a text version on the html email will be automatically created
| Useful Methods | [
0.2091885656118393,
-0.25992611050605774,
-0.00396231934428215,
0.28620851039886475,
-0.018557416275143623,
-0.01205658633261919,
0.2644784152507782,
0.27914243936538696,
-0.05307844653725624,
0.15991976857185364,
0.08211226761341095,
0.16912013292312622,
-0.21949206292629242,
-0.218771889... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework/Pimcore_Mail#usage-example | Usage Example
$params = ['firstName' => 'Pim', 'lastName' => 'Core', 'product' => 73613];
//sending an email document (pimcore document)
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->setDocument('/email/myemaildocument');
$mail->setParams($params);
$mail->send();
// sending a text-mail
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->text("This is just plain text");
$mail->send();
// Sending a rich text (HTML) email with Twig expressions
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->bcc("bcc@pimcore.org");
$mail->setParams([
'myParam' => 'Just a simple text'
]);
$mail->html("<b>some</b> rich text: {{ myParam }}");
$mail->send();
//adding an asset as attachment
if($asset instanceof Asset) {
$mail->attach($asset->getData(), $asset->getFilename(), $asset->getMimeType());
}
//Embedding Images
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->embed($asset->getData(), 'logo', $asset->getMimeType());
//or
$mail->embedFromPath($asset->getRealFullPath(), 'logo', $asset->getMimeType());
$mail->html("Embedded Image: <img src='cid:logo'>"); //image name(passed second argument in embed) as ref
$mail->send();
| Usage Example | [
-0.2570808231830597,
-0.38435161113739014,
-0.14246255159378052,
0.44845572113990784,
0.1144072413444519,
-0.24530263245105743,
0.36193323135375977,
0.2763480842113495,
-0.1726471334695816,
0.3382081687450409,
0.1181800588965416,
0.30225956439971924,
0.08326293528079987,
-0.039352543652057... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#email-framework | Email Framework | Email Framework | [
0.20895949006080627,
-0.28521794080734253,
-0.22356802225112915,
0.37524327635765076,
-0.012150580994784832,
-0.035941943526268005,
0.3869185149669647,
-0.14071275293827057,
0.04253499209880829,
0.2677471339702606,
0.24627096951007843,
-0.27698764204978943,
-0.29697278141975403,
0.39320531... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#general-information | General Information
The Pimcore Email Framework provides an easy way to send/create emails with Pimcore.
For this you have several components:
Document\Email
Pimcore\Mail
Pimcore provides a Pimcore\Mail Class which extends the \Symfony\Component\Mime\Email Class.
If email settings are configured in your config/config.yaml then on initializing
Pimcore\Mail object, these settings applied automatically
It is recommended to configure email settings in config/config.yaml file:
pimcore:
email:
sender:
name: 'Pimcore Demo'
email: demo@pimcore.com
return:
name: ''
email: ''
and debug email addresses should be configured in Admin Settings > System > Debug > Debug Email Addresses.
If the Debug Mode is enabled, all emails will be sent to the
Debug Email recipients defined in Settings > System > Debug > Debug Email Addresses.
Additionally the debug information (to whom the email would have been sent) is appended to the email
and the Subject contains the prefix "Debug email:".
This is done by extending Symfony Mailer, with injected service RedirectingPlugin, which calls beforeSendPerformed before mail is sent and sendPerformed immediately after email is sent.
Emails are sent via transport and \Pimcore\Mailer requires transports: main for sending emails and pimcore_newsletter for sending newsletters(if newsletter specific settings are used and PimcoreNewsletterBundle is enabled and installed), which needs to be configured in your config.yaml e.g.,
framework:
mailer:
transports:
main: smtp://user:pass@smtp.example.com:port
pimcore_newsletter: smtp://user:pass@smtp.example.com:port
Please refer to the Transport Setup for further details on how this can be set up.
Pimcore provides a Document Email type where you can define the recipients ... (more information
here) and Twig variables.
To send a email you just create a Email Document in the Pimcore Backend UI, define the subject,
recipients, add Dynamic Placeholders... and pass this document to the Pimcore\Mail object. All
nasty stuff (creating valid URLs, embedding CSS, compile Less files, rendering the document..) is
automatically handled by the Pimcore\Mail object.
In the Settings section of the Email Document you can use Full Username <user@domain.fr> or Full Username (user@domain.fr) to set full username. | General Information | [
0.11383239179849625,
-0.10973040759563446,
0.04696984216570854,
0.2703709900379181,
0.0194692425429821,
-0.32469433546066284,
0.31853243708610535,
-0.15371157228946686,
-0.2222539782524109,
0.1887424737215042,
-0.008224856108427048,
0.304476797580719,
0.02927388809621334,
0.099034123122692... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#usage-example | Usage Example
Lets assume that we have created a Email Document in the Pimcore Backen UI (/email/myemaildocument)
which looks like this:
To send this document as email we just have to write the following code-snippet in our controller
action:
//dynamic parameters
$params = array('firstName' => 'Pim',
'lastName' => 'Core',
'product' => \Pimcore\Model\DataObject::getById(73613)
);
//sending the email
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->setDocument('/email/myemaildocument');
$mail->setParams($params);
$mail->send();
you can access the parameters in your mail content.
Hello {{ firstName }} {{ lastName }}
Regarding the product {{ product.getName() }} ....
| Usage Example | [
-0.08290786296129227,
0.03773144632577896,
-0.07026435434818268,
0.1252593845129013,
-0.11776280403137207,
-0.5060598850250244,
0.4065719246864319,
0.1398802548646927,
-0.5311546921730042,
0.12479792535305023,
0.12918946146965027,
0.36141711473464966,
0.08908708393573761,
0.188128903508186... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#sending-a-plain-text-email: | Sending a Plain Text Email:
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->text("This is just plain text");
$mail->send();
| Sending a Plain Text Email: | [
-0.22866961359977722,
-0.350913941860199,
-0.0889175683259964,
0.15997761487960815,
0.06432168930768967,
-0.27499091625213623,
0.1773383617401123,
0.08200058341026306,
-0.18324153125286102,
0.4288336932659149,
0.3208189904689789,
0.1903274953365326,
-0.00656389445066452,
0.2914767265319824... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#sending-a-rich-text-(html)-email: | Sending a Rich Text (HTML) Email:
$mail = new \Pimcore\Mail();
$mail->to('example@pimcore.org');
$mail->bcc("bcc@pimcore.org");
$mail->html("<b>some</b> rich text");
$mail->send();
| Sending a Rich Text (HTML) Email: | [
-0.3294913172721863,
-0.3590905964374542,
-0.07892688363790512,
0.31318143010139465,
0.1548987627029419,
-0.1991875022649765,
0.10714703053236008,
0.14381857216358185,
0.15824642777442932,
0.5404859185218811,
0.20529872179031372,
0.11307993531227112,
-0.14814640581607819,
0.433246612548828... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Email_Framework#sandbox-restrictions | Sandbox Restrictions
Sending mails renders user controlled twig templates in a sandbox with restrictive
security policies for tags, filters & functions. Please use following configuration to allow more in template rendering:
pimcore:
templating_engine:
twig:
sandbox_security_policy:
tags: ['if']
filters: ['upper']
functions: ['include', 'path']
| Sandbox Restrictions | [
-0.14254584908485413,
-0.41441065073013306,
-0.06391613930463791,
0.2858662009239197,
0.38196903467178345,
-0.3863675594329834,
0.2524162232875824,
0.3020462095737457,
0.055836908519268036,
0.23290622234344482,
-0.12907467782497406,
0.394817978143692,
0.09548964351415634,
0.195736110210418... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Application_Testing#application-testing | Application Testing
Pimcore applications can be tested with any PHP testing solution, but this page demonstrates 2 viable approaches:
Symfony's default testing setup with PHPUnit
Codeception (which is based on PHPUnit) for more advanced features like Selenium testing by using Codeception's module system
In general it's recommended to start with the first approach as it is simpler to set up and to get started with testing. Note, however, that the PHPUnit setup does not include any out-of-the-box solution how to prepare your application for tests (e.g. how to make sure you are always testing with the same reproducible data set), so that's up to you. You could prepare test data in your bootstrap file or run some script before you start the test suite.
In addition to Codeception's general features, Pimcore's Codeception modules provide a set of helpers to bootstrap a Pimcore installation from an empty installation. The Pimcore module is able to drop and re-create the database and addtional modules like the ClassManager provide helper code to create Pimcore classes from JSON exports. As the DB initialization is configurable, you should be able to use the module as you need it (e.g. by bootstrapping your application yourself or by just running tests without any DB/data initialization logic. You can find examples how to use those modules by looking through Pimcore's test setup. | Application Testing | [
-0.37420588731765747,
-0.09210899472236633,
-0.19206596910953522,
0.023468613624572754,
-0.2157580554485321,
-0.12946312129497528,
0.13624213635921478,
0.10344493389129639,
-0.18732775747776031,
0.20490625500679016,
0.06762920320034027,
0.3359287977218628,
-0.002644977532327175,
0.01620722... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Application_Testing#phpunit | PHPUnit
As Pimcore is a standard Symfony application, you can use Symfony's PHPUnit testing setup exactly as described in
Symfony's Testing Documentation. All you need to do is to create a custom
bootstrap file to ensure the Pimcore startup process has everything it needs. Start by adding Symfony's PHPUnit bridge
to your project:
$ composer require --dev 'symfony/phpunit-bridge:*'
With symfony/phpunit-bridge comes vendor/bin/simple-phpunit which uses its own PHPUnit version. For simple-phpunit to use the right version, you need to exclude phpunit from the autoloader's classmap and afterwards update the autoloader with composer dump-autoload -o
"autoload": {
...
"exclude-from-classmap": [
"vendor/phpunit"
]
}
Next, add a PHPUnit config file named phpunit.xml.dist in the root directory of your project. The config file below
expects your tests in a tests/ directory and processes files in src/ when calculating code coverage reports.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
<filter>
<allowlist processUncoveredFilesFromAllowlist="true">
<directory suffix=".php">src</directory>
</allowlist>
</filter>
<php>
<env name="SYMFONY_PHPUNIT_VERSION" value="7.4" />
</php>
</phpunit>
Now we're ready to write a first test. Assuming we have an App\Calculator class which has an add(int $a, int $b): int
method, add a test in tests/App/CalculatorTest.php. It is not necessary but recommended to resemble the directory
structure from your application code in your test directory.
<?php
// tests/App/CalculatorTest.php
namespace Tests\App;
use App\Calculator;
use PHPUnit\Framework\TestCase;
class CalculatorTest extends TestCase
{
private Calculator $calculator;
protected function setUp(): void
{
$this->calculator = new Calculator();
}
public function testAdd(): void
{
$this->assertEquals(15, $this->calculator->add(10, 5));
}
/**
* @dataProvider addDataProvider
*/
public function testAddWithProvider(int $a, int $b, int $expected): void
{
$this->assertEquals($expected, $this->calculator->add($a, $b));
}
public function addDataProvider(): array
{
return [
[1, 2, 3],
[10, 5, 15],
[-5, 5, 0],
[5, -5, 0],
[0, 10, 10],
[-50, -50, -100],
[-50, 10, -40]
];
}
}
This is everything you need to write simple unit tests which do not depend on Pimcore's environment. Just run the tests
with Symfony's PHPUnit wrapper:
$ vendor/bin/simple-phpunit
PHPUnit 7.4.5 by Sebastian Bergmann and contributors.
Testing default
........ 8 / 8 (100%)
Time: 174 ms, Memory: 10.00MB
OK (8 tests, 8 assertions)
| PHPUnit | [
-0.6776545643806458,
0.018553845584392548,
-0.12130569666624069,
-0.13518176972866058,
-0.12288957089185715,
-0.15002508461475372,
0.2696789801120758,
0.1364627182483673,
-0.20113129913806915,
0.24874630570411682,
-0.09122873842716217,
0.32570475339889526,
-0.09917773306369781,
0.125387743... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Application_Testing#bootstrapping-pimcore | Bootstrapping Pimcore
If you want to write more advanced tests involving Pimcore objects or Symfony's container - e.g. functional tests testing
controllers - you need to make sure Pimcore is properly bootstrapped before tests are run. Alter the config file to point
to a custom bootstrap file and to add environment variables needed to bootstrap the application:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true">
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
<filter>
<allowlist processUncoveredFilesFromAllowlist="true">
<directory suffix=".php">src</directory>
</allowlist>
</filter>
<php>
<!-- adjust as needed -->
<env name="SYMFONY_PHPUNIT_VERSION" value="7.4" />
<env name="PIMCORE_PROJECT_ROOT" value="." />
<env name="KERNEL_DIR" value="app" />
<env name="KERNEL_CLASS" value="AppKernel" />
</php>
</phpunit>
The example above expects a tests/bootstrap.php file which is executed before tests are run. Create the bootstrap file
with the following content (customize as needed):
<?php
// tests/bootstrap.php
include "../../vendor/autoload.php";
\Pimcore\Bootstrap::setProjectRoot();
\Pimcore\Bootstrap::bootstrap();
Now we're ready to write tests which depend on a bootstrapped environment. Symfony already provides KernelTestCase and
WebTestCase as base classes for tests involving the container, but Pimcore expects the container to be set via Pimcore::setContainer()
after bootstrapping. This is automatically done for you if you use Pimcore\Test\KernelTestCase and Pimcore\Test\WebTestCase
as base classes, otherwise you need to make sure to overwrite createKernel and set the container on the Pimcore class.
Let's create a functional test which tests a controller response (see Symfony's test documentation for details). The example
below assumes an installation running the demo-basic install profile.
<?php
// tests/App/Controller/ContentControllerTest.php
declare(strict_types=1);
namespace Tests\App\Controller;
use Pimcore\Test\WebTestCase;
class ContentControllerTest extends WebTestCase
{
public function testRedirectFromEn(): void
{
$client = static::createClient();
$client->request('GET', '/en');
$this->assertTrue($client->getResponse()->isRedirect());
$client->followRedirect();
$this->assertEquals('/', $client->getRequest()->getPathInfo());
}
public function testPortal(): void
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$response = $client->getResponse();
$this->assertTrue($response->isSuccessful(), 'response status is 2xx');
$this->assertTrue($response->headers->contains('X-Custom-Header', 'Foo'));
$this->assertTrue($response->headers->contains('X-Custom-Header', 'Bar'));
$this->assertTrue($response->headers->contains('X-Custom-Header2', 'Bazinga'));
$this->assertEquals(
1,
$crawler->filter('h1:contains("Ready to be impressed?")')->count()
);
}
}
If you would run the test suite now, it would fail with a list of errors as the test can't connect to the database. This
is because the tests run in the test environment and that environment is set up to use a different database connection
which is defined as PIMCORE_TEST_DB_DSN environment variable by default (see config/packages/test/config.yaml).
You can either define the database DSN as environment variable on your shell, hardcode it into the PHPUnit config file (not
recommended) or remove/alter the customized doctrine section from config/packages/test/config.yaml completely. What to use depends highly on your environment and your tests - if you have
tests which make changes to the database you'll probably want to run them on a different database with a predefined data
set. The example below just passes the DB connection as env variable:
$ PIMCORE_TEST_DB_DSN="mysql://username:password@localhost/pimcore" vendor/bin/simple-phpunit
PHPUnit 7.4.5 by Sebastian Bergmann and contributors.
Testing default
.......... 10 / 10 (100%)
Time: 2.69 seconds, Memory: 36.00MB
OK (10 tests, 15 assertions)
For more information you can follow Symfony's Testing Documentation. Just keep
in mind to make sure Pimcore is properly bootstrapped before tests are run. | Bootstrapping Pimcore | [
-0.4258510172367096,
-0.06529004871845245,
-0.18458187580108643,
-0.027403032407164574,
0.03157821670174599,
-0.21775700151920319,
0.3495078980922699,
0.3089072108268738,
-0.1633673757314682,
0.3024642765522003,
-0.027238648384809494,
0.127176895737648,
0.05059075355529785,
-0.014355234801... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Application_Testing#codeception | Codeception
For Pimcore's core tests, Pimcore uses Codeception which wraps PHPUnit and adds a lot of nice features, especially for
organizing tests and for adding helper code which can be used from tests. You can basically use the same setup as Pimcore's
core by defining a custom test suite and by using Pimcore's core helpers. The most important helper is \Pimcore\Tests\Support\Helper\Pimcore
which extends Codeception's Symfony Module for functional testing and adds
logic to bootstrap Pimcore and to drop/re-create the database and class directory to an empty installation to have every
test suite start from a clean installation.
WARNING: Pimcore's codeception setup is targeted for CI use, where database and data structures are created
from an empty installation. This means unless not configured otherwise the codeception helpers will DROP and
re-create the database and DELETE class files. Use with caution and only use on a test setup!
To get started, add a tests/codeception.dist.yml file for your custom test setup which defines directories and basic
behaviour:
# tests/codeception.dist.yml
namespace: Tests
support_namespace: Support
actor_suffix: Tester
paths:
tests: .
output: ./_output
data: ./Support/Data
support: ./Support
envs: ./_envs
settings:
bootstrap: _bootstrap.php
colors: true
params:
- env
extensions:
enabled:
- Codeception\Extension\RunFailed
Pimcore already ships a codeception.dist.yml which is set up to run Pimcore's core tests. You might want to change this
to run your own test setup by default:
# codeception.dist.yml
settings:
memory_limit: 1024M
colors: true
paths:
output: var/log
include:
- tests
You can create any amount of test suites in Codeception. To match the PHPUnit example above, we'll create 2 test suites
unit and functional for unit and functional testing. The following commands should create the basic directory/file
structure in tests/:
$ vendor/bin/codecept -c tests/codeception.dist.yml generate:suite unit
$ vendor/bin/codecept -c tests/codeception.dist.yml generate:suite functional
The config file above references a _bootstrap.php file. Create tests/_bootstrap.php with the following contents to make
sure Pimcore can be bootstrapped during tests. Adjust according to your needs.
<?php
// tests/_bootstrap.php
use Pimcore\Tests\Support\Util\Autoloader;
// define project root which will be used throughout the bootstrapping process
define('PIMCORE_PROJECT_ROOT', realpath(__DIR__ . '/..'));
// set the used pimcore/symfony environment
putenv('APP_ENV=test');
require_once PIMCORE_PROJECT_ROOT . '/vendor/autoload.php';
\Pimcore\Bootstrap::setProjectRoot();
\Pimcore\Bootstrap::bootstrap();
\Pimcore\Bootstrap::kernel();
// add the core pimcore test library to the autoloader - this could also be done in composer.json's autoload-dev section
// but is done here for demonstration purpose
require_once PIMCORE_PROJECT_ROOT . '/vendor/pimcore/pimcore/tests/Support/Util/Autoloader.php';
Autoloader::addNamespace('Pimcore\Tests', PIMCORE_PROJECT_ROOT . '/vendor/pimcore/pimcore/tests/Support');
The tests/unit.suite.yml should be fine for a standard unit testing setup without dependencies, but we need to alter the
functional test suite to initialize a test database and to boot Pimcore's kernel before running tests. Configure the
suite to use the \Pimcore\Tests\Support\Helper\Pimcore helper:
# tests/functional.suite.yml
actor: FunctionalTester
modules:
enabled:
- \Tests\Support\Helper\Functional
- \Pimcore\Tests\Support\Helper\Pimcore:
# CAUTION: the following config means the test runner
# will drop and re-create the Pimcore DB and purge var/classes
# use only in a test setup (e.g. during CI)!
connect_db: true
initialize_db: true
purge_class_directory: true
# If true, it will create database structures for all definitions
setup_objects: false
This will set up a functional test which sends a request directly through Symfony's kernel (similar to the PHPUnit setup above). However, Codeception makes it easy to use a full-blown browser for acceptance testing by configuring additional modules such as the WebDriver module for Selenium testing.
Let's start writing tests by adding a simple unit test:
<?php
// tests/unit/ExampleTest.php
namespace Tests\Unit\App;
use Codeception\Test\Unit;
/**
* This test is just a dummy for demonstration purposes and
* doesn't actually test any class.
*/
class ExampleTest extends Unit
{
/**
* Tester actor exposing methods added by helpers
*/
protected \Tests\UnitTester $tester;
public function testPhpCanCalculate(): void
{
$this->assertEquals(15, 10 + 5);
$this->assertEquals(100, pow(10, 2));
}
/**
* @dataProvider addDataProvider
*/
public function testPhpCanAddWithProvider(int $a, int $b, int $expected): void
{
$this->assertEquals($expected, $a + $b, sprintf('%d + %d = %d', $a, $b, $expected));
}
public function testSomethingElse(): void
{
$obj1 = new \stdClass();
$obj2 = new \stdClass();
$obj3 = new \stdClass();
$obj1->obj = $obj3;
$obj2->obj = $obj3;
$this->assertNotNull($obj1);
$this->assertNotNull($obj2);
$this->assertNotNull($obj3);
$this->assertNotSame($obj1, $obj2);
$this->assertSame($obj1->obj, $obj2->obj);
$this->assertSame($obj3, $obj1->obj);
$this->assertSame($obj3, $obj2->obj);
}
public function testException(): void
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('This test is about to fail');
throw new \RuntimeException('This test is about to fail');
}
public function addDataProvider(): array
{
return [
[1, 2, 3],
[10, 5, 15],
[-5, 5, 0],
[5, -5, 0],
[0, 10, 10],
[-50, -50, -100],
[-50, 10, -40]
];
}
}
And a functional test testing the empty index page. As the Pimcore helper is based Codeception's Symfony module you
can directly use Symfony tests such as $I->amOnRoute().
<?php
// tests/functional/App/IndexPageCest.php
namespace Tests\Functional\App;
use Tests\FunctionalTester;
class IndexPageCest
{
public function testFrontpage(FunctionalTester $I): void
{
$I->amOnPage('/');
$I->canSeeResponseCodeIs(200);
$I->amOnRoute('document_1');
$I->seeElement('#site #logo a', ['href' => 'http://www.pimcore.com/']);
$I->seeElement('#site #logo img', ['src' => '/bundles/pimcoreadmin/img/logo-claim-gray.svg']);
}
}
As in the PHPUnit setup, the test setup expects the database connection as env variable by default. Run your new test setup
by configuring the DB DSN before running codeception:
$ PIMCORE_TEST_DB_DSN="mysql://username:password@localhost/pimcore" vendor/bin/codecept run -c tests/codeception.dist.yml
Codeception PHP Testing Framework v2.3.8
Powered by PHPUnit 7.4.5 by Sebastian Bergmann and contributors.
[DB] Initializing DB pimcore5_test
[DB] Dropping DB pimcore5_test
[DB] Creating DB pimcore5_test
[DB] Successfully connected to DB pimcore5_test
[DB] Initialized the test DB pimcore5_test
[INIT] Purging class directory var/classes
Tests.functional Tests (1) --------------------------------------------------------------------------------------------------------------------------
Testing Tests.functional
β IndexPageCest: Test frontpage (3.23s)
-----------------------------------------------------------------------------------------------------------------------------------------------------
Tests.unit Tests (10) -------------------------------------------------------------------------------------------------------------------------------
β ExampleTest: Php can calculate (0.14s)
β ExampleTest: Php can add with provider | #0 (0.00s)
β ExampleTest: Php can add with provider | #1 (0.00s)
β ExampleTest: Php can add with provider | #2 (0.00s)
β ExampleTest: Php can add with provider | #3 (0.00s)
β ExampleTest: Php can add with provider | #4 (0.00s)
β ExampleTest: Php can add with provider | #5 (0.00s)
β ExampleTest: Php can add with provider | #6 (0.00s)
β ExampleTest: Something else (0.01s)
β ExampleTest: Exception (0.01s)
-----------------------------------------------------------------------------------------------------------------------------------------------------
Time: 6.96 seconds, Memory: 44.25MB
OK (11 tests, 21 assertions)
| Codeception | [
-0.44674554467201233,
0.07917045801877975,
-0.183168426156044,
-0.03939804062247276,
-0.1910925656557083,
-0.028259653598070145,
0.16993731260299683,
0.2834950387477875,
-0.1324044018983841,
0.16812725365161896,
-0.061937227845191956,
0.1348164975643158,
-0.2782384753227234,
0.121620610356... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#core-testing | Core Testing
Pimcore uses Codeception for testing its core features.
To execute core tests, Pimcore provides a docker-compose.yaml file to create a setup for running the tests.
The docker images are based on the debug images, thus it is also possible to debug the tests using xdebug.
Make sure, that path mappings are applied correctly though
| Core Testing | [
-0.4978579878807068,
-0.20756123960018158,
-0.17312556505203247,
0.09687457978725433,
-0.24877655506134033,
0.0057925935834646225,
0.26312607526779175,
0.14944633841514587,
-0.001146000693552196,
0.24285204708576202,
-0.09484230726957321,
0.5711781978607178,
-0.1196787878870964,
0.07424029... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#requirements | Requirements
docker and docker compose installed on your system.
Pimcore git repository cloned locally
| Requirements | [
-0.4501294493675232,
-0.17680728435516357,
-0.32253268361091614,
-0.1737026572227478,
-0.0566907599568367,
-0.23467712104320526,
0.1965564787387848,
0.09451866894960403,
-0.06266441941261292,
0.30670785903930664,
-0.2883611023426056,
0.2639547288417816,
-0.014331969432532787,
0.20913925766... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#preparations | Preparations
Change to tests\bin directory of the Pimcore repository
Execute ./init-tests.sh, this does:
Running docker compose up -d and setting up all necessary services (like db and redis). Pimcore source code files
are mounted into docker container, so you can change files and test the changes right away.
Copying some files from .github\ci\file to prepare system for executing the tests (actually same as for github actions)
Executing composer install to install all dependencies
Print out further instructions
Now the system is ready and tests can be executed inside the docker containers (see also commands below).
After finishing, shutdown docker containers and cleanup volumes with docker compose down -v --remove-orphans. | Preparations | [
-0.5104431509971619,
-0.029184117913246155,
-0.25997892022132874,
-0.08320096880197525,
-0.13901089131832123,
-0.0420098640024662,
0.11792198568582535,
0.3550221025943756,
-0.27257344126701355,
0.27355265617370605,
-0.1995428204536438,
0.44958123564720154,
-0.010767603293061256,
0.17567649... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#executing-tests | Executing tests | Executing tests | [
-0.28931522369384766,
-0.3569214940071106,
-0.33558976650238037,
-0.01845095306634903,
-0.08282362669706345,
0.015090083703398705,
0.45285001397132874,
0.20888729393482208,
0.23560146987438202,
0.27649617195129395,
0.22795866429805756,
0.02838938497006893,
-0.20722679793834686,
0.014953117... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#run-all-tests | Run all tests
This will run all tests.
docker compose exec php vendor/bin/codecept run -c . -vvv
| Run all tests | [
-0.6012420654296875,
-0.013571531511843204,
-0.33737337589263916,
-0.2889006435871124,
0.004511435516178608,
-0.03848494589328766,
0.4117409586906433,
0.44993969798088074,
0.17691051959991455,
0.49416792392730713,
0.31945279240608215,
0.13708581030368805,
-0.21701516211032867,
0.1457884460... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#only-run-a-specific-suite | Only run a specific suite
Only runs the Model tests. For a list of suites see the list below.
docker compose exec php vendor/bin/codecept run -c . Model -vvv
| Only run a specific suite | [
-0.6123406291007996,
0.18431159853935242,
-0.27651137113571167,
-0.1955627202987671,
-0.04764597862958908,
-0.06449443846940994,
0.41447848081588745,
0.3219425678253174,
0.25853636860847473,
0.31304892897605896,
0.28306958079338074,
0.09605391323566437,
-0.212778702378273,
0.32400432229042... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#only-run-a-specific-test-group | Only run a specific test group
This can be a subset of a suite. You also have the option to provide a comma-seperated list of groups.
For an overview of available groups see the table below.
docker compose exec php vendor/bin/codecept run -c . Model -vvv -g dataTypeLocal
| Only run a specific test group | [
-0.7014589309692383,
0.16684256494045258,
-0.21406105160713196,
-0.23269495368003845,
-0.04631691053509712,
-0.11606241017580032,
0.6528941988945007,
0.31649067997932434,
0.2862921357154846,
0.32732507586479187,
-0.016247425228357315,
-0.0171499103307724,
-0.13463325798511505,
0.2407672703... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#redis-cache-tests | Redis Cache tests
For Redis, the PIMCORE_TEST_REDIS_DSN option is mandatory. If not using the Redis provided by the docker-compose.yaml, set it
to a value that does not conflict to any other Redis DBs on your system.
docker compose exec php vendor/bin/codecept run -c . Cache
| Redis Cache tests | [
-0.6205019950866699,
-0.015189080499112606,
-0.2283686399459839,
-0.17711704969406128,
-0.2524246275424957,
-0.11301890760660172,
0.38130271434783936,
0.45572933554649353,
0.17854784429073334,
0.2229735106229782,
0.0399349220097065,
0.08975362777709961,
0.20926541090011597,
-0.202142864465... |
https://pimcore.com/docs/platform//Pimcore/Development_Tools_and_Details/Testing/Core_Tests#check-logfiles | Check Logfiles
Don't forget to check logfiles (especially test.log and php.log) inside the docker container when problems occur. | Check Logfiles | [
-0.4491131007671356,
-0.18001788854599,
-0.24758169054985046,
-0.16458113491535187,
0.23077093064785004,
-0.29819726943969727,
0.3968493640422821,
0.14151132106781006,
0.05964066833257675,
0.37515440583229065,
0.1741684377193451,
-0.028380682691931725,
-0.006978081539273262,
-0.09955812245... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.