-
-
Save mdjaman/8dc5a9966ed5c556e3f1b20e94ebfd45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyNamespace\YouTube; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @ODM\Document(db="analytics", collection="youtube") | |
* @ODM\InheritanceType("SINGLE_COLLECTION") | |
* @ODM\DiscriminatorField("type") | |
* @ODM\DiscriminatorMap({ | |
* "video" = "VideoMetric", | |
* "channel" = "ChannelMetric" | |
* }) | |
*/ | |
abstract class AbstractMetric | |
{ | |
/** | |
* @ODM\Id(strategy="none") | |
*/ | |
protected $id; | |
/** | |
* @ODM\Field(name="id", type="string") | |
* | |
* @var string | |
*/ | |
protected $elementId; | |
/** | |
* @ODM\Field(name="timestamp", type="date") | |
* | |
* @var \DateTime | |
*/ | |
protected $time; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyNamespace\YouTube; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @ODM\Document | |
*/ | |
class ChannelMetric extends AbstractMetric | |
{ | |
/** | |
* @ODM\EmbedOne(name="data", targetDocument="ChannelMetricData") | |
* | |
* @var ChannelMetricData | |
*/ | |
public $data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyNamespace\YouTube; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @ODM\EmbeddedDocument | |
*/ | |
class ChannelMetricData | |
{ | |
/** | |
* @ODM\Field(name="account", type="string") | |
* | |
* @var string | |
*/ | |
protected $account; | |
/** | |
* @ODM\Field(name="title", type="string") | |
* | |
* @var string | |
*/ | |
protected $title; | |
/** | |
* @ODM\Field(name="subscribers", type="int") | |
* | |
* @var integer | |
*/ | |
protected $subscribers; | |
/** | |
* @ODM\Field(name="channel_views", type="int") | |
* | |
* @var integer | |
*/ | |
protected $channelViews; | |
/** | |
* @ODM\Field(name="upload_views", type="int") | |
* | |
* @var integer | |
*/ | |
protected $uploadViews; | |
/** | |
* @ODM\Field(name="uploads", type="int") | |
* | |
* @var integer | |
*/ | |
protected $uploads; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyNamespace\YouTube; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @ODM\Document | |
*/ | |
class VideoMetric extends AbstractMetric | |
{ | |
/** | |
* @ODM\EmbedOne(name="data", targetDocument="VideoMetricData") | |
* | |
* @var VideoMetricData | |
*/ | |
public $data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyNamespace\YouTube; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | |
/** | |
* @ODM\EmbeddedDocument | |
*/ | |
class VideoMetricData | |
{ | |
/** | |
* @ODM\Field(name="id", type="string") | |
*/ | |
protected $id; | |
/** | |
* @ODM\Field(name="account", type="string") | |
* | |
* @var string | |
*/ | |
protected $account; | |
/** | |
* @ODM\Field(name="title", type="string") | |
* | |
* @var string | |
*/ | |
protected $title; | |
/** | |
* @ODM\Field(name="views", type="int") | |
* | |
* @var integer | |
*/ | |
protected $views; | |
/** | |
* @ODM\Field(name="likes", type="int") | |
* | |
* @var integer | |
*/ | |
protected $likes; | |
/** | |
* @ODM\Field(name="dislikes", type="int") | |
* | |
* @var integer | |
*/ | |
protected $dislikes; | |
/** | |
* @ODM\Field(name="comments", type="int") | |
* | |
* @var integer | |
*/ | |
protected $comments; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment