Coder Social home page Coder Social logo

tutorials's Introduction

Logo

Welcome to the Zend Framework 3.0 Release!

RELEASE INFORMATION

Zend Framework 3.0.1dev

This is the first maintenance release for the Zend Framework 3 series.

DD MMM YYYY

UPDATES IN 3.0.1

Please see CHANGELOG.md.

SYSTEM REQUIREMENTS

Zend Framework 3 requires PHP 5.6 or later; we recommend using the latest PHP version whenever possible.

INSTALLATION

We no longer recommend installing this package directly. The package is a metapackage that aggregates all components (and/or integrations) originally shipped with Zend Framework; in most cases, you will want a subset, and these may be installed separately; see https://docs.zendframework.com/ for a list of available packages and installation instructions for each.

We recommend using either the zend-mvc skeleton application:

$ composer create-project zendframework/skeleton-application project

or the Expressive skeleton application:

$ composer create-project zendframework/zend-expressive-skeleton project

The primary use case for installing the entire framework is when upgrading from a version 2 release.

If you decide you still want to install the entire framework:

$ composer require zendframework/zendframework

GETTING STARTED

A great place to get up-to-speed quickly is the Zend Framework QuickStart.

The QuickStart covers some of the most commonly used components of ZF. Since Zend Framework is designed with a use-at-will architecture and components are loosely coupled, you can select and use only those components that are needed for your project.

MIGRATION

For detailed information on migration from v2 to v3, please read our Migration Guide.

COMPONENTS

This package is a metapackage aggregating the following components:

CONTRIBUTING

If you wish to contribute to Zend Framework, please read the CONTRIBUTING.md and CODE_OF_CONDUCT.md files.

QUESTIONS AND FEEDBACK

Online documentation can be found at https://docs.zendframework.com/. Questions that are not addressed in the manual should be directed to the relevant repository, as linked above.

If you find code in this release behaving in an unexpected manner or contrary to its documented behavior, please create an issue with the relevant repository, as linked above.

Reporting Potential Security Issues

If you have encountered a potential security vulnerability in Zend Framework, please report it to us at [email protected]. We will work with you to verify the vulnerability and patch it.

When reporting issues, please provide the following information:

  • Component(s) affected
  • A description indicating how to reproduce the issue
  • A summary of the security vulnerability and impact

We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure; this helps protect Zend Framework users and provides them with a chance to upgrade and/or update in order to protect their applications.

For sensitive email communications, please use our PGP key.

LICENSE

The files in this archive are released under the Zend Framework license. You can find a copy of this license in LICENSE.md.

ACKNOWLEDGEMENTS

The Zend Framework team would like to thank all the contributors to the Zend Framework project; our corporate sponsor, Zend Technologies / Rogue Wave Software; and you, the Zend Framework user.

Please visit us sometime soon at http://framework.zend.com.

tutorials's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tutorials's Issues

Default [controller_name]/ address doesn't route to index Action

I have the following router config:

 'users' => [
                'type'    => Segment::class,
                'options' => [
                    'route'    => '/users[/:action][/:id]',
                    'defaults' => [
                        'controller' => Controller\UsersController::class,
                        'action' => 'index',
                    ],
                ],
            ],

The URLs like: users/edit points at editAction() and users/index calls indexAction().

My main question here is: what's for 'defaults' key if the address: users/ doesn't point to indexAction? Is this a bug or it should work like this, or maybe there is other way to have users/ pointing at index action?

Blog-Module > zend-paginator >> unable to transform from album to blog

Hello there,
for all beginners such tutorials are very useful, no question.
The "album"-part is a good start but a lot f people (like me) would have problems to implement new modules.

