2010年7月31日星期六

Re: [fw-db] Need help with Pagination

You have a typo in your code. 

Zend_Paginator_Adaptor_DbSelect

should be 
Zend_Paginator_Adapter_DbSelect

On 1 aug. 2010, at 00:07, Y D <dossany@gmail.com> wrote:

Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find my code below;

////////******* code: start **********///////////


Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_
DbSelect($getdata));
$paginator->setItemCountPerPage(25)
          ->setCurrentPageNumber($this->_getParam('page',1));
         
          $this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
    echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php

class Model_Managers_Paginator{
   
    public function simplepaginator(){
  
        $db = Zend_Db_Table::getDefaultAdapter();
        $getdata = new Zend_Db_Select($db);
        $getdata->from('ARC_DOCUMENT')
        ->where('DELETED=0');
    }
}



?>



///////////*********** code: end ************///////////////////





Your earliest reply awaited


--
Regards,
YD

Re: [fw-db] Need help with Pagination

Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find my code below;

////////******* code: start **********///////////


Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_
DbSelect($getdata));
$paginator->setItemCountPerPage(25)
          ->setCurrentPageNumber($this->_getParam('page',1));
         
          $this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
    echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php

class Model_Managers_Paginator{
   
    public function simplepaginator(){
  
        $db = Zend_Db_Table::getDefaultAdapter();
        $getdata = new Zend_Db_Select($db);
        $getdata->from('ARC_DOCUMENT')
        ->where('DELETED=0');
    }
}



?>



///////////*********** code: end ************///////////////////





Your earliest reply awaited


--
Regards,
YD

Re: [fw-db] Need help with Pagination

Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find my code below;

////////******* code: start **********///////////


Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_DbSelect($getdata));
$paginator->setItemCountPerPage(25)
          ->setCurrentPageNumber($this->_getParam('page',1));
         
          $this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
    echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php

class Model_Managers_Paginator{
   
    public function simplepaginator(){
  
        $db = Zend_Db_Table::getDefaultAdapter();
        $getdata = new Zend_Db_Select($db);
        $getdata->from('ARC_DOCUMENT')
        ->where('DELETED=0');
    }
}



?>



///////////*********** code: end ************///////////////////




Your earliest reply awaited

--
Regards,
YD

Re: [fw-db] Need help with Pagination

Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();
//require_once 'Zend_Paginator_Adapter_Interface.php';
//require_once 'Zend/Db.php';
//require_once 'Zend/Db/Select.php';

// require_once 'Zend_Paginator_Adapter_DbSelect.php';

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_DbSelect($getdata));
$paginator->setItemCountPerPage(25)
->setCurrentPageNumber($this->_getParam('page',1));

$this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Model_Managers_Paginator{

public function simplepaginator(){
// require_once 'Zend/Paginator/Adapter/DbSelect.php';
$db = Zend_Db_Table::getDefaultAdapter();
$getdata = new Zend_Db_Select($db);
$getdata->from('ARC_DOCUMENT')
->where('DELETED=0');
}
}



?>
Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find the attached file to see my code.

Your earliest reply awaited


--
Regards,
YD

Re: [fw-db] Need help with Pagination

Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();
//require_once 'Zend_Paginator_Adapter_Interface.php';
//require_once 'Zend/Db.php';
//require_once 'Zend/Db/Select.php';

// require_once 'Zend_Paginator_Adapter_DbSelect.php';

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_DbSelect($getdata));
$paginator->setItemCountPerPage(25)
->setCurrentPageNumber($this->_getParam('page',1));

$this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Model_Managers_Paginator{

public function simplepaginator(){
// require_once 'Zend/Paginator/Adapter/DbSelect.php';
$db = Zend_Db_Table::getDefaultAdapter();
$getdata = new Zend_Db_Select($db);
$getdata->from('ARC_DOCUMENT')
->where('DELETED=0');
}
}



?>
Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find the attached file to see my code.

Your earliest reply awaited

Regards,
YD




On Thu, Jul 29, 2010 at 4:18 PM, Brian Strickland <bstrick@gmail.com> wrote:
Oh and my view listed the numbers as so:

<div>
Pages: <?php echo $this->prev?> | <?php echo implode($this->pageLinks, $this->separator); ?> | <?php echo $this->next; ?>
</div>


On Thu, Jul 29, 2010 at 8:17 AM, Brian Strickland <bstrick@gmail.com> wrote:
I don't have time to go into detail, but here is my first attempt with paginator:

$page = $this->getRequest()->getParam('page');

// $data is what I got from the database.
    $pager = new Zend_Paginator(new Zend_Paginator_Adapter_Array($data));
   
        // set page number from request 
        $currentPage = $page;
        $pager->setCurrentPageNumber($page);
       
        // set number of items per page from request
        $itemsPerPage = 25;
        $pager->setItemCountPerPage($itemsPerPage);
        $pager->setPageRange(5);
       
        // get page data
        $pages = $pager->getPages();
       
        // create page links
        $this->view->pageLinks = array();
        $this->view->separator = ' | ';
       
        for ($x=1; $x<=$pages->pageCount; $x++) {
            if ($x == $pages->current) {
                $this->view->pageLinks[] = $x;     
            }
            else {
                $this->view->pageLinks[] = "<a href=\"/cpanel/author/search/$type/$value/$x\">".$x."</a>"; 
            } 
        }

Hope that helps some, sorry to be vague.

- strick
2010/7/29 Y D <dossany@gmail.com>

Hi all,

I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.

Can anybody please help me out over here...Here is actually what I want For example;

1. The Number of Data Rows fetched are 450
2. The code only show 50 Records (ROWS)
3. For next the user has to click the NEXT PAGE link at the bottom or top.
4. The Next Page link is not active on Last page.
5. There is Previous page as well but ofcourse not active on the first page.

Please find the attached files to have an idea of how I am fetching the data using the query.

Your earliest respond awaited.

Thanks in advance





--
Regards,
YD

On Thu, Jul 29, 2010 at 4:18 PM, Brian Strickland <bstrick@gmail.com> wrote:
Oh and my view listed the numbers as so:

<div>
Pages: <?php echo $this->prev?> | <?php echo implode($this->pageLinks, $this->separator); ?> | <?php echo $this->next; ?>
</div>


On Thu, Jul 29, 2010 at 8:17 AM, Brian Strickland <bstrick@gmail.com> wrote:
I don't have time to go into detail, but here is my first attempt with paginator:

$page = $this->getRequest()->getParam('page');

// $data is what I got from the database.
    $pager = new Zend_Paginator(new Zend_Paginator_Adapter_Array($data));
   
        // set page number from request 
        $currentPage = $page;
        $pager->setCurrentPageNumber($page);
       
        // set number of items per page from request
        $itemsPerPage = 25;
        $pager->setItemCountPerPage($itemsPerPage);
        $pager->setPageRange(5);
       
        // get page data
        $pages = $pager->getPages();
       
        // create page links
        $this->view->pageLinks = array();
        $this->view->separator = ' | ';
       
        for ($x=1; $x<=$pages->pageCount; $x++) {
            if ($x == $pages->current) {
                $this->view->pageLinks[] = $x;     
            }
            else {
                $this->view->pageLinks[] = "<a href=\"/cpanel/author/search/$type/$value/$x\">".$x."</a>"; 
            } 
        }

