O'Reilly logo

Learning Phalcon PHP by Calin Rada

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Article CRUD

We partially wrote some code for this part. It is probably working for you, but you will be changing mostly everything in it. The API controller has already been developed, so we can move directly on to ArticleManager to refactor it.

The Controller (API)

The code for this controller is similar to that of the rest of the controllers. Let's see what it looks like. Open the file located at modules/Api/Controllers/ArticlesController.php, clear its content, and write the following code:

<?php namespace App\Api\Controllers; class ArticlesController extends BaseController{ public function updateAction($id) { try { $manager = $this->getDI()->get('core_article_manager'); if ($this->request->getHeader('CONTENT_TYPE') == ' application/json') { ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required