This object represents the table news_contents

uses extends the base class
uses defines the fields type
package OWR
subpackage DAO\news

 Methods

Constructor

__construct() 
access public
author Pierre-Alain Mignot

Counts row(s) from the database

count(mixed $args, string $select, string $groupby, string $selectAdd) : mixed
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::count()

Parameters

$args

mixed

parameters, can be null, a string (if an $_idField has been declared), or an array

$select

string

select fields, by default all

$groupby

string

the groupby clause

$selectAdd

string

additional fields to fetch, optionnal

Returns

mixednull if any, an object of the current DAO name if only one DBResult, or an array if more

Deletes row(s) from the database

delete(mixed $args, string $limit) : boolean
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::delete()

Parameters

$args

mixed

parameters, can be a string (if an $_idField has been declared), an object or an array, optionnal

$limit

string

the limit clause

Returns

booleantrue on success

Gets rows from the database

get(mixed $args, string $select, string $order, string $groupby, string $limit) : mixed
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::get()

Parameters

$args

mixed

parameters, can be a string (if an $_idField has been declared), an object or an array, optionnal

$select

string

select fields, by default all

$order

string

the order clause

$groupby

string

the groupby clause

$limit

string

the limit clause

Returns

mixednull if any, an object of the current DAO name if only one DBResult, or an array if more

Returns all the relations

getAllRelations() : array
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getAllRelations()

Returns

arrayall the relations for this table

Returns the specified DAO object This function accepts an ID and will return the DAO for the corresponding type

getById(int $id) : mixed
InheritedStatic
access public
static
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getById()

Parameters

$id

int

the id of the object

Returns

mixedthe DAO object if found, else false

Returns the specified DAO object from cache

getCachedDAO(string $dao) : mixed
InheritedStatic
access public
static
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getCachedDAO()

Parameters

$dao

string

the name of the DAO

Returns

mixedthe DAO object

Returns the specified DAO object

getDAO(string $dao) : mixed
InheritedStatic
access public
static
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getDAO()

Parameters

$dao

string

the name of the DAO

Returns

mixedthe DAO object

Returns the fields

getFields() : array
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getFields()

Returns

arraythe fields for this object

Returns the id field

getIdField() : string
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getIdField()

Returns

stringthe id field for this object

Returns the relations

getRelations() : array
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getRelations()

Returns

arraythe relations for this table

Returns the name of the table for $this

getTableName() : string
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getTableName()

Returns

stringthe name of the table relative to $this

Returns the type relative to the specified id This method also checks for user rights to read it

getType(int $id) : mixed
InheritedStatic
author Pierre-Alain Mignot
access public
static
inherited_from \OWR\DAO::getType()

Parameters

$id

int

the id to get type from

Returns

mixedfalse on error, or the type corresponding to the id

Returns the unique fields

getUniqueFields() : array
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getUniqueFields()

Returns

arraythe unique fields for this object

Returns the relations related to the current user

getUserRelations() : array
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getUserRelations()

Returns

arraythe relations for the current user for this table

Returns the weight

getWeight() : int
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::getWeight()

Returns

intthe weight for this table

Populates values into this object

populate(mixed $obj) : boolean
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::populate()

Parameters

$obj

mixed

the values to populate

Returns

booleantrue on success

Saves a row into the database

save(boolean $ignore) : mixed
Inherited
access public
author Pierre-Alain Mignot
inherited_from \OWR\DAO::save()

Parameters

$ignore

boolean

if we must save with a INSERT IGNORE clause instead of REPLACE INTO if no $_idField has been declared

Returns

mixedif success true if no $_idField declared or the value of the $_idField

Fetches all results from DB, either in numerical array, associative array or object

_fetch(string $query, \OWR\DB\Request $request, string $fetchType, boolean $force) : mixed
Inherited
author Pierre-Alain Mignot
access protected
inherited_from \OWR\DAO::_fetch()

Parameters

$query

string

the SQL query

$request

\OWR\OWR\DB\Request

DBRequest the request

$fetchType

string

can be assoc, array or object

$force

boolean

used to say to the DB object that we must use prepared query

Returns

mixedempty array or one result or an array of results

Returns the JOIN conditions This method tries to order the JOIN conditions to get better performance results

_optimizeJoins(array $joins) : array
Inherited
author Pierre-Alain Mignot
access protected
inherited_from \OWR\DAO::_optimizeJoins()

Parameters

$joins

array

the tables to join

Returns

arraythe JOIN conditions

Finalize the building of the SQL query

_prepareQuery(string $query, array $wheres, array $joins, string $groupby, string $order, string $limit) 
Inherited
author Pierre-Alain Mignot
access protected
inherited_from \OWR\DAO::_prepareQuery()

Parameters

$query

string

the sql query

$wheres

array

the WHERE clause fields

$joins

array

the JOIN clause fields

$groupby

string

the GROUP BY clause

$order

string

the ORDER clause

$limit

string

the LIMIT clause

Prepares the SELECT clauses for a query

_prepareSelect(string $selects, array $joins, array $wheres) 
Inherited
author Pierre-Alain Mignot
access protected
inherited_from \OWR\DAO::_prepareSelect()

Parameters

$selects

string

select fields, by default all

$joins

array

&$joins the JOIN clause fields

$wheres

array

&$wheres the WHERE clause fields

Prepares the WHERE clauses for a query

_prepareWhere(array $args, array $request, array $fields, array $wheres, array $joins) 
Inherited
author Pierre-Alain Mignot
access protected
inherited_from \OWR\DAO::_prepareWhere()

Parameters

$args

array

parameters

$request

array

&$request the fields to SELECT

$fields

array

&$fields the fields definition

$wheres

array

&$wheres the WHERE fields

$joins

array

&$joins the JOIN conditions

 Properties

 

the contents of the news

$contents : string
access public
 

contents' id

$id : int
access public
 

the DB instance

$_db : mixed
Inherited
access protected
static
inherited_from \OWR\DAO::$$_db
 

the list of fields of the table

$_fields : array
Inherited
access protected
inherited_from \OWR\DAO::$$_fields
 

the class name

$_fullName : string
Inherited
access protected
inherited_from \OWR\DAO::$$_fullName
 

the name of the field used to have a unique ID

$_idField : string
Inherited
access protected
inherited_from \OWR\DAO::$$_idField
 

the table name

$_name : string
Inherited
access protected
inherited_from \OWR\DAO::$$_name
 

associative array of name => field for each relations table

$_relations : array
Inherited
access protected
inherited_from \OWR\DAO::$$_relations
 

associative array representing the SQL schema

$_tableFields : array
Inherited
access protected
inherited_from \OWR\DAO::$$_tableFields
 

stored results of already processed queries about id=>type

$_types : array
Inherited
access protected
static
inherited_from \OWR\DAO::$$_types
 

the list of unique fields of the table

$_uniqueFields : array
Inherited
access protected
inherited_from \OWR\DAO::$$_uniqueFields
 

associative array of name => field for each user's relations table

$_userRelations : array
Inherited
access protected
inherited_from \OWR\DAO::$$_userRelations
 

weight of the table in the query, used to optimize joins

$_weight : int
Inherited
access protected
inherited_from \OWR\DAO::$$_weight
 

stored already processed dao objects

$_cachedDaos : array
Inherited
access private
static
inherited_from \OWR\DAO::$$_cachedDaos
 

stored already processed dao names

$_daos : array
Inherited
access private
static
inherited_from \OWR\DAO::$$_daos