Hope that helps some, sorry to be vague.

- strick
2010/7/29 Y D <dossany@gmail.com>

Hi all,

I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.

Can anybody please help me out over here...Here is actually what I want For example;

1. The Number of Data Rows fetched are 450
2. The code only show 50 Records (ROWS)
3. For next the user has to click the NEXT PAGE link at the bottom or top.
4. The Next Page link is not active on Last page.
5. There is Previous page as well but ofcourse not active on the first page.

Please find the attached files to have an idea of how I am fetching the data using the query.

Your earliest respond awaited.

Thanks in advance
--
Regards,
YD





--
Regards,
YD

Re: [fw-db] Need help with Pagination

The error messages tell you that PHP can't find the files requested.
What does that tell you? All languages require paths to be set up to
find files. Take a look at your PHP include path.

-Matt


On Saturday, July 31, 2010, Y D <dossany@gmail.com> wrote:
> Hi,
>
> I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;
>
> Zend Framework 1.9 tutorial 11: Zend_Paginator part 1 <http://www.youtube.com/watch?v=f4fujot7Xlc>
>
>
> Even after understanding the logic in the video and following it exactly, Facing this problem;
>
>
> Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include <http://10.10.10.15/ZCFPRD/public/documents/function.include>]:
> failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php
> on line 136
>
> Warning: include() [function.include <http://10.10.10.15/ZCFPRD/public/documents/function.include>]:
> Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion
> (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php
> on line 136
>
> Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found
> in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php
> on line 2144
>
>
> I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.
>
> Please find the attached file to see my code.
>
> Your earliest reply awaited
>
> Regards,
> YD
>
>
> On Thu, Jul 29, 2010 at 4:18 PM, Brian Strickland <bstrick@gmail.com> wrote:
>
>
> Oh and my view listed the numbers as so:
>
> <div>
> Pages: <?php echo $this->prev?> | <?php echo implode($this->pageLinks, $this->separator); ?> | <?php echo $this->next; ?>
> </div>
>
>
>
> On Thu, Jul 29, 2010 at 8:17 AM, Brian Strickland <bstrick@gmail.com> wrote:
>
>
>
> I don't have time to go into detail, but here is my first attempt with paginator:
>
> $page = $this->getRequest()->getParam('page');
>
> // $data is what I got from the database.
>     $pager = new Zend_Paginator(new Zend_Paginator_Adapter_Array($data));
>
>         // set page number from request
>         $currentPage = $page;
>         $pager->setCurrentPageNumber($page);
>
>         // set number of items per page from request
>         $itemsPerPage = 25;
>         $pager->setItemCountPerPage($itemsPerPage);
>         $pager->setPageRange(5);
>
>         // get page data
>         $pages = $pager->getPages();
>
>         // create page links
>         $this->view->pageLinks = array();
>         $this->view->separator = ' | ';
>
>         for ($x=1; $x<=$pages->pageCount; $x++) {
>             if ($x == $pages->current) {
>                 $this->view->pageLinks[] = $x;
>             }
>             else {
>                 $this->view->pageLinks[] = "<a href=\"/cpanel/author/search/$type/$value/$x\">".$x."</a>";
>             }
>         }
>
> Hope that helps some, sorry to be vague.
>
> - strick
> 2010/7/29 Y D <dossany@gmail.com>
>
>
>
> Hi all,
>
> I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.
>
> Can anybody please help me out over here...Here is actually what I want For example;
>
> 1. The Number of Data Rows fetched are 450
> 2. The code only show 50 Records (ROWS)
> 3. For next the user has to click the NEXT PAGE link at the bottom or top.
> 4. The Next Page link is not active on Last page.
> 5. There is Previous page as well but ofcourse not active on the first page.
>
> Please find the attached files to have an idea of how I am fetching the data using the query.
>
> Your earliest respond awaited.
>
> Thanks in advance
> --
> Regards,
> YD
>
>
>
>
>
> --
> Regards,
> YD
>
>

Re: [fw-db] Need help with Pagination

Controller Action:

public function trypaginatorAction(){
{

$GETDATA = new Model_Managers_Paginator();
$getdata = $GETDATA->simplepaginator();
//require_once 'Zend_Paginator_Adapter_Interface.php';
//require_once 'Zend/Db.php';
//require_once 'Zend/Db/Select.php';

// require_once 'Zend_Paginator_Adapter_DbSelect.php';

$paginator = new Zend_Paginator(new Zend_Paginator_Adaptor_DbSelect($getdata));
$paginator->setItemCountPerPage(25)
->setCurrentPageNumber($this->_getParam('page',1));

$this->view->paginator = $paginator;

}





View:

<?php
foreach($this->paginator as $paginator){
echo $paginator['DOCUMENT_ID'].' has Title: '.$paginator['SUBJECT'].'<BR>';
}

?>




Model:

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Model_Managers_Paginator{

public function simplepaginator(){
// require_once 'Zend/Paginator/Adapter/DbSelect.php';
$db = Zend_Db_Table::getDefaultAdapter();
$getdata = new Zend_Db_Select($db);
$getdata->from('ARC_DOCUMENT')
->where('DELETED=0');
}
}



?>
Hi,

I went through the TUTORIAL from Youtube and followed as exactly as it is. Following is the link for the video;

http://www.youtube.com/watch?v=f4fujot7Xlc


Even after understanding the logic in the video and following it exactly, Facing this problem;


Warning: include(Zend\Paginator\Adaptor\DbSelect.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Warning: include() [function.include]: Failed opening 'Zend\Paginator\Adaptor\DbSelect.php' for inclusion (include_path='C:\wamp\www\ZCFPRD\library;.;C:\php5\pear') in C:\wamp\www\ZCFPRD\library\Zend\Loader.php on line 136

Fatal error: Class 'Zend_Paginator_Adaptor_DbSelect' not found in C:\wamp\www\ZCFPRD\application\controllers\DocumentsController.php on line 2144


I face this problem quite often but it slips off my brain how to cater it. Can someone please explain to me why I face this problem and what exactly I should do when I face it.

Please find the attached file to see my code.

Your earliest reply awaited

Regards,
YD


On Thu, Jul 29, 2010 at 4:18 PM, Brian Strickland <bstrick@gmail.com> wrote:
Oh and my view listed the numbers as so:

<div>
Pages: <?php echo $this->prev?> | <?php echo implode($this->pageLinks, $this->separator); ?> | <?php echo $this->next; ?>
</div>


On Thu, Jul 29, 2010 at 8:17 AM, Brian Strickland <bstrick@gmail.com> wrote:
I don't have time to go into detail, but here is my first attempt with paginator:

$page = $this->getRequest()->getParam('page');

// $data is what I got from the database.
    $pager = new Zend_Paginator(new Zend_Paginator_Adapter_Array($data));
   
        // set page number from request 
        $currentPage = $page;
        $pager->setCurrentPageNumber($page);
       
        // set number of items per page from request
        $itemsPerPage = 25;
        $pager->setItemCountPerPage($itemsPerPage);
        $pager->setPageRange(5);
       
        // get page data
        $pages = $pager->getPages();
       
        // create page links
        $this->view->pageLinks = array();
        $this->view->separator = ' | ';
       
        for ($x=1; $x<=$pages->pageCount; $x++) {
            if ($x == $pages->current) {
                $this->view->pageLinks[] = $x;     
            }
            else {
                $this->view->pageLinks[] = "<a href=\"/cpanel/author/search/$type/$value/$x\">".$x."</a>"; 
            } 
        }

Hope that helps some, sorry to be vague.

- strick
2010/7/29 Y D <dossany@gmail.com>

Hi all,

I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.

Can anybody please help me out over here...Here is actually what I want For example;

1. The Number of Data Rows fetched are 450
2. The code only show 50 Records (ROWS)
3. For next the user has to click the NEXT PAGE link at the bottom or top.
4. The Next Page link is not active on Last page.
5. There is Previous page as well but ofcourse not active on the first page.

Please find the attached files to have an idea of how I am fetching the data using the query.

Your earliest respond awaited.

Thanks in advance
--
Regards,
YD





--
Regards,
YD

2010年7月30日星期五

[fw-webservices] odd zend_xmlrpc_server problem

Run into a snag trying to use xmlrpc and no idea on how to start debugging.
Basically, I set up framework app with classes to act as an api layer to
various databases, that went well.

Problem is when I then add an xmlrpc controller to the same app and try to
make requests.

When I try to use, I get the following error "Catchable fatal error:
Argument 1 passed to Zend_Controller_Action::__construct() must be an
instance of Zend_Controller_Request_Abstract, none given,"

Any suggestions?

Sean
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/odd-zend-xmlrpc-server-problem-tp2308503p2308503.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

2010年7月29日星期四

[fw-gdata] Zend_Gdata_Entry not setting summary

I was trying to set a summary for a blog entry but it looks like it is stripped out or ignored when saved.

The api doc says that Zend_Gdata_Entry inherits from Zend_Gdata_App_Extensions_Entry and has a summary field that is set and gotten using get/setSummary()
and it excepts a Zend_Gdata_App_Extension_Summary() object.

When I do this I can see that it is set prior to saving but when i save and retrieve the entry the summary is not returned.

        $service = new Zend_Gdata($gauthNamespace->gauthClient);

        $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/blogid/posts/default/postId');
        $entry = $service->getEntry($query);

        $summary = new Zend_Gdata_App_Extension_Summary();
        $summary->setText('testing summary');

        $entry->setSummary($summary);
        $entry->save();


Before the save the entry has the summary object
    [_summary:protected] => Zend_Gdata_App_Extension_Summary Object
(
[_rootElement:protected] => summary
[_type:protected] => text
[_rootNamespace:protected] => atom
[_rootNamespaceURI:protected] =>
[_extensionElements:protected] => Array
(
)

[_extensionAttributes:protected] => Array
(
)

[_text:protected] => testing summary
[_namespaces:protected] => Array
(
[atom] => Array
(
[1] => Array
(
[0] => http://www.w3.org/2005/Atom
)

)

[app] => Array
(
[1] => Array
(
[0] => http://purl.org/atom/app#
)

[2] => Array
(
[0] => http://www.w3.org/2007/app
)

)

)

)

When retrieved from google the summary is not sent in the post data.

 [_summary:protected] => 

Is there a way to set a summary in a blog entry?

[fw-db] Need help with Pagination

$mod = new Model_Documents_Document();
$select = $mod->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
$select->setIntegrityCheck(FALSE);
$select->joinleft('ZCFPRJ_ORGANIZATIONS_V', 'ARC_DOCUMENT.SENDER_ID = ZCFPRJ_ORGANIZATIONS_V.ORGANIZATION_ID', 'ZCFPRJ_ORGANIZATIONS_V.NAME')
->join('ARC_DOC_DESTINATION', 'ARC_DOC_DESTINATION.DESTINATION_ID = ARC_DOCUMENT.DESTINATION_ID')
->join('ARC_DOCUMENT_TRANS', 'ARC_DOCUMENT_TRANS.DOCUMENT_ID = ARC_DOCUMENT.DOCUMENT_ID')
;
$select->where('ARC_DOCUMENT.DELETED=1')
->where('ARC_DOCUMENT.OUTBOX_NUMBER IS NOT NULL')
->where('ARC_DOCUMENT_TRANS.LAST_STEP=?','Y');

$select->columns('ARC_DOCUMENT.CREATED_BY');
$select->order('ARC_DOCUMENT.CREATED_DATE DESC');
$this->view->deleteddocs = $mod->fetchAll($select);<table border="1" class="sortable">
<tr align="center">

<th width="7%">&nbsp;</th>
<th>#</th>
<th><?php echo $docnumlabel?></th>
<th><?php echo $docdatelabel?></th>
<th><?php echo $subjectlabel?></th>
<th><?php echo $destinationlabel?></th>
<th><?php echo $sourcelabel?></th>
<th><?php echo $senderlabel?></th>
</tr>

<?php
$counter=0;
$mod = new Model_Documents_Griddyview();
$docsmod = new Model_Documents_Document();

foreach($this->deleteddocs as $docs) :
$counter+=1;
?>
<tr align="center">
<td>
<a href="../documents/undelete?DOCUMENT_ID=<?php echo $docs->DOCUMENT_ID;?>&url=admin/deleteddocsoutbox"><?php echo $restorelabel?></a>

</td>
<td><b><?php echo $counter;?></b></td>
<td><b><?php echo $this->escape($docs->OUTBOX_NUMBER);?></b></td>
<td><b><?php echo $this->escape($docs->CREATED_DATE);?></b></td>
<td><b><a href="../documents/docdetail?ISINBOX=1&DOCUMENT_ID=<?php echo $docs->DOCUMENT_ID;?>&TRANSACTION_ID=<?php echo $docs->TRANSACTION_ID; ?>" ><?php echo $docs->SUBJECT;?></a>
</td>
<td><?php echo $this->escape($docs->DESTINATION_DESC_A);?></td>
<td><?php

if ($docs->SENDER_ID == 0 ) {
ECHO 'مؤسسة زايد للأعمال الخيرية والإنسانية';
}
else echo $docs->NAME;
?>
</td>
<td><?php echo $mod->getFullName($this->escape($docs->CREATED_BY));?></td>

</tr>

<?php endforeach; ?>
</table>
Hi all,

I am in desperate need to put pagination on the TABLE my clients view...I have seen there is a way Zend is dealing with it using ZEND_PAGINATOR but the explanation seemed a bit confusing to me.

Can anybody please help me out over here...Here is actually what I want For example;

1. The Number of Data Rows fetched are 450
2. The code only show 50 Records (ROWS)
3. For next the user has to click the NEXT PAGE link at the bottom or top.
4. The Next Page link is not active on Last page.
5. There is Previous page as well but ofcourse not active on the first page.

Please find the attached files to have an idea of how I am fetching the data using the query.

Your earliest respond awaited.

Thanks in advance
--
Regards,
YD

2010年7月25日星期日

Re: [fw-db] Column not found: 1054 Unknown column '00nk01' in 'where clause

On Jul 25, 2010, at 4:02 PM, gpcola wrote:

> Zend_Db_Adapter_Abstract->update('products', Array, 'sku = 00nk01') #5
> C:\xampp\htdocs\sinfulthrills\cron_scripts\products\init
> \getss365products.php(441):
> Product->updateProduct(Array) #6

Looking at your stack trace, I find the lines above.

The error isn't caused by a SELECT statement, it's caused by an UPDATE
statement.

It looks like you are setting 'sku = 00nk01'. I assume 00nk01 is a
value, but it's not in quotes. Well, it's in PHP quotes but it's not
in quotes in the resulting SQL expression. So it's treating it as a
column name, and giving you an error.

Regards,
Bill Karwin

[fw-gdata] set publish options

How does someone go about setting the publish options?
Particularly the publish date & time.

I would like to able to post items  and set it to appear at a specified future date.

[fw-db] Column not found: 1054 Unknown column '00nk01' in 'where clause

I'm trying to do what ought to be the simplest of things, but for the past
few hours I've failed using various approaches.

I want to run the following function using a string as the $arg_sku:

public function productExists($arg_sku)
{
$query = $this->db->select()
->from('products', array('sku'))
->where('sku = ?', $arg_sku);
$result = $this->db->fetchOne($query);

if($result)
{
return true;
}else{
return false;
}
}

This is returning the following error:

Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message
'SQLSTATE[42S22]: Column not found: 1054 Unknown column '00nk01' in 'where
clause'' in C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Statement\Pdo.php:234
Stack trace: #0
C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Statement.php(300):
Zend_Db_Statement_Pdo->_execute(Array) #1
C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Adapter\Abstract.php(468):
Zend_Db_Statement->execute(Array) #2
C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Adapter\Pdo\Abstract.php(238):
Zend_Db_Adapter_Abstract->query('UPDATE `product...', Array) #3
C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Adapter\Abstract.php(604):
Zend_Db_Adapter_Pdo_Abstract->query('UPDATE `product...', Array) #4
C:\xampp\htdocs\sinfulthrills\cron_scripts\products\library\Product.php(775):
Zend_Db_Adapter_Abstract->update('products', Array, 'sku = 00nk01') #5
C:\xampp\htdocs\sinfulthrills\cron_scripts\products\init\getss365products.php(441):
Product->updateProduct(Array) #6
C:\xampp\htdocs\sinfulthrills\cron_scripts\pr in
C:\xampp\htdocs\sinfulthrills\lib\Zend\Db\Statement\Pdo.php on line 234

If I echo the $query string that fails above and run it in phpMyAdmin it
returns the row I expect:

SELECT `products`.`sku` FROM `products` WHERE (sku = '00nk01')

I've tried:

->where('sku = ?', new Zend_Db_Expr($this->db->quote($arg_sku)));

And I've even tried just using straight sql:

$query = "SELECT `products`.`sku` FROM `products` WHERE (sku =
'".$arg_sku."')';
$result = $this->db->fetchOne($query);

No dice. I always get the same error. What do I have to do to get zend to
recognise the $arg_sku as an expression value and not a column name??

Please help because this is driving me mad!
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Column-not-found-1054-Unknown-column-00nk01-in-where-clause-tp2301798p2301798.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-auth] Method "hasIdentity" does not exist and was not trapped in __call()

Are you calling authenticate statically? If so, get the singleton instance and call it on that instead:

$auth = Zend_Auth::getInstance();
$auth->authenticate($adapter);

--
Hector Virgen
Sr. Web Developer
Walt Disney Parks and Resorts Online



On Sun, Jul 25, 2010 at 2:00 AM, jiewmeng <jiewmeng@gmail.com> wrote:

i am using a custom Zend_Auth_Adapter i implemented. code is here. when i do a Zend_Auth::authenticate($adapter);, i get "Method "hasIdentity" does not exist and was not trapped in __call()". i noticed that the problem comes from the class Zend_Auth. abt line 123

if ($this->hasIdentity()) { 	$this->clearIdentity(); }

but the funny thing is just below that function, is public function hasIdentity() so the function exists definately??


View this message in context: Method "hasIdentity" does not exist and was not trapped in __call()
Sent from the Zend Auth mailing list archive at Nabble.com.


[fw-auth] Method "hasIdentity" does not exist and was not trapped in __call()

i am using a custom Zend_Auth_Adapter i implemented. code is here. when i do a Zend_Auth::authenticate($adapter);, i get "Method "hasIdentity" does not exist and was not trapped in __call()". i noticed that the problem comes from the class Zend_Auth. abt line 123

if ($this->hasIdentity()) { 	$this->clearIdentity(); }

but the funny thing is just below that function, is public function hasIdentity() so the function exists definately??


View this message in context: Method "hasIdentity" does not exist and was not trapped in __call()
Sent from the Zend Auth mailing list archive at Nabble.com.

2010年7月20日星期二

[fw-db] Re: FetchAll returns my config.ini data

Cool. But if I use ->toArray() I need to use the variables like $row['id']
but I´m used or I think it´s right to use $row->id , is it right?

Thanks, and best regard´s.
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/FetchAll-returns-my-config-ini-data-tp2294025p2295417.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-db] Re: FetchAll returns my config.ini data

Hello David, thanks for your reply.

I´m using Zend Abstract. It returns two many useless data, like the type of
the table, [_data:protected] this kind of stuff.

Thanks
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/FetchAll-returns-my-config-ini-data-tp2294025p2295336.html
Sent from the Zend DB mailing list archive at Nabble.com.

2010年7月19日星期一

[fw-mvc] Re: Resource methods and return value

jiewmeng wrote:
>
> <p>if i do not return anything from a resource method, what will happen?
> will i not be able to use
>

If you need a reference to the resource later then "yes", you need to return
it.

-----
--
Wil Moore III

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Resource-methods-and-return-value-tp2293126p2294239.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2010年7月18日星期日

Re: [fw-mvc] Get the request object in a resource

Freeaq is right as usual! You might want to check out my blog post regarding FC plugins...

gratuitous plug:
endgratuitousplug;

Gary / Spabby

On 18 July 2010 19:50, Dolf Schimmel <dolfschimmel@gmail.com> wrote:
Hey,

You don't ;) At the moment your application is bootstrapped no request
object has been instantiated (you have to start somewhere, right? ;)).
You may want to look into Front Controller Plugins.

