Initial commit: CloudOps infrastructure platform

This commit is contained in:
root
2026-04-09 19:58:57 +02:00
commit 1166a52f26
7762 changed files with 839452 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
#[ORM\Table(name: 'monitoring_leads')]
#[ORM\Entity(repositoryClass: LeadRepository::class)]
class Lead
{
/**
* @var Monitoring
*/
private $monitor;
/**
* @var \Mautic\LeadBundle\Entity\Lead
*/
private $lead;
/**
* @var \DateTimeInterface
*/
private $dateAdded;
public static function loadMetadata(ORM\ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('monitoring_leads')
->setCustomRepositoryClass(LeadRepository::class);
$builder->createManyToOne('monitor', 'Monitoring')
->isPrimaryKey()
->addJoinColumn('monitor_id', 'id', false, false, 'CASCADE')
->build();
$builder->addLead(false, 'CASCADE', true);
$builder->addNamedField('dateAdded', 'datetime', 'date_added');
}
/**
* @return mixed
*/
public function getDateAdded()
{
return $this->dateAdded;
}
/**
* @return $this
*/
public function setDateAdded($dateAdded)
{
$this->dateAdded = $dateAdded;
return $this;
}
/**
* @return mixed
*/
public function getLead()
{
return $this->lead;
}
/**
* @return $this
*/
public function setLead($lead)
{
$this->lead = $lead;
return $this;
}
/**
* @return mixed
*/
public function getMonitor()
{
return $this->monitor;
}
/**
* @return $this
*/
public function setMonitor($monitor)
{
$this->monitor = $monitor;
return $this;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Lead>
*/
class LeadRepository extends CommonRepository
{
}

View File

@@ -0,0 +1,404 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\CoreBundle\Entity\FormEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;
class Monitoring extends FormEntity
{
/**
* @var int
*/
private $id;
/**
* @var string
*/
private $title;
/**
* @var string|null
*/
private $description;
/**
* @var \Mautic\CategoryBundle\Entity\Category|null
*/
private $category;
/**
* @var array
*/
private $lists = [];
/**
* @var string|null
*/
private $networkType;
/**
* @var int
*/
private $revision = 1;
/**
* @var array
*/
private $stats = [];
/**
* @var array
*/
private $properties = [];
/**
* @var \DateTimeInterface
*/
private $publishDown;
/**
* @var \DateTimeInterface
*/
private $publishUp;
public static function loadMetadata(ORM\ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('monitoring')
->setCustomRepositoryClass(MonitoringRepository::class)
->addLifecycleEvent('cleanMonitorData', 'preUpdate')
->addLifecycleEvent('cleanMonitorData', 'prePersist');
$builder->addCategory();
$builder->addIdColumns('title');
$builder->addNullableField('lists', 'array');
$builder->addNamedField('networkType', 'string', 'network_type', true);
$builder->addField('revision', 'integer');
$builder->addNullableField('stats', 'array');
$builder->addNullableField('properties', 'array');
$builder->addPublishDates();
}
/**
* Constraints for required fields.
*/
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('title', new Assert\NotBlank(
['message' => 'mautic.core.title.required']
));
$metadata->addPropertyConstraint('networkType', new Assert\NotBlank(
['message' => 'mautic.social.network.type']
));
}
/**
* @return mixed
*/
public function getCategory()
{
return $this->category;
}
/**
* Get description.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get lists.
*
* @return array
*/
public function getLists()
{
return $this->lists;
}
/**
* Get network type.
*
* @return string
*/
public function getNetworkType()
{
return $this->networkType;
}
/**
* Get revision.
*
* @return int
*/
public function getRevision()
{
return $this->revision;
}
/**
* Get statistics.
*
* @return array
*/
public function getStats()
{
return $this->stats;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Get properties.
*
* @return array
*/
public function getProperties()
{
return $this->properties;
}
/**
* Get publishDown.
*
* @return \DateTimeInterface
*/
public function getPublishDown()
{
return $this->publishDown;
}
/**
* Get publishUp.
*
* @return \DateTimeInterface
*/
public function getPublishUp()
{
return $this->publishUp;
}
/**
* Set the category id.
*
* @param \Mautic\CategoryBundle\Entity\Category|null $category
*/
public function setCategory($category): void
{
$this->isChanged('category', $category);
$this->category = $category;
}
/**
* Set description.
*
* @param string $description
*
* @return Monitoring
*/
public function setDescription($description)
{
$this->isChanged('description', $description);
$this->description = $description;
return $this;
}
/**
* Set the monitor lists.
*
* @return Monitoring
*/
public function setLists($lists)
{
$this->isChanged('lists', $lists);
$this->lists = $lists;
return $this;
}
/**
* Set the network type.
*
* @return Monitoring
*/
public function setNetworkType($networkType)
{
$this->isChanged('networkType', $networkType);
$this->networkType = $networkType;
return $this;
}
/**
* Set the revision counter.
*
* @param int $revision
*
* @return Monitoring
*/
public function setRevision($revision)
{
$this->isChanged('revision', $revision);
$this->revision = $revision;
return $this;
}
/**
* Set the statistics.
*
* @param array $stats
*
* @return Monitoring
*/
public function setStats($stats)
{
$this->isChanged('stats', $stats);
$this->stats = $stats;
return $this;
}
/**
* Set name.
*
* @param string $title
*
* @return Monitoring
*/
public function setTitle($title)
{
$this->isChanged('title', $title);
$this->title = $title;
return $this;
}
/**
* Set properties.
*
* @param array $properties
*
* @return Monitoring
*/
public function setProperties($properties)
{
$this->isChanged('properties', $properties);
$this->properties = $properties;
return $this;
}
/**
* Set publishDown.
*
* @param \DateTime $publishDown
*
* @return Monitoring
*/
public function setPublishDown($publishDown)
{
$this->isChanged('publishDown', $publishDown);
$this->publishDown = $publishDown;
return $this;
}
/**
* Set publishUp.
*
* @param \DateTime $publishUp
*
* @return Monitoring
*/
public function setPublishUp($publishUp)
{
$this->isChanged('publishUp', $publishUp);
$this->publishUp = $publishUp;
return $this;
}
/**
* Clear out old properties data.
*/
public function cleanMonitorData(): void
{
$property = $this->getProperties();
if (!array_key_exists('checknames', $property)) {
$property['checknames'] = 0;
}
// clean up property array for the twitter handle
if ('twitter_handle' == $this->getNetworkType()) {
$this->setProperties(
[
'handle' => $property['handle'],
'checknames' => $property['checknames'],
]
);
}
// clean up property array for the hashtag
if ('twitter_hashtag' == $this->getNetworkType()) {
$this->setProperties(
[
'hashtag' => $property['hashtag'],
'checknames' => $property['checknames'],
]
);
}
// clean up clean up property array for the custom action
if ('twitter_custom' == $this->getNetworkType()) {
$this->setProperties(
[
'custom' => $property['custom'],
]
);
}
// if the property is not new and the old property doesn't match the new one
if (!$this->isNew() && $property != $this->getProperties()) {
// reset stats on save of edited
$this->setStats([]);
}
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\ORM\Tools\Pagination\Paginator;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Monitoring>
*/
class MonitoringRepository extends CommonRepository
{
/**
* @param array $args
*
* @return Paginator
*/
public function getPublishedEntities($args = [])
{
$q = $this->createQueryBuilder($this->getTableAlias());
$expr = $this->getPublishedByDateExpression($q);
$q->where($expr);
$args['qb'] = $q;
return parent::getEntities($args);
}
public function getPublishedEntitiesCount(): int
{
$q = $this->createQueryBuilder($this->getTableAlias());
$expr = $this->getPublishedByDateExpression($q);
$q->where($expr);
$args['qb'] = $q;
return count(parent::getEntities($args));
}
/**
* @param \Doctrine\ORM\QueryBuilder|\Doctrine\DBAL\Query\QueryBuilder $q
*/
protected function addCatchAllWhereClause($q, $filter): array
{
return $this->addStandardCatchAllWhereClause(
$q,
$filter,
[
$this->getTableAlias().'.title',
$this->getTableAlias().'.description',
]
);
}
/**
* @param \Doctrine\ORM\QueryBuilder|\Doctrine\DBAL\Query\QueryBuilder $q
*/
protected function addSearchCommandWhereClause($q, $filter): array
{
return $this->addStandardSearchCommandWhereClause($q, $filter);
}
public function getTableAlias(): string
{
return 'e';
}
/**
* @return string[]
*/
public function getSearchCommands(): array
{
return $this->getStandardSearchCommands();
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
class PostCount
{
/**
* @var int
*/
private $id;
/**
* @var Monitoring|null
*/
private $monitor;
/**
* @var \DateTimeInterface
*/
private $postDate;
/**
* @var int
*/
private $postCount;
public static function loadMetadata(ORM\ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('monitor_post_count')
->setCustomRepositoryClass(PostCountRepository::class);
$builder->addId();
$builder->createManyToOne('monitor', 'Monitoring')
->addJoinColumn('monitor_id', 'id', true, false, 'CASCADE')
->build();
$builder->addNamedField('postDate', 'date', 'post_date');
$builder->addNamedField('postCount', 'integer', 'post_count');
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return Monitoring
*/
public function getMonitor()
{
return $this->monitor;
}
/**
* @param Monitoring $monitor
*
* @return $this
*/
public function setMonitor($monitor)
{
$this->monitor = $monitor;
return $this;
}
/**
* @return int
*/
public function getPostCount()
{
return $this->postCount;
}
/**
* @param int $postCount
*
* @return $this
*/
public function setPostCount($postCount)
{
$this->postCount = $postCount;
return $this;
}
/**
* @return \DateTimeInterface
*/
public function getPostDate()
{
return $this->postDate;
}
/**
* @return $this
*/
public function setPostDate($postDate)
{
$this->postDate = $postDate;
return $this;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
use Mautic\CoreBundle\Helper\Chart\ChartQuery;
/**
* @extends CommonRepository<PostCount>
*/
class PostCountRepository extends CommonRepository
{
/**
* Fetch Lead stats for some period of time.
*
* @param array $options
*
* @return PostCount[]
*
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function getLeadStatsPost($dateFrom, $dateTo, $options): array
{
$chartQuery = new ChartQuery($this->getEntityManager()->getConnection(), $dateFrom, $dateTo);
// Load points for selected periods
$q = $chartQuery->prepareTimeDataQuery(MAUTIC_TABLE_PREFIX.'monitor_post_count', 'post_date', $options, 'post_count', 'sum');
if (isset($options['monitor_id'])) {
$q->andwhere($q->expr()->eq('t.monitor_id', (int) $options['monitor_id']));
}
return $chartQuery->loadAndBuildTimeData($q);
}
}

View File

@@ -0,0 +1,475 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Mautic\ApiBundle\Serializer\Driver\ApiMetadataDriver;
use Mautic\AssetBundle\Entity\Asset;
use Mautic\CategoryBundle\Entity\Category;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\CoreBundle\Entity\FormEntity;
use Mautic\PageBundle\Entity\Page;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Mapping\ClassMetadata;
#[ORM\Table(name: 'tweets')]
#[ORM\Entity(repositoryClass: TweetRepository::class)]
class Tweet extends FormEntity
{
/**
* Internal Mautic ID of the tweet.
*
* @var int
*/
private $id;
/**
* ID of the Twitter media object attached to the tweet.
*
* @var string|null
*/
private $mediaId;
/**
* Path to the local media file.
*
* @var string|null
*/
private $mediaPath;
/**
* Internal Mautic name of the tweet.
*
* @var string
*/
private $name;
/**
* The actual messge of the tweet.
*
* @var string
*/
private $text;
/**
* Internal Mautic description.
*
* @var string|null
*/
private $description;
/**
* @var string|null
*/
private $language = 'en';
/**
* @var int|null
*/
private $sentCount = 0;
/**
* @var int|null
*/
private $favoriteCount = 0;
/**
* @var int|null
*/
private $retweetCount = 0;
/**
* @var Page|null
*/
private $page;
/**
* @var Asset|null
*/
private $asset;
/**
* @var Category|null
**/
private $category;
/**
* @var ArrayCollection<int, TweetStat>
*/
private $stats;
public function __construct()
{
$this->stats = new ArrayCollection();
}
public function __clone()
{
$this->id = null;
$this->sentCount = 0;
$this->favoriteCount = 0;
$this->retweetCount = 0;
$this->stats = new ArrayCollection();
parent::__clone();
}
public static function loadMetadata(ORM\ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('tweets')
->setCustomRepositoryClass(TweetRepository::class)
->addIndex(['sent_count'], 'sent_count_index')
->addIndex(['favorite_count'], 'favorite_count_index')
->addIndex(['retweet_count'], 'retweet_count_index');
$builder->addIdColumns();
$builder->addCategory();
$builder->addNullableField('mediaId', Types::STRING, 'media_id');
$builder->addNullableField('mediaPath', Types::STRING, 'media_path');
$builder->addField('text', Types::STRING, ['length' => 280]);
$builder->addNullableField('sentCount', Types::INTEGER, 'sent_count');
$builder->addNullableField('favoriteCount', Types::INTEGER, 'favorite_count');
$builder->addNullableField('retweetCount', Types::INTEGER, 'retweet_count');
$builder->addNullableField('language', Types::STRING, 'lang');
$builder->createManyToOne('page', Page::class)
->addJoinColumn('page_id', 'id', true, false, 'SET NULL')
->build();
$builder->createManyToOne('asset', Asset::class)
->addJoinColumn('asset_id', 'id', true, false, 'SET NULL')
->build();
$builder->createOneToMany('stats', 'TweetStat')
->setIndexBy('id')
->mappedBy('tweet')
->cascadePersist()
->fetchExtraLazy()
->build();
}
/**
* Prepares the metadata for API usage.
*/
public static function loadApiMetadata(ApiMetadataDriver $metadata): void
{
$metadata->setGroupPrefix('tweet')
->addListProperties(
[
'id',
'name',
'text',
'language',
'category',
]
)
->addProperties(
[
'mediaId',
'mediaPath',
'sentCount',
'favoriteCount',
'retweetCount',
'description',
]
)
->build();
}
/**
* Constraints for required fields.
*/
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
$metadata->addPropertyConstraint('text', new Assert\Length(
[
'max' => 280,
]
));
}
/**
* @return int|null
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return $this
*/
public function setName($name)
{
$this->isChanged('name', $name);
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string|null $description
*
* @return $this
*/
public function setDescription($description)
{
$this->isChanged('description', $description);
$this->description = $description;
return $this;
}
/**
* @return string|null
*/
public function getMediaId()
{
return $this->mediaId;
}
/**
* @param string $mediaId
*
* @return $this
*/
public function setMediaId($mediaId)
{
$this->isChanged('mediaId', $mediaId);
$this->mediaId = $mediaId;
return $this;
}
/**
* @return string|null
*/
public function getMediaPath()
{
return $this->mediaPath;
}
/**
* @param string $mediaPath
*
* @return $this
*/
public function setMediaPath($mediaPath)
{
$this->isChanged('mediaPath', $mediaPath);
$this->mediaPath = $mediaPath;
return $this;
}
/**
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @param string $text
*
* @return $this
*/
public function setText($text)
{
$this->isChanged('text', $text);
$this->text = $text;
return $this;
}
/**
* @return int|null
*/
public function getSentCount()
{
return $this->sentCount;
}
/**
* @return $this
*/
public function setSentCount($sentCount)
{
$this->isChanged('sentCount', $sentCount);
$this->sentCount = $sentCount;
return $this;
}
/**
* Add 1 to sentCount.
*
* @return $this
*/
public function sentCountUp()
{
$this->setSentCount($this->getSentCount() + 1);
return $this;
}
/**
* @return int
*/
public function getFavoriteCount()
{
return $this->favoriteCount;
}
/**
* @param int $favoriteCount
*
* @return $this
*/
public function setFavoriteCount($favoriteCount)
{
$this->isChanged('favoriteCount', $favoriteCount);
$this->favoriteCount = $favoriteCount;
return $this;
}
/**
* @return int
*/
public function getRetweetCount()
{
return $this->retweetCount;
}
/**
* @param int $retweetCount
*
* @return $this
*/
public function setRetweetCount($retweetCount)
{
$this->isChanged('retweetCount', $retweetCount);
$this->retweetCount = $retweetCount;
return $this;
}
/**
* @return string
*/
public function getLanguage()
{
return $this->language;
}
/**
* @param string $language
*
* @return $this
*/
public function setLanguage($language)
{
$this->isChanged('language', $language);
$this->language = $language;
return $this;
}
/**
* @return Asset|null
*/
public function getAsset()
{
return $this->asset;
}
/**
* @return $this
*/
public function setAsset(Asset $asset)
{
$this->asset = $asset;
return $this;
}
/**
* @return Page|null
*/
public function getPage()
{
return $this->page;
}
/**
* @return $this
*/
public function setPage(Page $page)
{
$this->page = $page;
return $this;
}
/**
* @return Category|null
*/
public function getCategory()
{
return $this->category;
}
/**
* @return $this
*/
public function setCategory(Category $category)
{
$this->category = $category;
return $this;
}
/**
* @return mixed
*/
public function getStats()
{
return $this->stats;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<Tweet>
*/
class TweetRepository extends CommonRepository
{
/**
* @param string $search
* @param int $limit
* @param int $start
* @param bool $viewOther
*
* @return array
*/
public function getTweetList($search = '', $limit = 10, $start = 0, $viewOther = false, array $ignoreIds = [])
{
$qb = $this->createQueryBuilder('t');
$qb->select('partial t.{id, text, name, language}');
if (!empty($search)) {
if (is_array($search)) {
$search = array_map('intval', $search);
$qb->andWhere($qb->expr()->in('t.id', ':search'))
->setParameter('search', $search);
} else {
$qb->andWhere($qb->expr()->like('t.name', ':search'))
->setParameter('search', "%{$search}%");
}
}
if (!$viewOther) {
$qb->andWhere($qb->expr()->eq('t.createdBy', ':id'))
->setParameter('id', $this->currentUser->getId());
}
if (!empty($ignoreIds)) {
$qb->andWhere($qb->expr()->notIn('t.id', ':ignoreIds'))
->setParameter('ignoreIds', $ignoreIds);
}
$qb->orderBy('t.name');
if (!empty($limit)) {
$qb->setFirstResult($start)
->setMaxResults($limit);
}
return $qb->getQuery()->getArrayResult();
}
}

View File

@@ -0,0 +1,395 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Mautic\ApiBundle\Serializer\Driver\ApiMetadataDriver;
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
use Mautic\LeadBundle\Entity\Lead as TheLead;
class TweetStat
{
/**
* @var int
*/
private $id;
/**
* ID of the tweet from Twitter.
*
* @var string|null
*/
private $twitterTweetId;
/**
* @var Tweet|null
*/
private $tweet;
/**
* @var TheLead|null
*/
private $lead;
/**
* @var string
*/
private $handle;
/**
* @var DateTime
*/
private $dateSent;
/**
* @var bool|null
*/
private $isFailed = false;
/**
* @var int|null
*/
private $retryCount = 0;
/**
* @var string|null
*/
private $source;
/**
* @var int|null
*/
private $sourceId;
/**
* @var int|null
*/
private $favoriteCount = 0;
/**
* @var int|null
*/
private $retweetCount = 0;
/**
* @var array|null
*/
private $responseDetails = [];
public static function loadMetadata(ORM\ClassMetadata $metadata): void
{
$builder = new ClassMetadataBuilder($metadata);
$builder->setTable('tweet_stats')
->setCustomRepositoryClass(TweetStatRepository::class)
->addIndex(['tweet_id', 'lead_id'], 'stat_tweet_search')
->addIndex(['lead_id', 'tweet_id'], 'stat_tweet_search2')
->addIndex(['is_failed'], 'stat_tweet_failed_search')
->addIndex(['source', 'source_id'], 'stat_tweet_source_search')
->addIndex(['favorite_count'], 'favorite_count_index')
->addIndex(['retweet_count'], 'retweet_count_index')
->addIndex(['date_sent'], 'tweet_date_sent')
->addIndex(['twitter_tweet_id'], 'twitter_tweet_id_index');
$builder->addId();
$builder->createManyToOne('tweet', 'Tweet')
->inversedBy('stats')
->addJoinColumn('tweet_id', 'id', true, false, 'SET NULL')
->build();
$builder->createField('twitterTweetId', 'string')
->columnName('twitter_tweet_id')
->nullable()
->build();
$builder->addLead(true, 'SET NULL');
$builder->createField('handle', 'string')
->build();
$builder->createField('dateSent', 'datetime')
->columnName('date_sent')
->nullable()
->build();
$builder->createField('isFailed', 'boolean')
->columnName('is_failed')
->nullable()
->build();
$builder->createField('retryCount', 'integer')
->columnName('retry_count')
->nullable()
->build();
$builder->createField('source', 'string')
->nullable()
->build();
$builder->createField('sourceId', 'integer')
->columnName('source_id')
->nullable()
->build();
$builder->addNullableField('favoriteCount', 'integer', 'favorite_count');
$builder->addNullableField('retweetCount', 'integer', 'retweet_count');
$builder->addNullableField('responseDetails', Types::JSON, 'response_details');
}
/**
* Prepares the metadata for API usage.
*/
public static function loadApiMetadata(ApiMetadataDriver $metadata): void
{
$metadata->setGroupPrefix('stat')
->addProperties(
[
'id',
'tweetId',
'handle',
'dateSent',
'isFailed',
'retryCount',
'favoriteCount',
'retweetCount',
'source',
'sourceId',
'lead',
'tweet',
'responseDetails',
]
)
->build();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return string|null
*/
public function getTwitterTweetId()
{
return $this->twitterTweetId;
}
/**
* @param string $twitterTweetId
*
* @return $this
*/
public function setTwitterTweetId($twitterTweetId)
{
$this->twitterTweetId = $twitterTweetId;
return $this;
}
/**
* @return mixed
*/
public function getDateSent()
{
return $this->dateSent;
}
/**
* @param mixed $dateSent
*/
public function setDateSent($dateSent): void
{
$this->dateSent = $dateSent;
}
/**
* @return Tweet
*/
public function getTweet()
{
return $this->tweet;
}
/**
* @param mixed $tweet
*/
public function setTweet(?Tweet $tweet = null): void
{
$this->tweet = $tweet;
}
/**
* @return TheLead
*/
public function getLead()
{
return $this->lead;
}
/**
* @param mixed $lead
*/
public function setLead(?TheLead $lead = null): void
{
$this->lead = $lead;
}
/**
* @return mixed
*/
public function getRetryCount()
{
return $this->retryCount;
}
/**
* @param mixed $retryCount
*/
public function setRetryCount($retryCount): void
{
$this->retryCount = $retryCount;
}
public function retryCountUp(): void
{
$this->setRetryCount($this->getRetryCount() + 1);
}
/**
* @return int
*/
public function getFavoriteCount()
{
return $this->favoriteCount;
}
/**
* @param int $favoriteCount
*
* @return $this
*/
public function setFavoriteCount($favoriteCount)
{
$this->favoriteCount = $favoriteCount;
return $this;
}
/**
* @return int
*/
public function getRetweetCount()
{
return $this->retweetCount;
}
/**
* @param int $retweetCount
*
* @return $this
*/
public function setRetweetCount($retweetCount)
{
$this->retweetCount = $retweetCount;
return $this;
}
/**
* @return mixed
*/
public function getIsFailed()
{
return $this->isFailed;
}
/**
* @param mixed $isFailed
*/
public function setIsFailed($isFailed): void
{
$this->isFailed = $isFailed;
}
/**
* @return mixed
*/
public function isFailed()
{
return $this->getIsFailed();
}
/**
* @return string|null
*/
public function getHandle()
{
return $this->handle;
}
/**
* @param mixed $handle
*/
public function setHandle($handle): void
{
$this->handle = $handle;
}
/**
* @return mixed
*/
public function getSource()
{
return $this->source;
}
/**
* @param mixed $source
*/
public function setSource($source): void
{
$this->source = $source;
}
/**
* @return mixed
*/
public function getSourceId()
{
return $this->sourceId;
}
/**
* @param mixed $sourceId
*/
public function setSourceId($sourceId): void
{
$this->sourceId = (int) $sourceId;
}
/**
* @return mixed
*/
public function getResponseDetails()
{
return $this->responseDetails;
}
/**
* @param mixed $responseDetails
*
* @return Stat
*/
public function setResponseDetails($responseDetails)
{
$this->responseDetails = $responseDetails;
return $this;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace MauticPlugin\MauticSocialBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<TweetStat>
*/
class TweetStatRepository extends CommonRepository
{
}