-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Bring back EventHandler and fix CS
- Loading branch information
Showing
5 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neo4j\Neo4jBundle\Event; | ||
|
||
use Laudis\Neo4j\Databags\Statement; | ||
use Laudis\Neo4j\Exception\Neo4jException; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
class FailureEvent extends Event | ||
{ | ||
public const EVENT_ID = 'neo4j.on_failure'; | ||
|
||
protected bool $shouldThrowException = true; | ||
|
||
public function __construct(private ?string $alias, private Statement $statement, private Neo4jException $exception) | ||
{ | ||
} | ||
|
||
public function getException(): Neo4jException | ||
{ | ||
return $this->exception; | ||
} | ||
|
||
public function disableException(): void | ||
{ | ||
$this->shouldThrowException = false; | ||
} | ||
|
||
public function shouldThrowException(): bool | ||
{ | ||
return $this->shouldThrowException; | ||
} | ||
|
||
public function getAlias(): ?string | ||
{ | ||
return $this->alias; | ||
} | ||
|
||
public function getStatement(): Statement | ||
{ | ||
return $this->statement; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neo4j\Neo4jBundle\Event; | ||
|
||
use Laudis\Neo4j\Databags\ResultSummary; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
class PostRunEvent extends Event | ||
{ | ||
public const EVENT_ID = 'neo4j.post_run'; | ||
|
||
public function __construct( | ||
private ?string $alias, | ||
private ResultSummary $result | ||
) { | ||
} | ||
|
||
public function getResult(): ResultSummary | ||
{ | ||
return $this->result; | ||
} | ||
|
||
public function getAlias(): ?string | ||
{ | ||
return $this->alias; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neo4j\Neo4jBundle\Event; | ||
|
||
use Laudis\Neo4j\Databags\Statement; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
class PreRunEvent extends Event | ||
{ | ||
public const EVENT_ID = 'neo4j.pre_run'; | ||
|
||
public function __construct(private ?string $alias, private Statement $statement) | ||
{ | ||
} | ||
|
||
public function getStatement(): Statement | ||
{ | ||
return $this->statement; | ||
} | ||
|
||
public function getAlias(): ?string | ||
{ | ||
return $this->alias; | ||
} | ||
} |