Regards,

Dolf
-- Freeaqingme

On Sun, Jul 18, 2010 at 7:50 PM, Nathan Garlington <garlinto@gmail.com> wrote:
> Hi all!
> Quick question: How do I go about retrieving the request object in a
> bootstrap resource?
> regards,
>
> Nathan Garlington
>


Re: [fw-mvc] Get the request object in a resource

Hey,

You don't ;) At the moment your application is bootstrapped no request
object has been instantiated (you have to start somewhere, right? ;)).
You may want to look into Front Controller Plugins.

Regards,

Dolf
-- Freeaqingme

On Sun, Jul 18, 2010 at 7:50 PM, Nathan Garlington <garlinto@gmail.com> wrote:
> Hi all!
> Quick question: How do I go about retrieving the request object in a
> bootstrap resource?
> regards,
>
> Nathan Garlington
>

Re: [fw-mvc] Get the request object in a resource

Hi,

You can't, as bootstrap initialize the application (front controller), and only in your application you can get the request object.

--
Best Regards,
Vladas Diržys


On Sun, Jul 18, 2010 at 19:50, Nathan Garlington <garlinto@gmail.com> wrote:
Hi all!

Quick question: How do I go about retrieving the request object in a bootstrap resource?

regards,

Nathan Garlington

[fw-mvc] Get the request object in a resource

Hi all!

Quick question: How do I go about retrieving the request object in a bootstrap resource?

regards,

Nathan Garlington

Re: [fw-db] Sending email


On Jul 18, 2010, at 12:14 AM, Erdal YAZICIOGLU wrote:

Warning: Invalid argument supplied for foreach() in/home/gbhldorg/domains/gbhlmd.org/public_html/application/views/scripts/admin/bulletin.phtml on line 49.


foreach() requires an array.  If you give it some non-array object or a scalar or a boolean or something, it gives a warning like that.

If you fetched results from the database, it may have returned a result that is null or false or a single object (not an array).  Perhaps your query failed, or returned an empty result set.  You should always check the result from a database fetch and make sure there was no error.

Tip: when you ask questions about your code, you should post enough code to provide some context.  For instance in this case, line 49 of bulletin.php, and the preceding code that sets any variables used in line 49.

Regards,
Bill Karwin

Re: [fw-db] Sending email

I don't think it's a problem of database driven content.

It's php problem. Just a wrong arg passed for foreach().

Could you check your line 49, or put it here?

[fw-db] Sending email

Hello all

I am trying to send HTML template email as it is described on zendcasts on video Painless HTML Emails with Zend_Mail. I succesfully integrate this to my pplication and locally it works fine. 

It also sends the template without a problem. The text inside this template is dynamic and taken from database. When receipent opens the mail, he/she sees the following error.

