zend-framework2

zf2 Form Collection Validation - Unique Elements in Fieldsets

╄→尐↘猪︶ㄣ 提交于 2019-12-24 13:10:40
问题 I want to add unique Elements in a Zend Form Collection. I found this awesome work from Aron Kerr I do the forms and fieldsets like in Aron Kerr´s Example and it works fine. In my case i create a Form to insert a collection of stores from a company. My Form First of all i have a Application\Form\CompanyStoreForm with a StoreFieldset like this: $this->add(array( 'name' => 'company', 'type' => 'Application\Form\Stores\CompanyStoresFieldset', )); The Fieldsets Application\Form\Stores

An alias “ScnSocialAuth_ZendSessionManager” was requested but no service could be found

只谈情不闲聊 提交于 2019-12-24 12:50:45
问题 I am trying to install ScnSocialAuth_ZendSessionManager into my zend 2 application. i am getting the following error message when i try to go to the login or registration page: An alias "ScnSocialAuth_ZendSessionManager" was requested but no service could be found. i have followed the instructions here: and uploaded it. i then install ./vendor/socalnick/scn-social-auth/config/scn-social-auth.global.php.dist /vendor/socalnick/scn-social-auth/config/scn-social-auth.local.php.dist to my config.

Router Match not returning matchedRouteName

牧云@^-^@ 提交于 2019-12-24 12:46:23
问题 I have been slowly working my way through a few issues with the help of this website. I think I am onto my last problem now. In my boostrap I have the following code: $eventManager = $event->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); $serviceManager = $event->getApplication()->getServiceManager(); $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function($event) use ($serviceManager ){ $exception =

Zend 2 Doctrine 2 Gedmo Translatable

泄露秘密 提交于 2019-12-24 11:27:42
问题 I am trying to use the Gedmo translatable extension for Doctrine 2 in a Zend Framework 2 application. I have it setup like this: 'doctrine' => array( 'eventmanager' => array( 'orm_default' => array( 'subscribers' => array( 'Gedmo\Translatable\TranslatableListener' ) ) ), 'driver' => array( 'application_entities' => array( 'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', 'cache' => 'array', 'paths' => array(__DIR__ . '/../src/Application/Entity') ), 'translatable_metadata_driver' =>

ZF2 Query WHERE clause with DATE() for datetime column

断了今生、忘了曾经 提交于 2019-12-24 10:55:43
问题 I have a column with datetime data type and I want to build a SQL query in Zend Framework2 which compare date part with user input date. Need to build similar part as DATE(datetime column) = '2014-09-16' with; $select->where(); would be very grateful if someone could help on this. 回答1: Use like this: $date = '2014.05.24'; $select->where('date(expecting_date) = "'.$date.'"'); 回答2: You should use predicate expression for these kind of conditions, like : $select = new \Zend\Db\Sql\Select(table

Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for db

ⅰ亾dé卋堺 提交于 2019-12-24 10:35:38
问题 i have made a login form. I'm always getting this error in my controller that it was unable to fetch or create an instance for this db. i have read all the documentation about it and why this error occurs. i tried everything to fix this problem, but it is still not working. Can somebody help me. I'm using my database for other things and it can make a connection, but when i want to load the login page, i'm getting this error. This is the code in my global.php return array( 'db' => array(

ZendFramework 2 AuthService available in ViewFile

主宰稳场 提交于 2019-12-24 09:39:07
问题 I wanted to get something like this (this is from controller) $authService = $this->serviceLocator->get('auth_service'); if ($authService->hasIdentity()) { [...] } else { [...] } in the view file (*.phtml) co i can display login or logout link... 回答1: There's an identity() view helper already available in the framework, to use it you need to map your auth service instance to Zend\Authentication\AuthenticationService , which you can do by aliasing it to your auth_service in your module.config

Zend Framework 2 - Doctrine 2 - Use of Documentor Tags

孤街醉人 提交于 2019-12-24 09:00:18
问题 I'm new to Doctrine and Zend . I realized that in nearly all entity models (whereever I read a tutorial) I saw these documentor tags like @var or @property . They aren't required, right? So is it a bad thing to leave them out? It's really time-consuming adding and altering them for every attribute in my Entities. 回答1: This is simply a good habbit of programming and documenting your code. It helps your IDE to function better and makes it easier for other people (including yourself in a year

How can I pass extra parameters to the routeMatch object?

瘦欲@ 提交于 2019-12-24 08:58:32
问题 I'm trying to unit test a controller, but can't figure out how to pass some extra parameters to the routeMatch object. I followed the posts from tomoram at http://devblog.x2k.co.uk/unit-testing-a-zend-framework-2-controller/ and http://devblog.x2k.co.uk/getting-the-servicemanager-into-the-test-environment-and-dependency-injection/, but when I try to dispatch a request to /album/edit/1, for instance, it throws the following exception: Zend\Mvc\Exception\DomainException: Url plugin requires

Apply a module layout to zfcuser

佐手、 提交于 2019-12-24 08:51:33
问题 i'm working on zf2 and try to use 2 differents layouts. 1 layout for a public module and another one (private layout") for all the others. Its works pretty well but my zfcuser module in the public module use the other layout :/ i tried this : 'template_map' => array( 'zfc-user/user/login' => __DIR__ . '/../view/layout/blank.phtml', // blank is my public layout ), Instead of get the form in my layout, i get my form in the public layout AND in the "private" layout ... Does someone can help me ?