So, the "continuation" with the blog-module is a really nice try.... but:

  • it does not cover all features "learned" before, like the missing zend-paginator

  • caused by the completely different programming"style" beginners are unable to adapt the album-coding to the blog-coding to do this.
    (example: load all entries from table, album vs blog
    AlbumTable.php vs ZendDbSqlRepository.php
    fetchAll() <> findAllPosts()
    return $this->tableGateway->select(); VS
    // $sql = new Sql($this->db);
    $select = $sql->select('posts');
    $statement = $sql->prepareStatementForSqlObject($select);
    $result = $statement->execute();

      if (! $result instanceof ResultInterface || ! $result->isQueryResult()) {
          return [];
      }
    
      $resultSet = new HydratingResultSet($this->hydrator, $this->postPrototype);
      $resultSet->initialize($result);
      return $resultSet;
    

//

and so on.

In my opinion, this is very confusing...

Anybody else with the same problem?

Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (Album) could not be initialized.

I've been following this tutorial up to here but when i run what i see in my browser is the code inside /module/Album/src/Module.php and also the message saying Module(Album) could not be initialized. What could've been wrong?
-Also, when I enable development mode I cannot open the ZF homepage, I got this:

Fatal error: Class 'ArrayUtils' not found in /var/www/ZendSkeletonApplication/public/index.php on line 43

Zend Framework 3: Autoload Custom Libraries

Can any one tell how to include the Custom Libraries in Zend Framework 3 .
I have tried implementing the way that was used for Zend Framework 2 but I'm still getting this error

Fatal error: Class 'Lib\FusionCharts' not found in /var/www/html/skeleton/module/Album/src/Controller/AlbumController.php on line 13

I have created a folder Lib in the vendor forlder of the zend framework which has my custom Class FusionCharts which I want to include in index page of the "album"

error
module
albumcontroller

minor issue in Album-UnitTest-Blog

Hi Team,
It is really a great job with regard to ZF3. Much much better organised documents and improved performance. Thanks and congrats!

Some minor issues:

  1. In the Module.php of album tutorial:
    return include DIR . '/config/module.config.php';
    should be:
    return include DIR . '/../config/module.config.php';
  2. In "Testing actions with POST" of UnitTest, it is not clear about editAction() and deleteAction. "Testing the editAction() and deleteAction() methods can be performed similarly;" To a new babies, we cannot get them. Can you please add detailed function contents?
  3. In "writing a factory" of "Blog" tutorial:
    return new ListController($container->get(PostRepositoryInterface::class);
    should be: return new ListController($container->get(PostRepositoryInterface::class));
  4. I wonder if there are some graphs that can concisely illustrate the concepts' relationship and ZF logic structure?
  5. Why we need ZF expressive? I couldn't find a tutorial or document from Zend website.

Thanks,

album and blog tutorials full code

This is not an issue, but rather a request, I believe it would be very helpful for beginners to have the full code for both tutorial applications.
It will provide not only a better perspective but it'll show "real life" best practice for writing code and following ZF coding standards. For an example in the tutorial code snippets the comments are removed to make them more readable, but this "hides" a vital part of coding which beginners should know and understand.
I have already seen some experiments with those two apps from different authors but you never know whether they are done the best way.

couldn't get throught "edit" blog functionality

when clicking "edit", the "edit" page doesn't show existing blog message. when submitting the update, a error comes up.

error: module\Blog\src\Model\ZendDbSqlCommand.php:63
seems no identifier (id) has been submitted.

anyone has same issue? how to fix it? thanks!

Development mode vs. Production mode

First, forgive me if this is not the right place to discuss this matter or if this is considered as a noob question.

The difference between Development and Production mode is confusing for some of us (one example here: Can't see /album module URL but there are many others on stackoverflow.com).

Would it be possible to explain in the doc (here Development mode) how the cache is working in production. I mean if the only way to avoid the 404 error is to be in development mode or to overwrite the 'config_cache_enabled' => false parameter in config/application.config.php, how are we supposed to do to enable cache in production while avoiding the 404 error?

de/learning.quickstart.create-model SQL issue

https://framework.zend.com/manual/1.11/de/learning.quickstart.create-model.html

Just found that the german Translation has an issue in one of the SQL Statements:

-- scripts/data.sqlite.sql
-- Man kann damit beginnen die Datenbank zu befüllen indem die folgenden SQL
-- Anweisungen ausgeführt werden.

INSERT INTO guestbook (email, comment, created) VALUES
('[email protected]',
'Hallo! Hoffentlich geniesst Ihr dieses Beispiel einer ZF Anwendung!
DATETIME('NOW'));
INSERT INTO guestbook (email, comment, created) VALUES
('[email protected]',
'Baz baz baz, baz baz Baz baz baz - baz baz baz.',
DATETIME('NOW'));

should be:

-- Man kann damit beginnen die Datenbank zu befüllen indem die folgenden SQL
-- Anweisungen ausgeführt werden.

INSERT INTO guestbook (email, comment, created) VALUES
('[email protected]',
'Hallo! Hoffentlich geniesst Ihr dieses Beispiel einer ZF Anwendung!',
DATETIME('NOW'));
INSERT INTO guestbook (email, comment, created) VALUES
('[email protected]',
'Baz baz baz, baz baz Baz baz baz - baz baz baz.',
DATETIME('NOW'));

so an ', is missing in line 8.

Trouble with Tutorial on Zend 2 (myabums project), Application Module could not be initialized

Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (Application) could not be initialized.' in C:\xampp\htdocs\myalbums\vendor\zendframework\zend-modulemanager\src\ModuleManager.php:203 Stack trace: #0 C:\xampp\htdocs\myalbums\vendor\zendframework\zend-modulemanager\src\ModuleManager.php(175): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent)) #1 C:\xampp\htdocs\myalbums\vendor\zendframework\zend-modulemanager\src\ModuleManager.php(97): Zend\ModuleManager\ModuleManager->loadModule('Application') #2 C:\xampp\htdocs\myalbums\vendor\zendframework\zend-eventmanager\src\EventManager.php(322): Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent)) #3 C:\xampp\htdocs\myalbums\vendor\zendframework\zend-eventmanager\src\EventManager.php(171): Zend\EventManager\EventManager->triggerListeners(Object(Zend\ModuleManager\ModuleEvent)) #4 C:\xampp\htdocs\myalbums\vendor\zendframework\zend-modulemanager\src\ModuleMan in C:\xampp\htdocs\myalbums\vendor\zendframework\zend-modulemanager\src\ModuleManager.php on line 203

i had follow thoroughly all the tutorial guide because i am totally new to zend 2 framework but when i reach the step where i add Album modules in Albums/config/autoload/application.config.php, i refresh http://myalbums, then i get this error. What had went wrong? Anyone had exerience this, i may need your help here, thank you.

css on website - tutorial page

Not sure if this is a right repo. to open issue?

As you can see from the image, text is hardly visible.
This problem occurs only on tutorial page.
ss

I am using Ubuntu and Chrome.

ZF3 MVC tutorial internationalization

Impossible to make the internationalization tutorial work without adding

'view_helpers' => [
    'invokables' => [
        'translate' => \Zend\I18n\View\Helper\Translate::class
    ]
],

into module/Application/config/module.config.php.

without this, I get the following error:

Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'A plugin by the name "translate" was not found in the plugin manager Zend\View\HelperPluginManager' in /zend-mvc-skeleton-application/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php:133

Module (Album) could not be initialized

I have this Fatal error when i follow the Zend Framework 2 official tutorial, i reach here : https://framework.zend.com/manual/2.4/en/user-guide/database-and-models.html

When i follow each step i have this error :
Fatal error: Uncaught Zend\ModuleManager\Exception\RuntimeException: Module (Album) could not be initialized. in C:\xampp\htdocs\zf2\vendor\zendframework\zend-modulemanager\src\ModuleManager.php:203 Stack trace: #0 C:\xampp\htdocs\zf2\vendor\zendframework\zend-modulemanager\src\ModuleManager.php(175): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent)) #1 C:\xampp\htdocs\zf2\vendor\zendframework\zend-modulemanager\src\ModuleManager.php(97): Zend\ModuleManager\ModuleManager->loadModule('Album') #2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent)) #3 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(490): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent)) #4 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(248): Zend\EventManager\EventManager->triggerListeners('loadModules', Object(Zend\ModuleManager\ModuleEvent)) #5 C:\xampp\htdocs\zf2\vendor\zendframework in C:\xampp\htdocs\zf2\vendor\zendframework\zend-modulemanager\src\ModuleManager.php on line 203

anyone can help ?

Getting Started Tutorial: Potentially wrong reference implementation of AlbumTable::saveAlbum

Regarding this part:

        if (! $this->getAlbum($id)) {
            throw new RuntimeException(sprintf(
                'Cannot update album with identifier %d; does not exist',
                $id
            ));
        }

        $this->tableGateway->update($data, ['id' => $id]);

In case getAlbum doesn't find the corresponding entry, it throws the exception, so saveAlbum won't be able to throw its own exception.
Wouldn't this be more correct in terms of logic:

        try {
            if ($this->getAlbum($id)) {
                $this->tableGateway->update($data, ['id' => $id]);
            }
        } catch (RuntimeException $e) {
            throw new RuntimeException(sprintf(
                'Cannot update album with identifier %d; does not exist',
                $id
            ));
        }

Bug at form validation in edit action - Forms and Actions Tutorial

public function editAction()
    {
        $id = (int) $this->params()->fromRoute('id', 0);

        if (0 === $id) {
            return $this->redirect()->toRoute('album', ['action' => 'add']);
        }

        // Retrieve the album with the specified id. Doing so raises
        // an exception if the album is not found, which should result
        // in redirecting to the landing page.
        try {
            $album = $this->table->getAlbum($id);

        } catch (\Exception $e) {
            return $this->redirect()->toRoute('album', ['action' => 'index']);
        }

        $form = new AlbumForm();
        $form->bind($album);
        $form->get('submit')->setAttribute('value', 'bearbeiten');

        $request = $this->getRequest();
        $viewData = ['id' => $id, 'form' => $form];

        if (! $request->isPost()) {
            return $viewData;
        }

        $form->setInputFilter($album->getInputFilter());
        $form->setData($request->getPost());

        if (! $form->isValid()) {
            return $viewData;
        }

        $this->table->saveAlbum($album);

        // Redirect to album list
        return $this->redirect()->toRoute('album', ['action' => 'index']);
    }

This is the code I am using. It is a copy from the "Forms and Actions" - tutorial from here.
https://docs.zendframework.com/tutorials/getting-started/forms-and-actions/ - status from 01.10.2018

If I am going to run this code, I get this error:

grafik

I tried to debug and I know when the problem is raising:

This is the "album" array before

if (! $form->isValid()) {
    return $viewData;
}

grafik

Values are fine, but after the $form->isValid function:

grafik

As you can see, the values are now null. I am not sure what exactly the problem is, but I am sure, because of this function -> the values are set to null. When I comment this, everything is working correctly. But I do not have any validation.

I hope for some help.

AlbumTableGateway setup missing in the tutorial

Hi,

I am setting up a database for Zend 3 and browsing the tutorial. It seems like there is a missing piece in Using ServiceManager to configure the table gateway and inject into the AlbumTable. In the AlbumTable factory a Model\AlbumTableGateway::class is used but there is no mention of that class before.

Got it working by creating an empty AlbumTableGateway class extending AbstractTableGateway but it would be good to mention about it in the tutorial.

create module in zendframework by cmd

path to project>php path to zftool\zf.php version is run on cmd than output is application module layout.phtml..

please help to create module in zend framework

Misinformation in tutorial

Dear ZF2 Team,
I am learning Zf2 for first time but i think i spotted some improper documentation on the Zf2. Please visit following link to get you to error.

  1. https://framework.zend.com/manual/2.3/en/getting-started-with-zend-studio/the-application.html

This link has mistake on routing under The application's Page. It was given that the routing link is module/Checklist/src/config/module.config.php but i believe /config/module.config.php should be under module/Checklist/ not under /src/ please check properly.

  1. https://framework.zend.com/manual/2.3/en/in-depth-guide/data-binding.html

Under Creating the edit template the name for edit action is missing the file name is given with add action i.e It should be edit.phtml.

The problem looks very simple but for person who is learning first time it is really headache. Please don't mind if i made a mistake on informing this issue.

Thanks

Zend\Db\Adapter\Exception\RuntimeException

Hi,

I have an error when I followed the tutorial https://docs.zendframework.com/tutorials/getting-started/database-and-models/

capture d ecran de 2018-10-27 09-49-04

#0 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php(255): Zend\Db\Adapter\Driver\Pdo\Connection->connect()
#1 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-db/src/Sql/Sql.php(138): Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement()
#2 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php(238): Zend\Db\Sql\Sql->prepareStatementForSqlObject(Object(Zend\Db\Sql\Select))
#3 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php(209): Zend\Db\TableGateway\AbstractTableGateway->executeSelect(Object(Zend\Db\Sql\Select))
#4 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php(196): Zend\Db\TableGateway\AbstractTableGateway->selectWith(Object(Zend\Db\Sql\Select))
#5 /var/www/html/progressive_app/zf-tutorial/module/Album/src/Model/AlbumTable.php(22): Zend\Db\TableGateway\AbstractTableGateway->select()
#6 /var/www/html/progressive_app/zf-tutorial/module/Album/src/Controller/AlbumController.php(22): Album\Model\AlbumTable->fetchAll()
#7 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Album\Controller\AlbumController->indexAction()
#8 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#9 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#10 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(105): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#11 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-mvc/src/DispatchListener.php(119): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#12 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#13 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /var/www/html/progressive_app/zf-tutorial/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#15 /var/www/html/progressive_app/zf-tutorial/public/index.php(40): Zend\Mvc\Application->run()
#16 {main}

Undefined index db in ZF3 tutorial

Following the instructions on Getting started: A skeleton application including all modules during installation, I get the following error when going to the app locally using Apache or the build-in php web server:

Notice: Undefined index: db in /var/www/zf3-tutorial/vendor/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php on line 27

Fatal error: Uncaught Zend\Db\Adapter\Exception\InvalidArgumentException: The supplied or instantiated driver object does not implement Zend\Db\Adapter\Driver\DriverInterface in /var/www/zf3-tutorial/vendor/zendframework/zend-db/src/Adapter/Adapter.php:82 Stack trace: 
#0 /var/www/zf3-tutorial/vendor/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php(27): Zend\Db\Adapter\Adapter->__construct(NULL) 
#1 /var/www/zf3-tutorial/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(750): Zend\Db\Adapter\AdapterServiceFactory->__invoke(Object(Zend\ServiceManager\ServiceManager), 'Zend\\Db\\Adapter...', NULL) 
#2 /var/www/zf3-tutorial/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(198): Zend\ServiceManager\ServiceManager->doCreate('Zend\\Db\\Adapter...') 
#3 /var/www/zf3-tutorial/vendor/zendframework/zend-developer-tools/src/Module.php(204): Zend\ServiceManager\ServiceMa in /var/www/zf3-tutorial/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 757

The configuration for the database is only 2 pages further in Database and models - Using ServiceManager to configure the table gateway and inject into the AlbumTable.

Maybe it would be good to add in the Getting started: A skeleton application a minimal db configuration example like the following:

// file: config/autoload/global.config
return [
        'driver' => 'Pdo',
        'dsn' => 'sqlite::memory:',
];

This small addition will allow new users to at least see the ZF example page without errors if they install all modules, including zend-db.

zf3_demo_page

On page Database and models - Using ServiceManager to configure the table gateway and inject into the AlbumTable mention can be made to replace the existing db configuration with the example configuration.

zf3 skeletion application - typo?

Hi there,

on setting up the album module on this part of the tutorial I guess there is a typo in the getConfig method.

current:

public function getConfig()
{
    return include __DIR__ . "/config/module.config.php";
}

correct:

public function getConfig()
{
    return include __DIR__ . "/../config/module.config.php";
}

Greetings

Writing a Factory Class - The requested controller was not dispatchable.

Hi,

In-Depth Tutorial, Models and the ServiceManager, Writing a Factory Class

The following error occurred at first:

Parse error: syntax error, unexpected ';' in /Applications/MAMP/htdocs/gsscc/module/Blog/src/Factory/ListControllerFactory.php on line 21

Then after commenting out the following:

A 404 error occurred
Page not found.
The requested controller was not dispatchable.

Controller:
Blog\Controller\ListController (resolves to invalid controller class or alias: Blog\Controller\ListController)

Additional information:
Zend\ServiceManager\Exception\InvalidServiceException

File:
/Applications/MAMP/htdocs/gsscc/vendor/zendframework/zend-mvc/src/Controller/ControllerManager.php:66

Message:
Plugin of type "NULL" is invalid; must implement Zend\Stdlib\DispatchableInterface

I read somewhere that it might be a php thing but I could sure use a solution.

My code is as follows as per the tutorial with the added commented out line for debugging:

get(PostRepositoryInterface::class); } }

Error in Getting Started with Zend Framework Database and Models Section

There's no explanation of what the Model\AlbumTableGateway class is.

Database and Models

namespace Album;

// Add these import statements:
use Zend\Db\Adapter\AdapterInterface;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\ModuleManager\Feature\ConfigProviderInterface;

class Module implements ConfigProviderInterface
{
    // getConfig() method is here

    // Add this method:
    public function getServiceConfig()
    {
        return [
            'factories' => [
                Model\AlbumTable::class => function($container) {
                    $tableGateway = $container->get(Model\AlbumTableGateway::class);
                    return new Model\AlbumTable($tableGateway);
                },
                Model\AlbumTableGateway::class => function ($container) {
                    $dbAdapter = $container->get(AdapterInterface::class);
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new Model\Album());
                    return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
                },
            ],
        ];
    }
}