Warning: Invalid argument supplied for foreach() in/home/gbhldorg/domains/gbhlmd.org/public_html/application/views/scripts/admin/bulletin.phtml on line 49.

How can I send database driven content with ZF?

Thank sin advance and regards

E


--
REFERANDUMA BU HALİ İLE HAYIR



2010年7月17日星期六

Re: [fw-db] Extending Zend_Db_Table_Row_Abstract

On Jul 17, 2010, at 12:34 PM, Brad Waite wrote:

> On 7/17/2010 10:56 AM, Bill Karwin wrote:
>
>> I'd extend the Row class only to add operations on a row of data.
>
> Okay, that makes sense. Given the need for a Data Mapper whose
> parts are very similar to the Row class, wouldn't this make a good
> base class?

Not all patterns are good for making base implementations. Many
pattern need to be tailored to a specific case. Trying to make a one-
size-fits-all base class that anyone can use make that base class so
complex that it's both slow and hard to use. Data Mapper might be in
this category. The mapping logic you need is very situation-specific.

In your example, you aren't actually doing any mapping, you're just
creating a way to add other properties besides those that map directly
to database columns. Your class doesn't provide any hooks for mapping
the database columns, except for a 1-to-1 verbatim mapping, which is
sort of a degenerate case and has very little value.

I'd expect a Data Mapper base class at least to use optional mutators
(getters/setters) that are backed by the Table Row properties.

abstract class DataMapper
{
protected $tableRow = null;
protected $_name = null;

public function __get($name){
$method = "_get_".$name;
if (method_exists($this, $method)) {
return $this->$method();
} else {
return $this->tableRow->$name;
}
}

public function __set($name, $value){
$method = "_set_".$name;
if ($name != 'tableRow' && method_exists($this, $method)) {
$this->$method($value);
} else {
$this->tableRow->$name = $value;
}
}
. . .
}

Now I have a hook so I can define a method like _set_priority() for
the 'priority' property, whether priority is one of the database
columns or whether it only lives in the Mapper. In that method, I can
write code to do something with that field. Maybe priority should get
transformed into an object instead of just being a scalar we fetched
from the database.

This gives us more flexibility, but there's still use cases for Data
Mapper that this doesn't handle. It's still more or less coupled to
the physical design of the underlying table.

>> I've written a class that fetches hierarchical data from a db table
>
> How are the relationships defined?

Too much to go into right here, but I'll just say I wrote this code as
part of an experiment to implement the Closure Table design for
hierarchical data. See my presentation "Hierarchical Models in SQL
and PHP" for information: http://www.slideshare.net/billkarwin/models-for-hierarchical-data

Also take a look at the accompanying TreeTable class: http://framework.zend.com/svn/framework/extras/incubator/library/ZendX/Db/Table/TreeTable.php

Regards,
Bill Karwin

Re: [fw-db] Extending Zend_Db_Table_Row_Abstract


On Jul 17, 2010, at 9:19 AM, Brad Waite wrote:

Table Row Gateway is intended only to give an object interface to the
row of data.

I'll accept that.  But when would you extend it?  Allen in ZFiA (p117-118) advocates adding "parts" to the Row Data Gateway that manipulate the row's data and using __get() to handle method requests.

I'd extend the Row class only to add operations on a row of data.  For example:

- Complex validation that can't be done by the database.
- Transforming values as you save them or retrieve them.  For example, if you use the Serialized LOB pattern (this is in PoEAA too), you could serialize a PHP object before saving in the database, and unserialize it as you fetch it.
- Enabling the row as the subject of an Observer.
- Other uses of Proxy or Decorator, such as logging or access control.

I've written a class that fetches hierarchical data from a db table, and I extended the Row class so that each Row has a reference to a Rowset which is its children.  I've committed my experimental code to the ZendX incubator:

Regards,
Bill Karwin

Re: [fw-db] Extending Zend_Db_Table_Row_Abstract

On 7/17/2010 12:04 AM, Peter Warnock wrote:

Thanks, Peter.

> Take a look at the Page Controller pattern and the DataMapper. The

Since I'm not handling requests or presenting any data at this point, I don't see the use of the Page Controller. My
descriptions may have been confusion though. A Store is an online catalog I from which want to archive the data, a
Page is one of multiple pages in a Store and a Product is one of multiple products on a Page.

However, it looks like the classes I currently have follow the Data Mapper pattern. From Fowler's brief description,
the Data Mapper is useful when an object requires parts that aren't in the database. But when all the parts *are* in
the database, why have another level of abstraction? My Store and Product objects have no extra parts, but the Page
object does. Should I use a Data Mapper for Store and Product for consistency sake, or should I abstract only Pages?

> Table Row Gateway is intended only to give an object interface to the
> row of data.

