The Symfony Frame work is very popular with PHP
developers and it has a very nice Demo
Application to help novices learn the intricacies
involved. But the demo does not use MySQL. So this blog
entry is about re configuring the demo so it works with MySQL 8.
And I am using Ubuntu 18.04 LTS to you may have to adjust the
following commands to work with your operating system.
This is not difficult but there are some steps that are not
exactly self evident that this blog will show you how to get the
demo working.
Preliminaries
The first thing to do is to make sure you have PHP 7.2 or better
installed including the php7.2-intl (sudo apt-get install
php7.2-intl) package as well as the PDO connector. I will admit I
have been using PHP since it appeared and this …
I am currently working my way through the many PHP Frameworks to
see how they get on with MySQL 8. The Frameworks that can
take advantage of the MySQL Improved Extension or mysqli
can take advantage of the SHA256 Caching Authentication method.
But those that are PDO based need to use the older MySQL Native
Authentication method.
I wanted to check the PDO based frameworks and today I just
happened to be wearing the very nice Symfony shirt I received as
part of my presentation at Symfony USA. So I started with a
fresh install of Symfony. All was going well until it came
time to get it to work with MySQL 8 through Doctrine.
Doctrine
Symfony uses Doctrine as an ORM (Object Relational Mapper)
and DBAL (Database Abstraction Layer) as an
intermediary to the database. While I myself am not a big
fan of ORMs …
In a previous blog posting I was mentioning that I'm working on a small hobby PHP project. As I'm using this project to update myself to current frameworks I've decided to use Symfony2. Symfony provides a nice feature, which is the Symfony Profilier, an extensive logging and reporting system for Symfony2 developers to understand what's going on. A part of it is the Doctrine query logger which lists all database queries executed by Doctrine and their execution time.
This is nice but when we're using mysqlnd in our PHP build we have more information available. "So why not use that information," I thought and built a new bundle for Symfony2 doing exactly that. The …
[Read more]I ran into an interesting bug/fact today while messing around with MySQL 5.5. It seems that in the DDL, you can’t say “Type=InnoDB|MyISAM|Foo” anymore. You have to say “Engine=InnoDB”.
This will break your propel:build-all , or propel:build-all-load .. or if you manually try to execute the sql from data/sql/*. You’ll get the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Type=InnoDB’ at line 11
This issue is resolved in Propel 1.5.0, but I’m not sure when Symfony will include that in the Symfony 1.4 series.
To fix this issue, all you need to do is edit one file:
…
[Read more]I need one MyISAM table in my schema, I’m using Symfony 1.2 and Propel 1.3. As flexible as Symfony and it’s YAML files are, Propel currently doesn’t allow you to change the storage engine on the fly. You use the storage engine as specified in propel.ini. As discussed in the Propel FAQ .
So, the next best thing to do now is to have it so that when Symfony runs propel:insert-sql, I can piggyback my own SQL to it. Luckily, this is possible, and it’s explained here
I now have my own SQL file running at the end, where I do an ALTER TABLE. For the lazy web.
1. Create your Alter table:
ALTER TABLE `database`.`footable` ENGINE=`MyISAM`;
2. Save the file in $projectdir/data/sql/piggyback.sql
…
[Read more]Notes on using Symfony with multiple databases.
I’m building a new application in symfony, and I need to use some data from an existing application written by another developer.
I can’t just extend the existing application for reasons we don’t
need to get into, but I do need to interface with the data, since
the existing
app doesn’t really have a nice way to handle a SOA, or share data
easily, my next best option is to talk to the original app’s db.
Things you need to think about.
- No Hacks This is not a hack, symfony/propel support this out of the box, the documentation mentions it briefly but it’s definitely possible.
- Permissions Should you share the same username/password? or different? In my case, I wanted to make sure symfony couldn’t write to the existing app, so I created a user with SELECT privileges only. (This will affect your ability …
While recently migrating Tschitschereengreen.com from Symfony to Django plus changing the database backend from MySQL to PostgreSQL, there were mainly two tasks more time-consuming than I’ve had thought beforehand:
SQL dump
The old database used a latin1 encoding for the database fields and utf-8 as the server and client connection encoding. With these settings, even trying to get a correctly encoded database dump from phpMyAdmin is a bad idea.
Using mysqldump with an explicitly specified character-set is much better:
mysqldump ? ?default-character-set=latin1 …[Read more]