Forms and actions - getArrayCopy

The code snippet when including the InputFilterAwareInterface to the Album Model show the getArrayCopy which is irritating, because at this point of the tutorial it is non existent.

Later when including the hydrator objects it will be implemented. #

Unable To run album module successfully, Getting The Below Error.. [HTTP ERROR 500]

[Tue Jan  8 10:47:58 2019] PHP Fatal error
:  Uncaught Zend\ModuleManager\Exception\RuntimeException
: Module (Album) could not be initialized. in /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-modulemanager/src/ModuleManager.php:203

Stack trace:
#0 /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-modulemanager/src/ModuleManager.php(175): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))

#1 /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-modulemanager/src/ModuleManager.php(97): Zend\ModuleManager\ModuleManager->loadModule('Album')

#2 /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))

#3 /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-eventmanager/src/EventManager.php(171): Zend\EventManager\EventManager->triggerListeners(Object(Zend\ModuleManager\ModuleEvent))

#4 / in /opt/lampp/htdocs/ZF/my-application/vendor/zendframework/zend-modulemanager/src/ModuleManager.php on line 203

Regex routing does not work on zf3

Regex routing does not work on zf3
example:

'cruise-detail' => [
                'type'    => Regex::class,
                'options' => [
                    'regex'    => '/(?<url>[a-zA-Z0-9_-]+)-n4ic(?<id_cruises>[0-9]+).html',
                    'defaults' => [
                        'controller'    => Controller\IndexController::class,
                        'action'        => 'details',
                        'url' => '',
                        'id_cruises' => '0',
                    ],
                    'spec' => '/%url%-n4ic%id_cruises%.html',
                ],
            ],

