src/Model/Aggregate/AggregateRoot.php
public function modify(ModifyAggregateRootCommand $modify_command)
    {
        $this->guardCommandPreConditions($modify_command);

        $modified_event = $this->processCommand(
            $modify_command,
            [ 'data' => $modify_command->getValues() ]
        );

        if (!$modified_event instanceof AggregateRootModifiedEvent) {
            throw new UnsupportedEventTypeError(
                sprintf(
                    'Corrupt event type detected. Events that reflect entity modification must descend from %s.',
                    AggregateRootModifiedEvent::CLASS
                )
            );
        }

        $this->applyEvent($modified_event);
    }
public function modify(ModifyAggregateRootCommand $modify_command)
    {
        $this->guardCommandPreConditions($modify_command);

        $modified_event = $this->processCommand(
            $modify_command,
            [ 'data' => $modify_command->getValues() ]
        );

        if (!$modified_event instanceof AggregateRootModifiedEvent) {
            throw new UnsupportedEventTypeError(
                sprintf(
                    'Corrupt event type detected. Events that reflect entity modification must descend from %s.',
                    AggregateRootModifiedEvent::CLASS
                )
            );
        }

        $this->applyEvent($modified_event);
    }
public function modify ( ModifyAggregateRootCommand $ modify_command ) { $ this -> guardCommandPreConditions ( $ modify_command ) ; $ modified_event = $ this -> processCommand ( $ modify_command , [ 'data' => $ modify_command -> getValues ( ) ] ) ; if ( ! $ modified_event instanceof AggregateRootModifiedEvent ) { throw new UnsupportedEventTypeError ( sprintf ( 'Corrupt event type detected. Events that reflect entity modification must descend from %s.' , AggregateRootModifiedEvent :: CLASS ) ) ; } $ this -> applyEvent ( $ modified_event ) ; }
Modify the state of the current aggregate-root.

@param ModifyAggregateRootCommand $modify_command
Modify the state of the current aggregate - root .