Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancements - v2 #1

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

enhancements - v2 #1

wants to merge 5 commits into from

Conversation

rasstislav
Copy link
Contributor

@rasstislav rasstislav commented Sep 9, 2023

Hello,

First of all, thank you for this module :-).

I have a few improvements. You can view them and possibly create a new version 2.0.0.

@rasstislav rasstislav changed the title enhancements enhancements v2 Sep 9, 2023
@rasstislav rasstislav changed the title enhancements v2 enhancements - v2 Sep 9, 2023
@bimthebam
Copy link
Owner

Hi @rasstislav thank you for your contributions. I'll try to have a look at them today.

Copy link
Owner

@bimthebam bimthebam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Cherry picked

Copy link
Owner

@bimthebam bimthebam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Cherry picked

@rasstislav
Copy link
Contributor Author

commit 69ae849 (BREAKING CHANGE) allows configuration such as:

class Decision extends DataObject
{
    private static $db = [
        'ECLI' => 'Varchar(40)',
        'DeliveryDate' => 'Date',
    ];

    private static $has_one = [
        'CaseFile' => CaseFile::class,
    ];

    private static $belongs_to = [
        'DecisionAnonymizedText' => DecisionAnonymizedText::class . '.Decision',
    ];

    private static $many_many = [
        'Keywords' => [
            'through' => DecisionKeyword::class,
            'from' => 'Decision',
            'to' => 'Keyword',
        ],
        'JoinedCaseFiles' => [
            'through' => DecisionJoinedCaseFile::class,
            'from' => 'Decision',
            'to' => 'CaseFile',
        ],
    ];

    private static $meilisearch_searchable_fields = [
        'Header' => 'DecisionAnonymizedText.Header',
        'OperativePart' => 'DecisionAnonymizedText.OperativePart',
        'Reasoning' => 'DecisionAnonymizedText.Reasoning',
        'Instruction' => 'DecisionAnonymizedText.Instruction',
    ];

    private static $meilisearch_filterable_fields = [
        'CaseFile' => 'CaseFile.Title',
        'JoinedCaseFiles' => 'JoinedCaseFilesTitles',
        'ECLI' => 'ECLI',
        'Merits' => 'CaseFile.Merits',
        'Keywords' => 'KeywordsTitles',
        'AppelateCourtsCaseFileNo' => 'CaseFile.AppelateCourtsCaseFileNo',
        'Division' => 'CaseFile.Register.DivisionID',
        'DeliveryDate' => 'DeliveryDate',
        'InReport' => 'IsInReport',
    ];

    private static $meilisearch_sortable_fields = [
        'DeliveryDate',
    ];

    public function getJoinedCaseFilesTitles()
    {
        return $this->JoinedCaseFiles()->column('Title');
    }

    public function getKeywordsTitles()
    {
        return $this->Keywords()->column('Title');
    }

    public function getIsInReport()
    {
        return $this->CaseFile()->DecisionReports()->exists();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants