\TriTan\Common\PostPostMapper

Summary

Methods
Properties
Constants
__construct()
findById()
findBy()
findByType()
findAll()
create()
populate()
insert()
update()
save()
delete()
$db
$context
No constants found
__create()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$db

$db : 

Type

$context

$context : 

Type

Methods

findById()

findById(string  $id) : \TriTan\Common\Post\TriTan\Common\Post\Post|null

Fetch a post object by ID

Parameters

string $id

Returns

\TriTan\Common\Post\TriTan\Common\Post\Post|null —

Returns post object if exist and NULL otherwise.

findBy()

findBy(string  $field, string|integer  $value) : object|false

Return only the main post fields.

Parameters

string $field

The field to query against: 'id', 'ID', 'email' or 'login'.

string|integer $value

The field value

Returns

object|false —

Raw post object

findByType()

findByType(string  $type) : object

Fetch all posts by particular type.

Parameters

string $type

Returns

object —

Post data object.

findAll()

findAll() : object

Fetch all posts.

Returns

object —

Post data object.

create()

create(array  $data = null) : \TriTan\Common\Post\TriTan\Common\Post\Post.

Create a new instance of Post. Optionally populating it from a data array.

Parameters

array $data

Returns

\TriTan\Common\Post\TriTan\Common\Post\Post.

populate()

populate(\TriTan\Common\Post\Post  $post, array  $data) : \TriTan\Common\Post\TriTan\Common\Post\Post

Populate the Post object with the data array.

Parameters

\TriTan\Common\Post\Post $post

object.

array $data

Post data.

Returns

\TriTan\Common\Post\TriTan\Common\Post\Post

insert()

insert(\TriTan\Common\Post\Post  $post) : integer

Inserts a new post into the post document.

Parameters

\TriTan\Common\Post\Post $post

Post object.

Returns

integer —

Last insert id.

update()

update(\TriTan\Common\Post\Post  $post) 

Updates a Post object.

Parameters

\TriTan\Common\Post\Post $post

Post object.

save()

save(\TriTan\Common\Post\Post  $post) 

Save the Post object.

Parameters

\TriTan\Common\Post\Post $post

Post object.

delete()

delete(\TriTan\Common\Post\Post  $post) : boolean

Deletes post object.

Parameters

\TriTan\Common\Post\Post $post

Post object.

Returns

boolean —

True if deleted, false otherwise.

__create()

__create() : \TriTan\Common\Post\TriTan\Common\Post\Post

Create a new Post object.

Returns

\TriTan\Common\Post\TriTan\Common\Post\Post