Admin generator, filters and I18n

2015-01-24信息快讯网

You need to modify your EntityFormFilter (where Entity is your object class - Article, Book, etc.).

Three easy steps

1) configure function
Add an input for each field you want to include in your filter
 
$this->widgetSchema['name'] = new sfWidgetFormFilterInput(array('with_empty' => false)); 
$this->validatorSchema['name'] = new sfValidatorPass(array('required' => false)); 

2) add a query modification when filtering for that field
I've done it for Doctrine. Pay atention to the method name addFIELDColumnQuery.
 
public function addNameColumnQuery(Doctrine_Query $query, $field, $values) 
{ 
if (is_array($values) && isset($values['text']) && '' != $values['text']) 
{ 
$query->leftJoin('r.Translation t') 
// ->andWhere('t.lang = ?', $especify_one_language) // or it will search in all of them 
->andWhere('CONCAT(t.name, t.shortname) like ?', '%' . $values['text'] . '%'); 
} 
} 

3) Add your searching fields

 
public function getFields() 
{ 
return parent::getFields() + array('name' => 'Text'); 
} 

From: http://oldforum.symfony-project.org/index.php/t/24350/
PHPMailer邮件发送的实现代码
基于Zookeeper的使用详解
基于Zend的Config机制的应用分析
基于ubuntu下nginx+php+mysql安装配置的具体操作步骤
php中get_headers函数的作用及用法的详细介绍
使用php get_headers 判断URL是否有效的解决办法
php中serialize序列化与json性能测试的示例分析
input file获得文件根目录简单实现
PHP中操作ini配置文件的方法
基于initPHP的框架介绍
关于PHP的相似度计算函数:levenshtein的使用介绍
PHP If Else(elsefi) 语句
PHP 自定义错误处理函数trigger_error()
PHP Directory 函数的详解
file_get_contents获取不到网页内容的解决方法
PHP 获取文件路径(灵活应用__FILE__)
整理的一些实用WordPress后台MySQL操作命令
将博客园(cnblogs.com)数据导入到wordpress的代码
zend framework配置操作数据库实例分析
PHP下判断网址是否有效的代码
如何在symfony中导出为CSV文件中的数据
linux iconv方法的使用
linux系统上支持php的 iconv()函数的方法
php XMLWriter类的简单示例代码(RSS输出)
Sorting Array Values in PHP(数组排序)
PHP pathinfo()获得文件的路径、名称等信息说明
PHP setcookie指定domain参数后,在IE下设置cookie失效的解决方法
PHP MySQL应用中使用XOR运算加密算法分享
PHP表单验证的3个函数ISSET()、empty()、is_numeric()的使用方法
PHP-CGI进程CPU 100% 与 file_get_contents 函数的关系分析
php中使用Curl、socket、file_get_contents三种方法POST提交数据
不支持fsockopen但支持culr环境下下ucenter与modoer通讯问题
php数据结构 算法(PHP描述) 简单选择排序 simple selection sort
兼容firefox,chrome的网页灰度效果
PHP header函数分析详解
php中修改浏览器的User-Agent来伪装你的浏览器和操作系统
PHP FOR MYSQL 代码生成助手(根据Mysql里的字段自动生成类文件的)
php中用foreach来操作数组的代码
PHP Undefined index报错的修复方法
Can't create/write to file 'C:\WINDOWS\TEMP\...MYSQL报错解决方法
©2014-2024 dbsqp.com