Guest User

Untitled

a guest
Aug 14th, 2010
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. class IndexController extends Zend_Controller_Action
  4. {
  5.  
  6.     public function init()
  7.     {
  8.         $this->_helper->viewRenderer->setNoRender(true);
  9.     }
  10.  
  11.     public function indexAction()
  12.     {
  13.         $em = Zend_Registry::get('em');
  14.         $user = $em->find('Application\Models\User', 1);
  15.         $post = new Application\Models\Post;
  16.         $post->title = 'title';
  17.         $post->body = 'body';
  18.         $post->user = $user;
  19.        
  20.         $config = new DoctrineExtensions\NestedSet\Config($em, 'Application\Models\Post');
  21.         $manager = new DoctrineExtensions\NestedSet\Manager($config);
  22.         $manager->createRoot($post);
  23.         $em->flush();
  24.         echo 'OK!';
  25.     }
  26.    
  27.     function loginAction() {
  28.         $result = Zend_Auth::getInstance()->authenticate(new Application_Auth_Adapter);
  29.         if ($result->isValid()) {
  30.             echo 'login success';
  31.         } else {
  32.             echo 'login failed';
  33.         }
  34.     }
  35.    
  36.     function logoutAction() {
  37.         Zend_Auth::getInstance()->clearIdentity();
  38.         echo 'logged out!';
  39.     }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment