Category Archives: backEnd
Setting cross-domain cookie problem
Safari ships with conservative cross domain cookie policy. It means that if website on safari calls other api on other domain and this api returns set-cookie header, it will not work on Safari, cookie will not be set eventually. Having this issue in my recent project I had to come up with a workaround. Proxy […]
Custom Element in Array type in Typescript
Sometimes you need to do something like this: The issue here is, that most probably makes hard for your fellow developer to read and understand that code because he/she does not expect array type to contain any custom fields. But still you might have reasons to do that, for example, ‘someArray’ is created in other […]
Exporting data recipy, Memory limit exceeded PHP error
While exporting data from database to a file via PHP, such libraries as PHPExcel will cause an error Memory limit exceeded. Because they read data from database to RAM. You can avoid that using file system only. So the recepy is:Get data from database and write it to a temporary file and then read it […]
WordPress: image upload from url
In case you have WordPress powered e-shop you most probably will need to add products to it filling them with pictures from web. When adding it you will see such an dialog: ‘Select Files’ dialogue will open (in case you are on Windows) Windows Explorer, so you can choose file from your PC to upload. It […]
Doctrine 2 QueryBuilder getResult and getArrayResult
When using Doctrine 2 hydration you can sometimes encounter issue when you get one result instead of many results. Doctrine 2 requires every entity to have Id annotation. Please use it carefully, because when using Doctrine 2 QueryBuilder \Doctrine\ORM\AbstractQuery::getResult You will not get records having not unique @Id fields. And no even PHP warnings. \Doctrine\ORM\Internal\Hydration\ObjectHydrator::hydrateRowData will […]
MySQL: NULL value comparison issue
As a PHP developer I was surprised when query like this: SELECT IF(‘Bonus’ <> NULL, 1, 0) returned 0 Any arithmetic comparison with NULL does not return true or false, but returns NULL instead As an alternative guys propose <=> operator called NULL – safe equal to operator. So my query will look like this: SELECT IF(!(‘Bonus’ <=> […]