-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load type "virtual_filter" #49
Comments
Hi @ksn135 I would say this is "normal" as we should not be able to guess on what fields you want to apply filters. So, I think we can easily imagine a way to authorize "filters on virtual fields" (forcing developers to implement given method for example)... but this is so a kind of improvement. Maybe @loostro who works a lot lately on filters can provide us some clues on that question |
By the way, did you defined the |
No, I just set |
ok... sorry... I don't remember how it is working, and loostro changed all of this recently... |
I'm already dive too deeply into the code. Almost done! ) |
Ta-da! Problem solved.
And add function to ListController class to actually filter rows:
Thank you all for your attention! |
Hi @ksn135 I think filterOn: fuckin'.magick Is like a "hack" of the system. As you can see in the view template, this is done to handle filters on "sub-entity" field (for exemple in a blog post model, to filter on author's name thanks to the field I really think we should handle "virtual_filters" by the same way (generating a function into the list controller), but without to have to distorde the generator file with awesome useless and invalid configuration (as the What do you think? |
Yes, it's a bit of a hack. Right now I need to move on, customer is siting on my neck ) |
I think we can simply check the |
So, if |
Actually, for now, if So I'm not sure |
Yeah, I see. Better add a new configuration parameter or just use my hack... ))) |
BTW, can't solve another problem, any suggestions? |
Waiting for stack overflow edit validation I just created the following sample app: generator: admingenerator.generator.doctrine
params:
model: Application\CoreBundle\Entity\Account
namespace_prefix: Application
concurrency_lock: ~
bundle_name: AdminBundle
pk_requirement: ~
fields:
id:
filterable: 1
name:
filterable: 1
expirationDate:
formType: s2a_date_picker
object_actions:
delete: ~
batch_actions:
delete: ~
builders:
list:
params:
title: List for AdminBundle
display: ~
filters: ~
actions:
new: ~
object_actions:
edit: ~
delete: ~
excel:
params: ~
filename: ~
filetype: ~
new:
params:
title: New object for AdminBundle
display:
- name
- expirationDate
actions:
save: ~
list: ~
edit:
params:
title: "You're editing the object \"%object%\"|{ %object%: Account.name }|"
display:
- name
- expirationDate
actions:
save: ~
list: ~
show:
params:
title: "You're viewing the object \"%object%\"|{ %object%: Account.name }|"
display: ~
actions:
list: ~
new: ~
actions:
params:
object_actions:
delete: ~
batch_actions:
delete: ~ With this entity mapping: Application\CoreBundle\Entity\Account:
type: entity
table: null
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
expirationDate:
type: datetime
nullable: true
lifecycleCallbacks: { } And of course, just in case, the entity: <?php
namespace Application\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Account
*/
class Account
{
/**
* @var integer
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var \DateTime
*/
private $expirationDate = null;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
* @return Account
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param \DateTime $expirationDate
* @return $this
*/
public function setExpirationDate(\DateTime $expirationDate = null)
{
$this->expirationDate = $expirationDate;
return $this;
}
/**
* @return \DateTime
*/
public function getExpirationDate()
{
return $this->expirationDate;
}
} And no specific customization on my entity neither my admin config or anything else... and it works well. Does it helped you? Are you doing something specific in your application? |
The differences is only one. You set field type to |
I've made exactly the same test / application changing the |
I've just added Gedmo Timestampable and Blameable behavior to my entity and now it's work.
After addition:
It's very strange, but you can see below, I'm not insane:
Did you see thouse strange values "0000-00-00 00:00:00" ? Before last schema update new entities gots this values into empty publishedAt field on save. And on first edit action publishedAt field automaticaly recieve current date as it "saved" value. |
I've tried to set filterable attribute to true on "virtual column" fullName.
In my entity I have fields for firstName, lastName and patronymic.
I have function getFullName() thats return string with all tree fields combined.
So, the question is: does it currently not supported or what am I doing wrong ?
The text was updated successfully, but these errors were encountered: