Files
lucent-laravel/src/Edge/EdgeService.php
T

54 lines
1.0 KiB
PHP
Raw Normal View History

2023-10-02 23:10:49 +03:00
<?php namespace Lucent\Edge;
use Lucent\LucentException;
class EdgeService
{
2023-11-29 17:10:15 +02:00
public function __construct(public EdgeRepo $edgeRepo)
{
}
2023-10-02 23:10:49 +03:00
/**
* @throws LucentException
*/
2023-11-29 17:10:15 +02:00
public function create(
2023-10-02 23:10:49 +03:00
string $source,
string $target,
string $sourceSchema,
string $targetSchema,
string $field,
string $rank,
): Edge
{
$edge = new Edge(
source: $source,
target: $target,
sourceSchema: $sourceSchema,
targetSchema: $targetSchema,
field: $field,
rank: $rank,
);
2023-11-29 17:10:15 +02:00
$this->edgeRepo->insert($edge);
2023-10-02 23:10:49 +03:00
return $edge;
}
2023-11-29 17:10:15 +02:00
public function update(string $from, EdgeCollection $edges): void
{
$this->edgeRepo->update($from, $edges);
}
public function findAll(): EdgeCollection
{
return $this->edgeRepo->findAll();
}
public function remove(Edge $edge): void
{
$this->edgeRepo->remove($edge);
}
2023-10-02 23:10:49 +03:00
}