Commit graph

15 commits

Author SHA1 Message Date
Mike Colagrosso
65d1dcdd88 Use the NOW constant from eec7971 2024-11-04 13:16:56 -06:00
Mike Colagrosso
df8eac6f82 Rename GitCommit::FromLogLine and have it accept the full line 2024-11-04 13:16:56 -06:00
Mike Colagrosso
6bec232d37 Remove checks against EBOOK_EARLIEST_CREATION_DATE 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2eb7fef027 Remove primary key GitCommitId
The table already has a Created column, and that's the column we use to sort on.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
85307a7c7e Standardize trim and other validation of nullable and non-nullable properties 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2378320d0c Contributor, EbookSource, GitCommit: Move INSERT statements to Create() methods 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c8d5dfb11f Add properties that were previously omitted
PHP 8.3 (part of Ubuntu 24.04) outputs a deprecated warning for properties that
were not in the class definition. Error below. There were a few of these
missing from the `Ebook`, `GitCommit`, `CollectionMembership`, `EbookSource`,
and `Contributor` classes. Adding them doesn't change any functionality, but it
does make it clearer what properties a class has.

Some of these properties are never set for `Ebook` instances created from the
filesystem, i.e., `Created` and `Updated`, and some of them need to be manually
set to make `Ebook` instances from the filesystem and the database match, e.g.,
`GitCommitId`, `CollectionEbookId`, `EbookSourceId`, and `ContributorId`.
Making the `Ebook` instances from the filesystem and the database match each
other makes it easier to spot bugs in the future.

Previous errors with PHP 8.3:

```
PHP Deprecated:  Creation of dynamic property Ebook::$Created is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property Ebook::$Updated is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property CollectionMembership::$CollectionEbookId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property CollectionMembership::$EbookId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property CollectionMembership::$CollectionId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookSourceId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookSourceId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$ContributorId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$SortOrder is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
```
2024-11-04 13:16:56 -06:00
Mike Colagrosso
2098b265a8 Rename the constructor Ebook::__construct() to static Ebook::FromFilesystem()
Also added `GetFoo()` methods for all the derived properties like `GetUrl()`, `GetHasDownloads()`, etc. Removed that logic from the constructor so that it's reusable in `Ebook::FromFilesystem()` and `Ebook::GetByIdentifier()`
2024-11-04 13:16:56 -06:00
Alex Cabal
c4c8e7353f Enable strict exception type hint checking in PHPStan and add exception type hints 2024-05-10 20:47:36 -05:00
Alex Cabal
783c09864f Add type hints for remaining classes 2024-01-08 16:08:57 -06:00
Alex Cabal
dbefba6b94 Change 'timestamp' properties on objects to more descriptive names 2022-06-29 17:19:28 -05:00
Alex Cabal
25c40e3e67 Add link to Github for each commit in an ebooks short commit history 2020-06-03 12:01:09 -05:00
Alex Cabal
bef5aea7ad Add type hints and some other tweaks to satisfy PHPStan 2020-03-01 11:36:20 -06:00
Alex Cabal
def275ab3c Remove closing tags from pure PHP files 2019-04-03 16:25:00 -05:00
Alex Cabal
28c8a3f0ba Initial commit 2018-12-29 16:02:00 -06:00