DTO's for crawler. Test implementation. Not tested.

This commit is contained in:
Alexey Skobkin 2016-03-16 23:55:41 +03:00
parent c1e01c4738
commit 057481b808
5 changed files with 446 additions and 0 deletions

View file

@ -0,0 +1,59 @@
<?php
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api\Crawler;
use Symfony\Component\Serializer\Annotation as Serializer;
class MetaPost
{
/**
* @var Recommendation
*
* @Serializer\Groups({"import_post_page"})
*/
private $rec;
/**
* @var Post
*
* @Serializer\Groups({"import_post_page"})
*/
private $post;
/**
* @return Recommendation
*/
public function getRec()
{
return $this->rec;
}
/**
* @param Recommendation $rec
* @return MetaPost
*/
public function setRec(Recommendation $rec)
{
$this->rec = $rec;
return $this;
}
/**
* @return Post
*/
public function getPost()
{
return $this->post;
}
/**
* @param Post $post
* @return MetaPost
*/
public function setPost(Post $post)
{
$this->post = $post;
return $this;
}
}

View file

@ -0,0 +1,184 @@
<?php
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api\Crawler;
use Symfony\Component\Serializer\Annotation as Serializer;
class Post
{
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $id;
/**
* @var string[]
*
* @Serializer\Groups({"import_post_page"})
*/
private $tags;
/**
* @var User
*
* @Serializer\Groups({"import_post_page"})
*/
private $author;
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $text;
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $created;
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $type;
/**
* @var bool
*
* @Serializer\Groups({"import_post_page"})
*/
private $private;
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
* @return Post
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string[]
*/
public function getTags()
{
return $this->tags;
}
/**
* @param string[] $tags
* @return Post
*/
public function setTags(array $tags)
{
$this->tags = $tags;
return $this;
}
/**
* @return User
*/
public function getAuthor()
{
return $this->author;
}
/**
* @param User $author
* @return Post
*/
public function setAuthor(User $author)
{
$this->author = $author;
return $this;
}
/**
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @param string $text
* @return Post
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* @return string
*/
public function getCreated()
{
return $this->created;
}
/**
* @param string $created
* @return Post
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
* @return Post
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* @return boolean
*/
public function isPrivate()
{
return $this->private;
}
/**
* @param boolean $private
* @return Post
*/
public function setPrivate($private)
{
$this->private = $private;
return $this;
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api\Crawler;
use Symfony\Component\Serializer\Annotation as Serializer;
class PostsPage
{
/**
* @var MetaPost[]
*
* @Serializer\Groups({"import_post_page"})
*/
private $posts;
/**
* @return MetaPost[]
*/
public function getPosts()
{
return $this->posts;
}
/**
* @param MetaPost[] $posts
* @return PostsPage
*/
public function setPosts(array $posts)
{
$this->posts = $posts;
return $this;
}
}

View file

@ -0,0 +1,84 @@
<?php
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api\Crawler;
use Symfony\Component\Serializer\Annotation as Serializer;
class Recommendation
{
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $text;
/**
* @var int|null
*
* @Serializer\Groups({"import_post_page"})
*/
private $comment_id;
/**
* @var User
*
* @Serializer\Groups({"import_post_page"})
*/
private $author;
/**
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @param string $text
* @return Recommendation
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* @return int|null
*/
public function getComment_id()
{
return $this->comment_id;
}
/**
* @param int|null $comment_id
* @return Recommendation
*/
public function setComment_id($comment_id)
{
$this->comment_id = $comment_id;
return $this;
}
/**
* @return User
*/
public function getAuthor()
{
return $this->author;
}
/**
* @param User $author
* @return Recommendation
*/
public function setAuthor(User $author)
{
$this->author = $author;
return $this;
}
}

View file

@ -0,0 +1,84 @@
<?php
namespace Skobkin\Bundle\PointToolsBundle\DTO\Api\Crawler;
use Symfony\Component\Serializer\Annotation as Serializer;
class User
{
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $id;
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $login;
/**
* @var string
*
* @Serializer\Groups({"import_post_page"})
*/
private $name;
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
* @return User
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* @param string $login
* @return User
*/
public function setLogin($login)
{
$this->login = $login;
return $this;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return User
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}