Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sonata Republicandate Field Bundle Laravel Package

aschaeffer/sonata-republicandate-field-bundle

View on GitHub
Deep Wiki
Context7

Sonata Republicandate Field Bundle

Sonata Republicandate Field Bundle allow you to define text field which will store date in french republican format

Installation

Install the package with:

composer require aschaeffer/sonata-republicandate-field-bundle

If you're not using Symfony Flex, you'll also need to enable the Aschaeffer\SonataRepublicandateFieldBundle\AschaefferSonataRepublicandateFieldBundle in your AppKernel.php file.

Usage

In your entity, add RepublicandateField annotation on a string property that will store the string. Set which property of the entity stores the corresponding datetime

<?php

class User {

   /**
     * @ORM\Column(type="date", nullable=true)
     */
    protected \DateTime $birthday;
       
    /**
     * @ORM\Column(type="string", nullable=true)
     * @RepublicandateField(gregorianDate="birthday")
     */
    protected string $birthdayRepublican;
}

By doing this, on a Sonata Admin view, if you choose a gregorian date that exists in the republican calendar, the republican date string will be persisted in the database. On the other hand, if no gregorian date is set AND a republican date is defined, then the datetime will be persisted in the gregorian field.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log