ImageRepository
extends BaseRepository
in package
implements
IImageRepository
Interfaces, Classes, Traits and Enums
Table of Contents
- $cache : RepositoryCache
- $configTable : string
- $configuration : Configuration
- $db : IDatabase
- $params : array<string|int, mixed>
- $SQL : string
- $sql : string
- SQL statement
- $SQLlimit : string
- $SQLorder : string
- $SQLwhere : string
- $table : string
- Database table name
- $cloudinary : Cloudinary
- $pagination : Pagination
- __construct() : mixed
- all() : array<string|int, Model>
- reads all results of query
- byId() : Model
- Reads specific object by provided id
- delete() : void
- Delete image if it is not default one {@inheritDoc}
- one() : Model
- gets one item from collection
- orderBy() : IRepository
- Enables ordering on results
- save() : int
- Saves the uploaded image with path identifier
- setPagination() : IRepository
- Sets pagination feature enabled
- where() : IRepository
- Builds WHERE clause of query with provided data of array
- executeQuery() : array<string|int, mixed>
- newItem() : Image
- Creates new Domain object from provided data
- deleteFromCloudinary() : void
- deletes image from Cloudinary by public_id
- uploadToCloudinary() : array<string|int, mixed>
- Uploads file to the Cloudinary and applies transformation
Properties
$cache
protected
RepositoryCache
$cache
$configTable
protected
string
$configTable
= '`configuration`'
$configuration
protected
Configuration
$configuration
$db
protected
IDatabase
$db
$params
protected
array<string|int, mixed>
$params
= []
$SQL
protected
string
$SQL
$sql
SQL statement
protected
string
$sql
= ' '
$SQLlimit
protected
string
$SQLlimit
= ''
$SQLorder
protected
string
$SQLorder
= ' ORDER BY `created` DESC'
$SQLwhere
protected
string
$SQLwhere
= ' WHERE 1=1'
$table
Database table name
protected
string
$table
= '`image`'
$cloudinary
private
Cloudinary
$cloudinary
$pagination
private
Pagination
$pagination
Methods
__construct()
public
__construct(ContainerInterface $di, IConfigurationRepository $configuration) : mixed
Parameters
- $di : ContainerInterface
- $configuration : IConfigurationRepository
Return values
mixed —all()
reads all results of query
public
all() : array<string|int, Model>
Return values
array<string|int, Model> —byId()
Reads specific object by provided id
public
byId(int $id) : Model
Parameters
- $id : int
Return values
Model —delete()
Delete image if it is not default one {@inheritDoc}
public
delete(Image $image) : void
Parameters
- $image : Image
Return values
void —one()
gets one item from collection
public
one() : Model
Return values
Model —orderBy()
Enables ordering on results
public
orderBy(string $name[, string $direction = 'DESC' ]) : IRepository
Parameters
- $name : string
- $direction : string = 'DESC'
Return values
IRepository —save()
Saves the uploaded image with path identifier
public
save(UploadedFileInterface $file) : int
Parameters
- $file : UploadedFileInterface
Tags
Return values
int —setPagination()
Sets pagination feature enabled
public
setPagination(Pagination &$pagination) : IRepository
Parameters
- $pagination : Pagination
Return values
IRepository —where()
Builds WHERE clause of query with provided data of array
public
where(array<string|int, mixed> $searchParams) : IRepository
Parameters
- $searchParams : array<string|int, mixed>
Return values
IRepository —executeQuery()
protected
executeQuery() : array<string|int, mixed>
Return values
array<string|int, mixed> —newItem()
Creates new Domain object from provided data
protected
newItem(array<string|int, mixed> $data) : Image
Parameters
- $data : array<string|int, mixed>
Return values
Image —$image
deleteFromCloudinary()
deletes image from Cloudinary by public_id
private
deleteFromCloudinary(string $publicId) : void
Parameters
- $publicId : string
Return values
void —uploadToCloudinary()
Uploads file to the Cloudinary and applies transformation
private
uploadToCloudinary(UploadedFileInterface $file) : array<string|int, mixed>
Parameters
- $file : UploadedFileInterface
Return values
array<string|int, mixed> —uploaded file info