I'm having trouble creating adapter objects in a controller file named List Controller. My code is
namespace blog \ controller; Use the blog \ Service \ PostServiceInterface; Zend \ Mvc \ Controller \ AbstractActionController; Use Zend \ View \ Model \ ViewModel; Use Zend \ Db \ Sql \ Sql; Use Zend \ Db \ Adapter \ Adapter; Class List Controller Expands AbstractActionController {/ ** * @ar Blog \ Service \ PostServiceInterface * / protected $ postService; Public function __ composition (PostServiceInterface $ postService) {$ this- & gt; PostService = $ postService; } Public Function Index () {$ Adapter = New Zend / db / Adapter / Adapter ($ configArray); Print_r ($ adapter); // code ....}} Here is the error that is serching to find Zend \ Db \ Adapter \ Adapter inside the blog \ controller -> Fatal Error: Category 'Blog Can not tell me how can I return two folders from the way above? The controller \ zend \ db \ adapter \ adapter did not get found. So that you can get the right object?
You do not need a fully qualified class name (FQCN) when you type a new Use the adapter
, then declare that category path through the usage statement:
Use Zend \ Db \ Adapter \ Adapter;
Change this block
Public function index () {$ adapter = new zend \ db adapter adapter ($ configArray); Print_r ($ adapter); }
to
public function indexing () {$ adapter = new adapter ($ configArray); Print_r ($ adapter); }
This should work.
However, the new \ zend \ dB \ adapter / adapter ($ configArray)
also works (notice
you also read the section of the document .
No comments:
Post a Comment