How to remove BOM from CSV file with PHP

 

Read Me

Ubuntu install latest PHP7 version

Ubuntu has many outdated packages. That’s why people heavily use ‚external’ repositories. Latest version of PHP at the time of writing is 7.0 even though 7.1.2 has been released over a month ago. 7.1 has a couple of interesting features: http://php.net/manual/en/migration71.new-features.php To install this versin you will have to perform 4 steps: 1. Add repository The ppa:ondrej repo is recommended:

2. Install new PHP

[…]

Read Me

How to sort Doctrine results with findAll()

Using findAll() it’s impossible to pass another orderby/sort parameter, because findAll definition looks like this:

Instead you can you findBy() which is more complex:

Look at the $orderBy parameter.   So now, when selecting all the records from a repository instead of:

just use:

 

Read Me

Symfony – how to add custom parameter to a service

Given a service with the following definition:

  if you want to pass through a additional parameter (for example a string), like this:

Change your service definition to:

  and then it will be available in the constructor, just like always.  

Read Me

Symfony3 – redirect to the previous location

I encountered the following problem: Given an action deleteAction in a controller I have to redirect to the previous location. Normally this information would be stored in the request headers as the referrer address. It’s tempting to write this:

but you’ll have to repeat yourself everytime you do a redirect. That’s why I decided to move this code to a service:

The requestStack gets injected by Symfony via […]

Read Me

PHP script removing bidding products from CENEO

Simple php-cli script to remove bidding products from CENEO, using CENEO API. Script prepared for a Magento shop. Ceneo.xml is a products map that looks like this:

Here’s the script:

 

Read Me

My vagrant devbox

A little update to my vagrant-devbox: added MySQL installation script, added support for Xdebug   Here’s the project: https://bitbucket.org/QWERTY_/vagrant-devbox Tested in Ubuntu 16.04.

Read Me Leave comment

HOW TO install Xdebug, php7, vagrant and Sublime3

I hate to install and configure it but overall it’s a great tool and a necessary one if you want to take debugging to the next level. To stop var_dump-debugging you are going to need: A machine with IDE or PHP editor installed A server featuring Apache and PHP Xdebug package My configuration script Test it all Let’s do it step by step. 1. Preparing PHP editor […]

Read Me Leave comment

Prosty box vagrant

Mój prosty config pod VirtualBox przygotowany z użyciem Ansible. Można go pobrać stąd: https://bitbucket.org/QWERTY_/vagrant-devbox Maszyna wirtualna zbudowana jest na bazie Ubuntu 16.04 z zainstalowany PHP7 oraz MySQL.    

Read Me Leave comment

Kohana – kopiowanie obiektów

Kohana – kopiowanie obiektów

Kopiowanie obiektów z istniejącego do nowego oraz zapisanie go do bazy danych rozwiązałem w następujący szybki sposób:

Jeśli istnieją atrybuty, które należy zmienić lub usunąć, można zapisać: unset( $new_object -> id ); A następnie ustawić je na odpowiednie wartości:

 

Read Me Leave comment