id | customer_id | customer_name | start_point_address | start_point_latitude
-----+-------------+---------------+---------------------+----------------------
5131 | 243 | John Doe | 5 Galvin Street | 42.2123441
Journey({
"id": "5131",
"passenger": Passenger({
"id": "241",
"name": "John Doe"
}),
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
})
})
Journey({
"id": "877c41d5-5677-405d-a19d-73ff2e27e2e1",
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
}),
"passenger": Passenger({
"id": "05737a99-eae6-4a22-bdc3-01a5a6952331"
})
})
Relations,
variables, attributes
Journey({
"id": "877c41d5-5677-405d-a19d-73ff2e27e2e1",
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
}),
"passenger": Passenger({
"id": "05737a99-eae6-4a22-bdc3-01a5a6952331"
})
})
Aggregate!
Value Objects!
public function setName(string $name): void
{
$this->name = $name;
}
public function getName(): string
{
return $this->name;
}
Doesn't matter for small app,
but all apps small in the beginning
Upserts may be handy,
and your ORM can't do that
public function addPhonNumber(string $phoneNumber): void
{
$this->phones->add(
new PhoneNumber($this, $phoneNumber)
);
}
Even SQLite can do that
No need for UoW,
no need for identity map,
very simple mapping
GraphQL
Api Gateways
UI as composition of functions
and you have DBAL for that
CQRS
Ref: https://medium.com/eleven-labs/cqrs-pattern-c1d6f8517314
Journey({
"id": "877c41d5-5677-405d-a19d-73ff2e27e2e1",
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
}),
"passenger": "05737a99-eae6-4a22-bdc3-01a5a6952331",
"driver": null,
"status": "pending"
})
Journey({
"id": "877c41d5-5677-405d-a19d-73ff2e27e2e1",
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
}),
"passenger": "05737a99-eae6-4a22-bdc3-01a5a6952331",
"driver": "15737a98-eae6-4a22-bdc3-01a5a6952331",
"status": "arrived"
})
Journey({
"id": "877c41d5-5677-405d-a19d-73ff2e27e2e1",
"startingPoint": Location({
"address": "5 Galvin Street Strongsville, OH 44136"
"latitude": 42.2123441,
"longitude": 71.043143
}),
"destination": Location({
"address": "931 Wakefield Street, OH 44136",
"latitude":42.26524,
"longitude": 71.18643
}),
"passenger": "05737a99-eae6-4a22-bdc3-01a5a6952331",
"driver": "15737a98-eae6-4a22-bdc3-01a5a6952331",
"status": "complete"
})
and unique constraints requires hacks...