packages.json file could not be downloaded when upgrading to Zend Framework 3

I have a project in ZF 2.5 with PHP 5.5, and attempted to migrate it to ZF 3 today, but it failed at the first step. Can anyone help? This is my output:

>composer remove zendframework/zendframework
You are running composer with xdebug enabled. This has a major impact on runtime
 performance. See https://getcomposer.org/xdebug
Package "zendframework/zendframework" listed for update is not installed. Ignoring.
Loading composer repositories with package information
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
https://packagist.org could not be fully loaded, package information was loaded
from the local cache and may be out of date
Updating dependencies (including require-dev)
  - Installing phpdocumentor/reflection-common (1.0)
    Loading from cache

  - Installing phpdocumentor/type-resolver (0.2)
    Loading from cache

  - Installing sebastian/recursion-context (1.0.2)
    Downloading: Failed
    Downloading: Failed
    Downloading: Failed
    Failed to download sebastian/recursion-context from dist: The "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791" file could not be downloaded: SSL operation 
failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source
  - Installing sebastian/recursion-context (1.0.2)
    Cloning 913401df809e99e4f47b27cdd781f4a258d58791

Removal failed, reverting ./composer.json to its original content.


  [RuntimeException]
  Failed to clone https://github.com/sebastianbergmann/recursion-context.git,
   git was not found, check that it is installed and in your PATH env.
  'git' is not recognized as an internal or external command,
  operable program or batch file.


remove [--dev] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--no-update-with-dependencies] [--ignore-platform-reqs] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...

Given the first line, I attempted to go on to the next step and got this output:

>composer require zendframework/zend-component-installer
You are running composer with xdebug enabled. This has a major impact on runtime
 performance. See https://getcomposer.org/xdebug
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
https://packagist.org could not be fully loaded, package information was loaded
from the local cache and may be out of date
Using version ^0.2.0 for zendframework/zend-component-installer
./composer.json has been updated
Loading composer repositories with package information
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
https://packagist.org could not be fully loaded, package information was loaded
from the local cache and may be out of date
Updating dependencies (including require-dev)
  - Installing zendframework/zend-component-installer (0.2.0)
    Downloading: Failed
    Downloading: Failed
    Downloading: Failed
    Failed to download zendframework/zend-component-installer from dist: The "https://api.github.com/repos/zendframework/zend-component-installer/zipball/a8364d76ccadf5096b81b27740a618eae7f78a01" file could not be downloaded: SSL operation
failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source
  - Installing zendframework/zend-component-installer (0.2.0)
    Cloning a8364d76ccadf5096b81b27740a618eae7f78a01

Installation failed, reverting ./composer.json to its original content.


  [RuntimeException]
  Failed to clone https://github.com/zendframework/zend-component-installer.g
  it, git was not found, check that it is installed and in your PATH env.
  'git' is not recognized as an internal or external command,
  operable program or batch file.


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update]
[--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-
packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packag
es>]...

Same as zend2

No tutorial available for zend3 so I can use new feature of zend3. If there is how will come to know

Zend Framework Fatal error:Fatal error: Call to a member function getModuleName() on a non-object in D:\wamp\www\local.api2.voot.com\application\libraries\Zend\Controller\Action\Helper\ViewRenderer.php

I am using Zend framework on my project. I have one controller named IndexController.php and other PlayBackController.php.
I want to call a method of IndexController in playBackController. I have created an object of IndexController but I am getting the error : Fatal error: Call to a member function getModuleName() on a non-object in D:\wamp\www\local.api2.voot.com\application\libraries\Zend\Controller\Action\Helper\ViewRenderer.php .

Is there any way to use the function of IndexController in Zend????

Can't see /album module URL

I try to do simple ZF tutorial from here https://docs.zendframework.com/tutorials/getting-started/overview/. I installed ZF 3.0.0. And when I finish this step: https://docs.zendframework.com/tutorials/getting-started/database-and-models/ I can't see /album module in my browser. I do everything according to instructions. But as a result I get "A 404 error occurred Page not found. The requested URL could not be matched by routing." Why? Please help me. I can't understand why I can't do simple tutorial. I use Xammp and Windows 7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.