GmailDoctrineBundle provides you a Doctrine implementation of GmailBundle.
$ composer require fourlabs/gmail-doctrine-bundle
// app/config/config.yml
fl_gmail_doctrine:
sync_setting_class: TriprHqBundle\Entity\GmailSyncSetting
- 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
{
}
- 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 begmail_ids
,gmail_messages
, orboth
. - Option
limit_messages_per_user
: Required formode=gmail_ids
ormode=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 least14 * number of users
seconds between requests. - Note: Before running the sync for
both
, make sure to run the sync forgmail_ids
at least once.
- Example
- 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 forFL\GmailBundle\Services\GoogleClientStatus
.- Copies the authentication method,
GoogleClientStatusWrapper::isAuthenticated
. - And two more methods
GoogleClientStatusWrapper::isSetupForDomain(string $domain)
andGoogleClientStatusWrapper::isSetupForAtLeastOneDomain()
- Copies the authentication method,
GmailDoctrineBundle is licensed under the MIT license.