I'll accept that. But when would you extend it? Allen in ZFiA (p117-118) advocates adding "parts" to the Row Data
Gateway that manipulate the row's data and using __get() to handle method requests.

>
> - pw
>
> On Fri, Jul 16, 2010 at 9:06 PM, Brad Waite <freebsd@wcubed.net
> <mailto:freebsd@wcubed.net>> wrote:
>
> Hello all,
>
> I'm trying to read, parse & save data from several online stores.
> I'd like some suggestions on the the "Right Way" to
> do this according to the Zend Framework (or proper design pattern)
> way of thinking.
>
> For simplicity's sake, each store has multiple pages with multiple
> products on each page.
>
> My first thought was, "that's easy - make Store, Page and Product
> classes with corresponding tables." So I created a
> class property and a column in the db for each piece of information
> I wanted to save from the store, along with the
> requisite __construct(), load(), save() and update() methods.
>
> After reading up a bit more on Zend_Db_Table_Row, I decided that it
> was far simpler to have the framework do the heavy
> lifting and added a $tableRow property to each object. load()
> looked something like this:
>
> public function load($id){
> $where = $this->table->select()->where('id = ?', $id);
> if ($this->tableRow = $this->table->fetchRow($where)) {
> $this->id = $id;
> $this->pageNum = $this->tableRow->pageNum;
> $this->name = $this->tableRow->name;
> return true;
> } else {
> return false;
> }
> }
>
> save() was the inverse, setting $this->tableRow's properties to the
> object properties & calling $this->tableRow->save().
>
> After making that work, I noticed that most of my objects'
> properties were just being saved to their respective columns
> in the db. With the exception of a few methods to parse the HTML
> from the store, the only other methods were getters
> and setters.
>
> This seems like yet more duplication of effort. Why not extend
> Zend_Db_Table_Row_Abstract and add other properties and
> methods as necessary? The Page class would have a fair amount of
> HTML fetching & parsing code, and would create new
> Product objects to save.
>
> Would this then bastardize the Row Data Gateway pattern? Is this
> the "Wrong Thing" to do? If not, should the
> page-fetching and parsing routines go somewhere other than in the
> extended class? How should I create new Product
> objects from within the Page class (or shouldn't I)?
>
> In other words, when do I extend Table_Row and how much should be
> added to those classes?
>
> Thanks for any insights,
>
> -BMW
>
>

2010年7月16日星期五

Re: [fw-db] Extending Zend_Db_Table_Row_Abstract

You can get a basic explanation of the patterns here -> http://martinfowler.com/eaaCatalog/

Take a look at the Page Controller pattern and the DataMapper.  The Table Row Gateway is intended only to give an object interface to the row of data.

- pw

On Fri, Jul 16, 2010 at 9:06 PM, Brad Waite <freebsd@wcubed.net> wrote:
Hello all,

I'm trying to read, parse & save data from several online stores.  I'd like some suggestions on the the "Right Way" to
do this according to the Zend Framework (or proper design pattern) way of thinking.

For simplicity's sake, each store has multiple pages with multiple products on each page.

My first thought was, "that's easy - make Store, Page and Product classes with corresponding tables."  So I created a
class property and a column in the db for each piece of information I wanted to save from the store, along with the
requisite __construct(), load(), save() and update() methods.

After reading up a bit more on Zend_Db_Table_Row, I decided that it was far simpler to have the framework do the heavy
lifting and added a $tableRow property to each object.  load() looked something like this:

   public function load($id){
       $where = $this->table->select()->where('id = ?', $id);
       if ($this->tableRow = $this->table->fetchRow($where)) {
           $this->id            = $id;
           $this->pageNum       = $this->tableRow->pageNum;
           $this->name          = $this->tableRow->name;
           return true;
       } else {
           return false;
       }
   }

save() was the inverse, setting $this->tableRow's properties to the object properties & calling $this->tableRow->save().

After making that work, I noticed that most of my objects' properties were just being saved to their respective columns
in the db.  With the exception of a few methods to parse the HTML from the store, the only other methods were getters
and setters.

This seems like yet more duplication of effort.  Why not extend Zend_Db_Table_Row_Abstract and add other properties and
methods as necessary?  The Page class would have a fair amount of HTML fetching & parsing code, and would create new
Product objects to save.

Would this then bastardize the Row Data Gateway pattern?  Is this the "Wrong Thing" to do?  If not, should the
page-fetching and parsing routines go somewhere other than in the extended class?  How should I create new Product
objects from within the Page class (or shouldn't I)?

In other words, when do I extend Table_Row and how much should be added to those classes?

Thanks for any insights,

-BMW


[fw-db] Extending Zend_Db_Table_Row_Abstract

Hello all,

I'm trying to read, parse & save data from several online stores. I'd like some suggestions on the the "Right Way" to
do this according to the Zend Framework (or proper design pattern) way of thinking.

For simplicity's sake, each store has multiple pages with multiple products on each page.

My first thought was, "that's easy - make Store, Page and Product classes with corresponding tables." So I created a
class property and a column in the db for each piece of information I wanted to save from the store, along with the
requisite __construct(), load(), save() and update() methods.

After reading up a bit more on Zend_Db_Table_Row, I decided that it was far simpler to have the framework do the heavy
lifting and added a $tableRow property to each object. load() looked something like this:

public function load($id){
$where = $this->table->select()->where('id = ?', $id);
if ($this->tableRow = $this->table->fetchRow($where)) {
$this->id = $id;
$this->pageNum = $this->tableRow->pageNum;
$this->name = $this->tableRow->name;
return true;
} else {
return false;
}
}

save() was the inverse, setting $this->tableRow's properties to the object properties & calling $this->tableRow->save().

After making that work, I noticed that most of my objects' properties were just being saved to their respective columns
in the db. With the exception of a few methods to parse the HTML from the store, the only other methods were getters
and setters.

This seems like yet more duplication of effort. Why not extend Zend_Db_Table_Row_Abstract and add other properties and
methods as necessary? The Page class would have a fair amount of HTML fetching & parsing code, and would create new
Product objects to save.

Would this then bastardize the Row Data Gateway pattern? Is this the "Wrong Thing" to do? If not, should the
page-fetching and parsing routines go somewhere other than in the extended class? How should I create new Product
objects from within the Page class (or shouldn't I)?

In other words, when do I extend Table_Row and how much should be added to those classes?

Thanks for any insights,

-BMW

[fw-webservices] Zend Rest Client PUT request

An existing API is based on Zend_Rest_Controller and a separate zend
application (1.10.6) connects to it using Zend_Rest_Client.

$data = array('var' => 'text', 'num' => 1);
// path to rest controller with a putAction(){}
$path = '/core/public/rest';
$client = new Zend_Rest_Client('http://localhost:8888');
return = $client->restPut($path,$data);

When an array is passed as a second argument to
Zend_Rest_Client::restPut($path, $data) I get this exception instead of the
expected response from my server app.

Message: Cannot handle content type '' automatically. Please use
Zend_Http_Client::setRawData to send this kind of content.

Stack trace:

#0 /web/b2c_bank/library/Zend/Http/Client.php(957):
Zend_Http_Client->_prepareBody()
#1 /web/b2c_bank/library/Zend/Rest/Client.php(159):
Zend_Http_Client->request('PUT')
#2 /web/b2c_bank/library/Zend/Rest/Client.php(187):
Zend_Rest_Client->_performPost('PUT', Array)
#3 /web/b2c_bank/library/My/Service/Rest/ClientCore.php(48):
Zend_Rest_Client->restPut('/api/', Array)

p.s. all other REST methods (GET, DELETE, POST) work fine in the same
configuration

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Client-PUT-request-tp2291514p2291514.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

2010年7月13日星期二

Re: [fw-mvc] Dispatch problem - between action method call and view rendering

Sems that by moving my action helper to a higher priority (3) than
ViewRenderer (2) solved the problem...

Cristian
>
> I moved my action helper prior to ViewRendered helper (now my action
> helper has prooprity 2 and ViewRenderer has priority 3) but still the
> action view seems to be rendered prior to running my helper
> postDispatch method...
>
> Cristian
>> -- Cristian Bichis<cristi@imagis.ro> wrote
>> (on Monday, 12 July 2010, 12:30 PM +0300):
>>> I need to accomplish this: once an Action method is called (for all
>>> actions,
>>> from any module and controller; not just for one case) so i can run
>>> my own
>>> code, but BEFORE the action view is actually rendered.
>>>
>>> Sample of problem: I am trying to dynamically set the doctype for
>>> any action,
>>> based on the layout selected by each action. So the action view is also
>>> rendered with the same doctype as the layout!
>> Register an action helper that defines a postDispatch() hook... but make
>> sure it happens _before_ the ViewRenderer is registered with the helper
>> broker.
>>
>> As an example, using a resource method in your bootstrap:
>>
>> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
>> {
>> protected function _initMyhelper()
>> {
>> Zend_Controller_Action_HelperBroker::addHelper(
>> new My_Helper_PostDispatchActions()
>> );
>> }
>> }
>>
>> If you move this to a resource plugin, just make sure your configuration
>> defines it _prior_ to the view plugin:
>>
>> resources.myhelper[] =
>> resources.view[] =
>>
>> This will ensure that your helper gets registered first. Since the
>> HelperBroker acts on helpers as a stack, i.e. FIFO, this will ensure
>> that it executes before the ViewRenderer (which is registered during the
>> view resource, or even later, curing dispatch() of the front
>> controller).
>>
>> Now, as to your action helper, it would look something like the
>> following:
>>
>> class My_Helper_PostDispatchActions
>> extends Zend_Controller_Action_Helper_Abstract
>> {
>> public function postDispatch()
>> {
>> $layout = Zend_Layout::getMvcInstance();
>> $layoutScript = $layout->getLayout();
>>
>> switch ($layoutScript) {
>> case '...':
>> // ...
>> break;
>> default:
>> break;
>> }
>> }
>> }
>>
>>> If checking for the current layout occurs on a controller plugin
>>> postDispatch
>>> the view is already rendered so only the layout would have been
>>> rendered with
>>> correct doctype, and the action view is rendered with the default
>>> doctype
>>> rather than with the doctype of selected layout... So i need to
>>> actually set
>>> the doctype between action method call and action view rendering...
>>>
>>> That's just a sample of problem. I couldn't accomplish this by using
>>> controller
>>> plugin postDispatch and also with a postDispatch of a registered
>>> helper (using
>>> Zend_Controller_Action_HelperBroker::addHelper);
>>>
>>> Cristian
>
>

Re: [fw-mvc] Dispatch problem - between action method call and view rendering

I moved my action helper prior to ViewRendered helper (now my action
helper has prooprity 2 and ViewRenderer has priority 3) but still the
action view seems to be rendered prior to running my helper postDispatch
method...

Cristian
> -- Cristian Bichis<cristi@imagis.ro> wrote
> (on Monday, 12 July 2010, 12:30 PM +0300):
>> I need to accomplish this: once an Action method is called (for all actions,
>> from any module and controller; not just for one case) so i can run my own
>> code, but BEFORE the action view is actually rendered.
>>
>> Sample of problem: I am trying to dynamically set the doctype for any action,
>> based on the layout selected by each action. So the action view is also
>> rendered with the same doctype as the layout!
> Register an action helper that defines a postDispatch() hook... but make
> sure it happens _before_ the ViewRenderer is registered with the helper
> broker.
>
> As an example, using a resource method in your bootstrap:
>
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
> protected function _initMyhelper()
> {
> Zend_Controller_Action_HelperBroker::addHelper(
> new My_Helper_PostDispatchActions()
> );
> }
> }
>
> If you move this to a resource plugin, just make sure your configuration
> defines it _prior_ to the view plugin:
>
> resources.myhelper[] =
> resources.view[] =
>
> This will ensure that your helper gets registered first. Since the
> HelperBroker acts on helpers as a stack, i.e. FIFO, this will ensure
> that it executes before the ViewRenderer (which is registered during the
> view resource, or even later, curing dispatch() of the front
> controller).
>
> Now, as to your action helper, it would look something like the
> following:
>
> class My_Helper_PostDispatchActions
> extends Zend_Controller_Action_Helper_Abstract
> {
> public function postDispatch()
> {
> $layout = Zend_Layout::getMvcInstance();
> $layoutScript = $layout->getLayout();
>
> switch ($layoutScript) {
> case '...':
> // ...
> break;
> default:
> break;
> }
> }
> }
>
>> If checking for the current layout occurs on a controller plugin postDispatch
>> the view is already rendered so only the layout would have been rendered with
>> correct doctype, and the action view is rendered with the default doctype
>> rather than with the doctype of selected layout... So i need to actually set
>> the doctype between action method call and action view rendering...
>>
>> That's just a sample of problem. I couldn't accomplish this by using controller
>> plugin postDispatch and also with a postDispatch of a registered helper (using
>> Zend_Controller_Action_HelperBroker::addHelper);
>>
>> Cristian

2010年7月12日星期一

Re: [fw-mvc] Dispatch problem - between action method call and view rendering

Thanks, Matthew !

Cristian
> -- Cristian Bichis<cristi@imagis.ro> wrote
> (on Monday, 12 July 2010, 12:30 PM +0300):
>> I need to accomplish this: once an Action method is called (for all actions,
>> from any module and controller; not just for one case) so i can run my own
>> code, but BEFORE the action view is actually rendered.
>>
>> Sample of problem: I am trying to dynamically set the doctype for any action,
>> based on the layout selected by each action. So the action view is also
>> rendered with the same doctype as the layout!
> Register an action helper that defines a postDispatch() hook... but make
> sure it happens _before_ the ViewRenderer is registered with the helper
> broker.
>
> As an example, using a resource method in your bootstrap:
>
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
> protected function _initMyhelper()
> {
> Zend_Controller_Action_HelperBroker::addHelper(
> new My_Helper_PostDispatchActions()
> );
> }
> }
>
> If you move this to a resource plugin, just make sure your configuration
> defines it _prior_ to the view plugin:
>
> resources.myhelper[] =
> resources.view[] =
>
> This will ensure that your helper gets registered first. Since the
> HelperBroker acts on helpers as a stack, i.e. FIFO, this will ensure
> that it executes before the ViewRenderer (which is registered during the
> view resource, or even later, curing dispatch() of the front
> controller).
>
> Now, as to your action helper, it would look something like the
> following:
>
> class My_Helper_PostDispatchActions
> extends Zend_Controller_Action_Helper_Abstract
> {
> public function postDispatch()
> {
> $layout = Zend_Layout::getMvcInstance();
> $layoutScript = $layout->getLayout();
>
> switch ($layoutScript) {
> case '...':
> // ...
> break;
> default:
> break;
> }
> }
> }
>
>> If checking for the current layout occurs on a controller plugin postDispatch
>> the view is already rendered so only the layout would have been rendered with
>> correct doctype, and the action view is rendered with the default doctype
>> rather than with the doctype of selected layout... So i need to actually set
>> the doctype between action method call and action view rendering...
>>
>> That's just a sample of problem. I couldn't accomplish this by using controller
>> plugin postDispatch and also with a postDispatch of a registered helper (using
>> Zend_Controller_Action_HelperBroker::addHelper);
>>
>> Cristian

Re: [fw-mvc] Dispatch problem - between action method call and view rendering

-- Cristian Bichis <cristi@imagis.ro> wrote
(on Monday, 12 July 2010, 12:30 PM +0300):
> I need to accomplish this: once an Action method is called (for all actions,
> from any module and controller; not just for one case) so i can run my own
> code, but BEFORE the action view is actually rendered.
>
> Sample of problem: I am trying to dynamically set the doctype for any action,
> based on the layout selected by each action. So the action view is also
> rendered with the same doctype as the layout!

Register an action helper that defines a postDispatch() hook... but make
sure it happens _before_ the ViewRenderer is registered with the helper
broker.

As an example, using a resource method in your bootstrap:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initMyhelper()
{
Zend_Controller_Action_HelperBroker::addHelper(
new My_Helper_PostDispatchActions()
);
}
}

