fourlabs/gmail-doctrine-bundle

Doctrine Implementation of fourlabs/gmail-bundle

0.1.0 2017-02-23 15:37 UTC

This package is auto-updated.

Last update: 2024-04-22 06:29:38 UTC


README

GmailDoctrineBundle provides you a Doctrine implementation of GmailBundle.

StyleCI SensioLabsInsight

Installation

    $ composer require fourlabs/gmail-doctrine-bundle

Configuration

// app/config/config.yml
    
fl_gmail_doctrine:
  sync_setting_class: TriprHqBundle\Entity\GmailSyncSetting

Setup

  • Create doctrine entities in your entities folder e.g. AppBundle\Entity.
  • These entities must extend all the MappedSuperClasses in this bundle's Entity folder.
  • Make sure you use the provided repositories (from the entity folder). Or extend the repositories.
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use FL\GmailDoctrineBundle\Entity\SyncSetting;

/**
 * @ORM\Entity(repositoryClass="FL\GmailDoctrineBundle\Entity\SyncSettingRepository")
 */
class GmailSyncSetting extends SyncSetting
{
}

Why GmailDoctrineBundle?

  • A sync command that lets you sync gmailIds, gmailMessages, or both. i.e. with two options:
    • Example php bin/console fl:gmail_doctrine:sync --mode=both --limit_messages_per_user=100.
    • Required Option mode: Can be gmail_ids, gmail_messages, or both.
    • Option limit_messages_per_user: Required for mode=gmail_ids or mode=both. Must be a positive integer.
    • Suggestion: allow enough space between syncs so that you don't sync the same messages twice. Messages won't be saved to the database twice, but you might experience throttling.
    • Note: Messages are requested in batch, 45 at a time. Each batch request takes about 2 seconds.
    • Suggestion: Set a limit of 315 message per user. 7 batches * 2 seconds per batch = 14 seconds. This means you must leave at least 14 * number of users seconds between requests.
    • Note: Before running the sync for both, make sure to run the sync for gmail_ids at least once.
  • Event Listeners, that will save what we fetch from Google into the database. See more at the EventListener folder.
  • FL\GmailDoctrineBundle\Entity\SyncSetting entity:
    • Allows you to pick which email inboxes you want to sync, and send email from.
    • See corresponding form, FL\GmailDoctrineBundle\Form\Type\SyncSettingType.
  • FL\GmailDoctrineBundle\Model\OutgoingEmail model class:
    • Represents an Outgoing Email.
    • See corresponding form, FL\GmailDoctrineBundle\Form\Type\OutgoingEmailType.
    • From field, according to what you have enabled through FL\GmailDoctrineBundle\Entity\SyncSetting.
  • FL\GmailDoctrineBundle\Services\GoogleClientStatusWrapper is a wrapper for FL\GmailBundle\Services\GoogleClientStatus.
    • Copies the authentication method, GoogleClientStatusWrapper::isAuthenticated.
    • And two more methods GoogleClientStatusWrapper::isSetupForDomain(string $domain) and GoogleClientStatusWrapper::isSetupForAtLeastOneDomain()

License

GmailDoctrineBundle is licensed under the MIT license.