Posts Tagged ‘symfony’
Symfony 1.4 – Doctrine Timestampable Behaviour
February 13th, 2010 / 13 Comments » / by Faizan
Recently Symfony released their LTS 1.4 branch. Unlike previous versions Symfony 1.4 comes with Doctrine as default ORM. If you have worked with Doctrine’s you will be familiar with its Timestampable behavior.
actAs: Timestampable: ~
Timestampable behavior automatically adds a created_at and updated_at column and automatically set the values when a record is inserted and updated. I mostly use Symfony Admin Generator to generate Backend. This behavior worked fined till Symfony 1.2, but in Symfony 1.3 / 1.4 for unknown reasons this behavior adds created_at and updated_at fields as required and their value must be filled during creation of new record in admin generator.
Symfony Admin Generator Calling Actions with Custom Parameters
September 1st, 2009 / 8 Comments » / by Faizan
The administration module actions can receive custom parameters using the query_string argument in a link_to() helper. For example, to extend the previous _edit_header partial with a link to the comments for the article, write this:
It filters the comments to display only the ones related to $article. Using the query_string argument, you can specify a sorting order and/or a filter to display a custom list view. This can also be useful for custom interactions.
Override index function
public function executeIndex(sfWebRequest $request)
{
// For filter.. This code was missing in symfony documentation.
if ($request->getParameter('filter'))
{
$this->setFilters($request->getParameter('project_filters'));
}
//-----------------
// sorting
if ($request->getParameter('sort'))
{
$this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type')));
}
// pager
if ($request->getParameter('page'))
{
$this->setPage($request->getParameter('page'));
}
$this->pager = $this->getPager();
$this->sort = $this->getSort();
}
Fixing IE7 dropping PHP Sessions
February 10th, 2009 / 25 Comments » / by Faizan
After banging my head against the wall, and spending the better part of today trying to find out why my session variables were not being transferred from page to page in IE7, it worked fine in Firefox and Safari. The sessions not working were rendering MySpace OpenSocial App in Iframe and was dead to anyone using IE7. But the good news is i got it fixed (thanks to google), and the fix is so simple it’s ridiculous. Before you start your session, you need to declare a privacy policy in your header.
header('P3P: CP="CAO PSA OUR"'); ob_start(); session_start();
Other things learned during MySpace development.
- Everything works just fine in FireFox, IE7 is the only culprit :p
- If you try to send any OpenSocial request through MySpace IFPC library in IE7 before the page is fully loaded, IE7 will give alert error saying Object Not Found. To fix this wait for page load and then make request.
- request.AdjustHeight() will not work in IE7 if Symfony’s development (frontend controller) environment is enabled.
- I’ve already forgot a lot of things that I learned, will try to remember them again and bookmark them.
Recent Comments