mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-03 18:58:01 +00:00 
			
		
		
		
	Reduced return type to entity interface
This commit is contained in:
		@@ -43,7 +43,7 @@ abstract class AbstractAction extends AbstractActionConstructor implements Actio
 | 
			
		||||
     *
 | 
			
		||||
     * @see \Infinito\Domain\ActionManagement\ActionInterface::execute()
 | 
			
		||||
     */
 | 
			
		||||
    final public function execute()
 | 
			
		||||
    final public function execute(): ?EntityInterface
 | 
			
		||||
    {
 | 
			
		||||
        $this->prepare();
 | 
			
		||||
        if ($this->isSecure()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,8 @@
 | 
			
		||||
 | 
			
		||||
namespace Infinito\Domain\ActionManagement;
 | 
			
		||||
 | 
			
		||||
use Infinito\Entity\EntityInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 */
 | 
			
		||||
@@ -25,7 +27,7 @@ final class ActionHandlerService implements ActionHandlerServiceInterface
 | 
			
		||||
     *
 | 
			
		||||
     * @see \Infinito\Domain\ActionManagement\ActionHandlerServiceInterface::handle()
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    public function handle(): ?EntityInterface
 | 
			
		||||
    {
 | 
			
		||||
        return $this->actionFactoryService->create()->execute();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ interface ActionHandlerServiceInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * Process an action an returns the results.
 | 
			
		||||
     *
 | 
			
		||||
     * @return EntityInterface|EntityInterface[]
 | 
			
		||||
     * @return EntityInterface|null
 | 
			
		||||
     */
 | 
			
		||||
    public function handle();
 | 
			
		||||
    public function handle(): ?EntityInterface;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ interface ActionInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * Executes the action.
 | 
			
		||||
     *
 | 
			
		||||
     * @return EntityInterface|EntityInterface[]|null
 | 
			
		||||
     * @return EntityInterface|null
 | 
			
		||||
     */
 | 
			
		||||
    public function execute();
 | 
			
		||||
    public function execute(): ?EntityInterface;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,6 @@ final class MVCRoutineService implements MVCRoutineServiceInterface
 | 
			
		||||
        switch (gettype($result)) {
 | 
			
		||||
            case 'object':
 | 
			
		||||
                return ['entity' => $result];
 | 
			
		||||
            case 'array':
 | 
			
		||||
                return ['entities' => $result];
 | 
			
		||||
            case 'null':
 | 
			
		||||
                return [];
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user