symfony - Adding a block into Sonata Admin Interface -
i trying add block admin dashboard, using sonataadminbundle. tried follow directives written here in first answer : how add custom link or button sonataadminbundle dashboard in symfony2
but have problem in blockservice class.
the code follow :
namespace appbundle\block; use symfony\component\httpfoundation\response; use sonata\adminbundle\form\formmapper; use sonata\corebundle\validator\errorelement; use sonata\blockbundle\model\blockinterface; use sonata\blockbundle\block\baseblockservice; class invitationblockservice extends baseblockservice { public function getname() { return 'invitation manager'; } public function getdefaultsettings() { return array(); } public function validateblock(errorelement $errorelement, blockinterface $block) { } public function buildeditform(formmapper $formmapper, blockinterface $block) { } public function execute(blockinterface $block, response $response = null) { // merge settings $settings = array_merge($this->getdefaultsettings(), $block->getsettings()); return $this->renderresponse('institutostoriconewsletterbundle:block:block_invitation.html.twig', array( 'block' => $block, 'settings' => $settings ), $response); }
}
but have compilation error on validatblock, buildedittform , execute method :
declaration must compatible blockserviceinterface->validateblock(errorelement : \sonata\adminbundle>\validator\errorelement, block : \sonata\blockbundle\model\blockinterface) class hierarchy checks: abstract methods implementation, implementing/overriding method compatibility super declaration. violations result in php fatal errors. it's not recommended disable or suppress inspection.
do have idea ?
thank reading.
i found cause of problem : had self-update composer.
it looks composer old, , did not fetch every files or dependancy needed.
so, composer self-update
saved me.
Comments
Post a Comment