php - default Filtering Sonata admin list without a Filter filed -


i'm using sonata mongodb admin bundle , need filter default list data without filter field.

i have 'tenant_id' attribute in model , want show models if tenant_id equal id of connected user.

any 1 can ?

you can override createquery function of admin class described here, https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#customizing-the-query-used-to-generate-the-list

public function createquery($context = 'list') {     $query = parent::createquery($context);     $query->field('tenant_id')->equals("your user id");     return $query; } 

Comments

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

Android M doze mode and "native" posix socket freezing up -