Reputation: 13
I need to override the onBeforeWrite function in the member class in order to allow users who already have an account to be registered. So I defined an Injector in the yml file to the Member class and added a custom member class which extends the Member class. It worked and the function is overridden but now when I'm running the dev/build after it completes there is an GraphQl error shown in the dev build and the graph generated files are also not created.
injectors.yml code:
SilverStripe\Core\Injector\Injector:
SilverStripe\Security\Member:
class: RM\Extension\CustomMember
**CustomMember class - **
<?php
namespace RM\Extension;
use SilverStripe\Security\Member;
class CustomMember extends Member
{
public function onBeforeWrite()
{
die('reached custom');
}
}
The die statement was executed when I'm trying to create an account. So the function is overridden correctly but I get the error (screenshot attached) in the dev build - error snapshot
Upvotes: 0
Views: 18