Well i did this to add a text search for a foreign key column:
in apps/backend/modules/postulanteOferta/config/generator.yml
list:
table_method: retrievePendientesList
filter:
display: [postulante]
in /lib/filter/doctrine/PostulanteOfertaFormFilter.class.php
class PostulanteOfertaFormFilter extends
BasePostulanteOfertaFormFilter
{
public function configure()
{
$this->setWidget('postulante', new sfWidgetFormFilterInput());
$this->setValidator('postulante', new sfValidatorPass(array
('required' => false)));
$this->validatorSchema->addOption('allow_extra_fields', true);
}
public function getFields()
{
return array(
'id' => 'Number',
'postulante_id' => 'ForeignKey',
'oferta_id' => 'ForeignKey',
'estado_id' => 'ForeignKey',
'created_at' => 'Date',
'updated_at' => 'Date',
'postulante' => 'Text',
);
}
public function addPostulanteColumnQuery(Doctrine_Query $q, $element,
$value){
return $q->andWhere('p.nombre ILIKE ?', '%'.$value['text'].'%');
}
}
This way it works fine but Is it the correct way to add a custom text
search for a foreignkey???
On 23 jun, 20:40, Saganxis <[email protected]> wrote:
> Hi there , i'm having some issues to set up filters correctly in the
> admin generator for my backend application.
>
> The admin generator looks fine for doing CRUD operations but what if i
> want to customize the view and behavior of my backend site?
>
> Lets start with simple questions. Suppose this simple model:
>
> post:
>
> id
>
> category_id
>
> name
>
> description
>
> category:
>
> id
>
> name
>
> So I need in the post generated module(using the admin task):
>
> - Order by category name
>
> - search by category name(not a select box here)
>
> I just want to do this for now and i don't find the way to do this
> using generator.yml. I've been looking for this in forums and the
> symfony documentation and tried a lot of things but i don't find the
> way.
>
> Besides i downloaded some applications developed using symfony 1.2,
> just to get some examples, and none of all this app uses the admin
> generator(not even the app selected in symfony live to do the
> refactoring) so i don't know if is better to use the admin generator
> or not.
>
> Of course I could just do it all by hand, but i think there is a way
> to do this using some parts of the admin generated code.
>
> I'm using sf 1.2 with doctrine.
>
> I 'd really appreciate any help to get rid of this, sorry for my
> english.
>
> Best regards!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---