If you move this to a resource plugin, just make sure your configuration
defines it _prior_ to the view plugin:

resources.myhelper[] =
resources.view[] =

This will ensure that your helper gets registered first. Since the
HelperBroker acts on helpers as a stack, i.e. FIFO, this will ensure
that it executes before the ViewRenderer (which is registered during the
view resource, or even later, curing dispatch() of the front
controller).

Now, as to your action helper, it would look something like the
following:

class My_Helper_PostDispatchActions
extends Zend_Controller_Action_Helper_Abstract
{
public function postDispatch()
{
$layout = Zend_Layout::getMvcInstance();
$layoutScript = $layout->getLayout();

switch ($layoutScript) {
case '...':
// ...
break;
default:
break;
}
}
}

> If checking for the current layout occurs on a controller plugin postDispatch
> the view is already rendered so only the layout would have been rendered with
> correct doctype, and the action view is rendered with the default doctype
> rather than with the doctype of selected layout... So i need to actually set
> the doctype between action method call and action view rendering...
>
> That's just a sample of problem. I couldn't accomplish this by using controller
> plugin postDispatch and also with a postDispatch of a registered helper (using
> Zend_Controller_Action_HelperBroker::addHelper);
>
> Cristian

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-mvc] Dispatch problem - between action method call and view rendering

