O'Reilly logo

Zend Framework 2.0 by Example Beginner's Guide by Krishna Shasankar V

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

Time for action – creating a simple group chat application

  1. Create a new chat_messages table to store all user messages:
    CREATE TABLE IF NOT EXISTS chat_messages (
      id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
      user_id INT NOT NULL,
      message VARCHAR( 255 ) NOT NULL ,  
      stamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    )
  2. Create a controller for group chat in CommunicationApp/module/Users/src/Users/Controller/GroupChatController.php.
  3. Make necessary changes to CommunicationApp/module/Users/config/module.config.php and add the new controller to invokables and routes:
    // Invokable 'Users\Controller\GroupChat' => 'Users\Controller\GroupChatController', // Route 'group-chat' => array( 'type' => 'Segment', 'options' => array( 'route' => '/group-chat[/:action[/:id]]', 'constraints' ...

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