Acco Fork
Acco Fork

Reputation: 5

Symfony - modify data from databases

I would like use somethings - if i have encode, then i add in News.class.php public function save and use strtoupper. This working good. How can i make somethings if i get data from database?

my DB:

id | title  | body
1  | title1 | body1
2  | title1 | body2

etc.

if i use $news->getTitle() then i have: title1 i must make:

strtoupper($news->getTitle()) - it is good, but i dont will every time add my function decode. I would like use $news->getTitle() and at once this is strtoupper. Where i can this make? Which file? I dont will edit model generated auto with Symfony. I would like make this in NewsTable.class.php, but how?

Upvotes: 0

Views: 113

Answers (1)

plandolt
plandolt

Reputation: 1931

Edit your News.class.php (not the table) file and add this:

public function getTitle()
{
  return urldecode($this->title);
}

Upvotes: 1

Related Questions