Quick Tips: Doctrine 2 useful commands


Hi there! Using Zend Framework 2 With doctrine have been nice! But commands for update and validate schema are hard to keep it in mind! So on Root Dir:

Validate Schema: 

./vendor/bin/doctrine-module orm:validate-schema

Create Schema:

./vendor/bin/doctrine-module orm:schema-tool:create

Validate an Update:

./vendor/bin/doctrine-module orm:schema-tool:update –dump-sql

Apply an Update:

./vendor/bin/doctrine-module orm:schema-tool:update –force

Hope It helps some one!

Don’t forget to leave a comment!

MySQL select to file


So, the idea is to execute a query in MySQL but export the result to a CSV file.
MySQL gives you the statement INTO OUTFILE

Select * from table_name into outfile ‘/path/to/file.csv

Hope it helps.

select … for update (mysql)


Hi there!

Using mysql, I saw a awesome feature for concurrency in web applications. The reality is, big information systems needs to sharing data so, database can be a problem sometimes.

Here’s the deal:
I want to read a database record or update him too, without the risk of another database call modify him. Here we can use for update statement.

Simple Example:

You have a table that has for a primary key a int value (like a counter) and later update him:

– Start a Transaction
Start Transaction;

– build your select for the record
select * from table where key_value = ‘value_string’ for update;

–here you can include updare statement
update table ….. etc, etc etc

–just commit transaction to take effect and release table
— consider that other table calls will wait until you call commit statement


the concept is simple and is available on most of PHP frameworks (Zend Framework too)

Hope it helps.
leave a comment…

Quick tip: Zend Framework 2 Form error message: Array provided to Escape helper, but flags do not allow recursion


So… strange mess here… creating a new form this exception appeared:

Array provided to Escape helper, but flags do not allow recursion

Some opinions suggest that the problem is in the fields of date type … and even suggest this approach:


I had no such field type date … I noticed the mess I made in the form construct -> an missing argument … so … have attention to it! (shame on me lol)