Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class IndexController extends Zend_Controller_Action
- {
- public function init()
- {
- $this->_helper->viewRenderer->setNoRender(true);
- }
- public function indexAction()
- {
- $em = Zend_Registry::get('em');
- $user = $em->find('Application\Models\User', 1);
- $post = new Application\Models\Post;
- $post->title = 'title';
- $post->body = 'body';
- $post->user = $user;
- $config = new DoctrineExtensions\NestedSet\Config($em, 'Application\Models\Post');
- $manager = new DoctrineExtensions\NestedSet\Manager($config);
- $manager->createRoot($post);
- $em->flush();
- echo 'OK!';
- }
- function loginAction() {
- $result = Zend_Auth::getInstance()->authenticate(new Application_Auth_Adapter);
- if ($result->isValid()) {
- echo 'login success';
- } else {
- echo 'login failed';
- }
- }
- function logoutAction() {
- Zend_Auth::getInstance()->clearIdentity();
- echo 'logged out!';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment