Pionia Core

ParseTrait

Table of Contents

Methods

all()  : array<string|int, mixed>|null
Returns all items from the CDatabase. If a callback is passed, it will be called on each item in the resultset
delete()  : PDOStatement|null
where()  : static
runGet()  : mixed
runSelect()  : array<string|int, mixed>|null

Methods

all()

Returns all items from the CDatabase. If a callback is passed, it will be called on each item in the resultset

public all([callable|null $callback = null ]) : array<string|int, mixed>|null
Parameters
$callback : callable|null = null

This is the receiver for the current resultset

Tags
example
// Assignment method
$row = Table::from('user')
    ->filter(['last_name' => 'Ezra'])
   ->all();

// Callback method- this is little bit faster than the assignment method
Table::from('user')
   ->filter(['last_name' => 'Ezra'])
  ->all(function($row) {
     echo $row->first_name;
 });
Return values
array<string|int, mixed>|null

delete()

public delete(int|array<string|int, mixed>|string $where[, string|null $idField = 'id' ]) : PDOStatement|null
Parameters
$where : int|array<string|int, mixed>|string
$idField : string|null = 'id'
Tags
example
  $res1 = Porm::from('users')->delete(1); // deletes a user with id 1
  $res2 = Porm::from('users')->delete(['name' => 'John']); // deletes a user with name John
Return values
PDOStatement|null

where()

public where(array<string|int, mixed> $where) : static
Parameters
$where : array<string|int, mixed>
Return values
static

runSelect()

private runSelect(callable|null $callback) : array<string|int, mixed>|null
Parameters
$callback : callable|null
Return values
array<string|int, mixed>|null

        
On this page

Search results