Saman Mohamadi
Saman Mohamadi

Reputation: 4672

add RESTful action in sonata-admin

I added a new action (fooAction) in sonata admin bundle. In list view there is an attribute which linked to newAction, but the its URL is like this : admin\bundle\entity\foo?id=17 fooAction works correctly ,But I want the Url to be RESTful like this: admin\bundle\entity\17\foo
what should I do ?

Upvotes: 2

Views: 855

Answers (1)

Saman Mohamadi
Saman Mohamadi

Reputation: 4672

In configureRoutes function,you must replace this :

$collection->add('foo');

to :

$collection->add('foo',$this->getRouterIdParameter() .'/foo');

Upvotes: 2

Related Questions