Hi,

I need to accomplish this: once an Action method is called (for all actions, from any module and controller; not just for one case) so i can run my own code, but BEFORE the action view is actually rendered.

Sample of problem: I am trying to dynamically set the doctype for any action, based on the layout selected by each action. So the action view is also rendered with the same doctype as the layout!

If checking for the current layout occurs on a controller plugin postDispatch the view is already rendered so only the layout would have been rendered with correct doctype, and the action view is rendered with the default doctype rather than with the doctype of selected layout... So i need to actually set the doctype between action method call and action view rendering...

That's just a sample of problem. I couldn't accomplish this by using controller plugin postDispatch and also with a postDispatch of a registered helper (using Zend_Controller_Action_HelperBroker::addHelper);

Cristian

2010年7月10日星期六

Re: [fw-mvc] Problem with custom route

Take a look at the exception trace. That seems more like a url constructing exception than a routing exception.

--
Hector


On Sat, Jul 10, 2010 at 10:12 AM, Marcus Stöhr <dafish@soundtrack-board.de> wrote:
Hi.

I define a named route through my application.ini:

resources.router.routes.userprofile.route = "/user/profile/:id/:name/*"
resources.router.routes.userprofile.defaults.controller = "profile"
resources.router.routes.userprofile.defaults.action = "index"
resources.router.routes.userprofile.defaults.module = "user"

When I try to access the following url: /user/profile/1/foobar/

I get an exception: Zend_Controller_Router_Exception: id is not specified

I have no idea where the problem is. Any advice?

- Marcus


[fw-mvc] Problem with custom route

Hi.

I define a named route through my application.ini:

resources.router.routes.userprofile.route = "/user/profile/:id/:name/*"
resources.router.routes.userprofile.defaults.controller = "profile"
resources.router.routes.userprofile.defaults.action = "index"
resources.router.routes.userprofile.defaults.module = "user"

When I try to access the following url: /user/profile/1/foobar/

I get an exception: Zend_Controller_Router_Exception: id is not specified

I have no idea where the problem is. Any advice?

- Marcus

2010年7月9日星期五

Re: [fw-mvc] Using the objects implementing the Serializable Interface with Zend_Application

You can solve this by starting your session after the autoloader has been fully configured. What I do is place the resources.session.* lines at the end of application.ini. If you do that, the session will be able to properly unserialize the object without a call to require_once.

--
Hector


On Fri, Jul 9, 2010 at 11:36 AM, Nathan Garlington <garlinto@gmail.com> wrote:
Hi all!

I have a cart application that uses the ideas found on Matthew Weier O'Phinney's blog found here: http://weierophinney.net/matthew/archives/202-Model-Infrastructure.html. It's a wonderfully written article (thanks Matthew!), and has helped me rethink how I conceptualize models and object aggregation in my applications.

When it came time to refactor my archaic shopping cart application, I decided to use some of those ideas, since they seemed to lend solve some design issues I was trying to resolve. Therefore I created a class designed as a data value object representing a discrete product (My_Model_Shop_Product) in the cart object. In addition, the object implements the Serializable Interface so that the session can be used as a container for cart data. Since the Product class must be loaded before the session is started, I have one require statement in index.php that loads the object before the application is bootstrapped. This solution doesn't seem "clean" to me, and whenever I look at the index file, the require statement seems incongruous. Of course, its commented so I know what is going on, but I would like to know if there is a more elegant solution to this situation.

I want to continue using the session as a container for cart data. I would prefer that the Product class be held in a Zend Application Resource, but these resources are called after Zend_Application sets up the session, so I am at a loss as to what to do. Or should I leave well enough alone? What would be the ZF way of doing this?

Any advice would greatly appreciated!

regards,

Nathan Garlington
www.tandrtrailer.com