Article.php should not call ArticleTable.php, if really, really . In table classes, you will only store queries that are called by the controller, for example:
$featuredArticles = ArticleTable::getInstance()->getFeatured() ;
The above code is simpler and you will have autocomplete in any IDE.
The reason for not responding to Article.php requests is that it will be easier for you to upgrade to Doctrine2 one day.
To invoke a tbl_article table or just an article, doctrine will generate the article. php and BaseArticle.php. Base classes should not be changed manually.
The article class is your logic. For example, you get a list of ALL articles in the database. When you show them, you want a star in art articles (just an example):
controller:
$allArticles = ArticleTable::getInstance()->findAll() ;
(Smarty version here):
{foreach $allArticles as $article} {if $article->isFeatured()} <img src=.. some image ..>{/if} <h5>{$article->title} {/foreach}
and model class
class Article extends BaseArticle { const STATUS_FEATURED = 1 ; public function isFeatured() { return $this->status == self::STATUS_FEATURED ; } }
All these are just some examples, in real life it is much more useful.
And what are you really trying to do with this fromArray ($ fArticle)? I do not see the point in this code.
source share