The Datamodel: Article
This class is an implementation of the active record pattern and has been created in order to simplify the
access to the "Article" table.
Each Article belongs to a Number and to a
Category and can has many
User(s) and many Comment(s).
Article entity is the center of the data structure of Easy Magazine.
Accessible methods:
- public function getId():
return the id of the Article instance.
- public static function findById($id):
return an Article querying the database.
- public static function findLastN($n):
return an array of Articles querying the database, it returns the
last n articles ordered by the field "indexnumber" in descend order.
- public static function findUpIndexNumber():
return an Article that is just the next considering
the order gived by the field "indexnumber" in descend order.
- public static function findDownIndexNumber():
return an Article that is just the previous considering
the order gived by the field "indexnumber" in descend order.
- public static function findByTitle($title):
return an array of Articles containing a Title matching
the string $title.
- public static function findInAllTextFields($string):
return an array of Articles containing at least
a text field matching the string $string.
- public static function findInAllTextFieldsInPublishedArticles($string):
return an array of Articles
containing at least a text field matching the string $string and with the flag
published setted to true.
- public static function findLast():
return the last Article inserted in to the Database.
- public static function findAllPublished():
return an array of Articles with the "published" flag
setted to true.
- public static function findAllPublishedOrdered():
return an array of Articles having the published
flag setted to true, ordered by the field indexnumber in descend order.
That is useful in order to print the Articles in the order decided by the publisher.
- public static function findAll():
return an array containing all Article in the database.
- public static function findAllOrderedByIndexNumber():
return an array containing all Articles in the
database ordered by the field indexnumber in descend order.
- public function findUpIndexNumber():
return the Article with the field indexnumber coming
immediately after the courrent Article instance.
- public function findDownIndexNumber():
return the Article with the field indexnumber previously the
courrent Article instance.
- public function commentsPublished():
return a list of
Comment(s) related the the article instance
having the flag published equal to true.
- public function comments():
return a list of Comment(s)
related the the article instance.
- public function category():
return the Category
of the article instance.
- public function number():
return the Number
of the article instance.
- public function users():
return an array of User(s)
of the article instance. An User can be a publisher or an article writer.
- public function unlinkUser($idUser):
unlink the User
having id equal to $idUser from the article instance. A user linked to an article is one of the owners of
the article. He will appears in the list of the authors of the article and the article will appear in the
list of articles writed by the user.
- public function linkUser($idUser):
link the User
with id equal to $idUser to the Article instance. A user linked to an article is one of the owners of
the article. He will appears in the list of the authors of the article and the article will appear in the
list of articles writed by the user.
- public function save():
save the courrent instance.
- public function delete():
delete from the database the courrent instance and reset all the
instance fields.
- protected function insert():
insert a new instance in the database.
- protected function update():
update the courrent instance in the corresponding database record.
- public function getMaxIndexNumber():
return an Integer value containing the bigger
indexnumber field in the "article" table.
- public function getMaxId():
return an Integer value containing the bigger
id field in the table "Article".
- public function getTitle():
return the title of the Article instance, filtered by the filters
definited in the plugins activated by the publisher.
- public function getUnfilteredTitle():
return the title of the Article instance, unfiltered.
- public function setTitle($title):
set the title of the instance of the Article.
- public function getpublished():
return the content of the flag published in the Article instance.
- public function setpublished($published):
set the flag published.
- public function getIndexnumber():
return the number that defines the order of the Articles for
the published website.
- public function setIndexnumber($indexnumber):
set the number that defines the order of the Articles for
the published website.
- public function getSubtitle():
return the subTitle of the Article instance, filtered by the filters
definited in the plugins activated by the publisher.
- public function getUnfilteredSubtitle():
return the subTitle of the Article instance, unfiltered.
- public function setSubtitle($subtitle):
set the subTitle of the instance of the Article.
- public function getSummary():
return the Summary of the Article instance, filtered by the filters
definited in the plugins activated by the publisher.
- public function getUnfilteredSummary():
return the Summary of the Article instance, unfiltered.
- public function setSummary($summary):
set the Summary of the instance of the Article.
- public function getBody():
return the Body of the Article instance, filtered by the filters
definited in the plugins activated by the publisher.
- public function getUnfilteredBody():
return the Body of the Article instance, unfiltered.
- public function setBody($body):
set the Body of the instance of the Article.
- public function getTag():
return the Tag of the Article instance, filtered by the filters
definited in the plugins activated by the publisher.
- public function getUnfilteredTag():
return the Tag of the Article instance, unfiltered.
- public function setTag($tag):
set the Tag of the instance of the Article.
- public function getMetadescription():
return the Metadescription of the Article instance.
- public function setMetadescription($metadescription):
set the Metadescription of the
instance of the Article.
- public function getMetakeyword():
return the Metakeyword of the Article instance.
- public function setMetakeyword($metakeyword):
set the Metakeyword of the instance of the Article.
- public function getCreated():
return the Creation date of the Article instance.
- public function setCreated($created):
set the Creation date of the instance of the Article.
- public function getUpdated():
return the Update date of the Article instance.
- public function setUpdated($updated):
set the Update date of the instance of the Article.