Questions tagged [zend-framework2]
Zend Framework 2 is a PHP 5.3+ 5.4 (for Zend Framework 2.4+) or 5.5+ (for Zend Framework 2.5.0+) MVC framework and component library.
8,670
questions
0
votes
0
answers
9
views
Zend Session Error, Session must be started before any output has been sent to browser
Changed my server for zend framework web application configured database connection and also written some basic .htaccess file for the website but after that error is coming when trying to run index....
0
votes
0
answers
9
views
How to use OptionalInputFilter and ways to validate it
I was looking for how to use OptionalInputFilter and the only page we can found leaves me some questions about its behavior.
I have a form with 2 inputs:
billing_type_id
tax_number.
The first one is ...
0
votes
0
answers
18
views
ZF2 / PHPUnit: Mock a Zend/Db/Adapter/Adapter
Problem: Not getting mocked DB adapter for use with all dependency
Created mock adapter using: $this->getMockBuilder('Zend\Db\Adapter\AdapterInterface')->disableOriginalConstructor()->getMock(...
0
votes
1
answer
37
views
In Zend Framework should a script be a service or a controller?
The context
I am refactoring an application in ZF2 that uses scripts to synchronize data with web services and APIs.
Currently each script resides in a controller, that is called through cron jobs ...
0
votes
0
answers
37
views
composer says that zend-serviccemanager 2.7.8 conflicts with zendframework 2.4.0
I have a legacy system that I have to mantain and at moment I can't update it to newest technologys
But i'm facing problems with AWS S3, and trying some things, I decided to reinstall the dependencies,...
0
votes
1
answer
178
views
using Doctrine With laminas project issue : "Class does not exist"
I just installed Doctrine with my Laminas project. I added a database connection and generated my entities in the Application folder (Application\Entity). I added my entities settings to the module....
-1
votes
1
answer
37
views
What is the method return type declaration for json in zend framework
In zend framework for APIs, I am using $this->_helper->json($data) to return json data
public function get()
{
$data = ['id' => 1, 'name' => 'xyz'];
return $this->_helper->...
1
vote
1
answer
22
views
How do I alter my unit test to utilise mocks within the setUp function?
I have a relatively basic phpunit test that contains 1 setUp function, and 2 tests - I am still learning phpunit so forgive my ignorance :) Note - I am using the Zend 2 Framework.
I would like the ...
0
votes
0
answers
85
views
ZF2 to Laminas migration when using Twig for rendering
I'm migrating my application from ZF2 to Laminas because I need to upgrade to PHP8.1. My issue is that with Zend Framework we were using ZfcTwig to have Twig be the renderer instead of the standard ...
0
votes
1
answer
42
views
Zend Framework 3 - Module won't load
So i've a web app using Zend Framework 3. It ran perfectly until today. I tried to add a module ("Params") and i can't figure why it doesn't load.
My Module tree :
My config/Module.config....
-1
votes
1
answer
79
views
getting error while using zend email validation:: PHP Fatal error: Uncaught Error: Class 'Zend\Validator\AbstractValidator'
I am trying to validate email while registration to makesure no spam.
For that purpose i learn that, Zend FrameWork is good for this.
So to try that following steps i followed:
i downloaded ...
0
votes
1
answer
45
views
Extending module but keep no-overwrite template map
I was looking for how to re-use my User module across other projects.
As I have custom features for each my clients, I decided to create:
One generic UserModule to be packaging
One extend-module ...
0
votes
0
answers
259
views
How can I setup error reporting with Laminas for a development environment?
This may be a simple question but, how do I get some error message with Laminas? I'm trying to migrate an old application from ZF2 to Laminas 3. It's always difficult to get any details from the ...
0
votes
0
answers
95
views
php mysql query file .sql async, I wish it was sync
php5.6, Zend Framework 2, mysql 5.7, PDO driver
My goal is to execute sync a .sql file with various sql statements, including 3500 sql insert statements, from php Zend2 app connected to mysql via PDO
...
0
votes
1
answer
157
views
Zend Framework compability with Lucene 8.4.1
I am using Lucene 3.5.0 for index creation. Zend-Framework-1.8.2 with PHP-7.1.12 is being used to search index.
I have upgraded Lucene from 3.5.0 to 8.4.1. The indexes are now created with Lucene 8.4....
0
votes
0
answers
57
views
PHP placeholders are not displaying until a refresh
I have a PHP form which is created using Zend Framework. I think I have added all the form placeholders correctly using constructor. But they are not showing in the browser until you refresh the page.
...
1
vote
2
answers
181
views
How do i handle the russian language?
Problem: Text get broken in MySQL.
problem
A. Text is sent over webservice as below
$text = 'как дела';
$data = array(
'text' => $text,
'client' => 'abcd');
$...
0
votes
2
answers
2k
views
PHP Guzzle could not resolve host on localhost, but works on server
I have this Zend 2 application where I'm making use of this Azure AD library for authentication. Everything has been working fine for a few months, but all of a sudden it stopped working on my ...
-1
votes
1
answer
43
views
problem when create project with zend framwork using wamp server
strong text
I'm using wamp version : 2.4 php version 7.1
I have problem like this when I try to create project in my www of wamp
please help advice . Thank you so much
Composer :
{
"name": ...
1
vote
0
answers
97
views
How to inject service manager into a Model file in Zend Framework 3
I just upgraded one project to Zend Framework 3 from ZF 1.x version.
In ZF 1.x version, we have implemented a functionality like provided an unique id for a request being made in the application using ...
0
votes
2
answers
82
views
ZF2 Soap Request - Send parameters
I am trying to send a SOAP request to a client's API endpoint. I am not at all familiar with SOAP, so having quite a difficult time getting this to work.
From the client's documentation
The requested ...
0
votes
1
answer
44
views
Zend Framework. A plugin by the name "prg" was not found
After updating Zend Framework to 3 version I got an error on user registration page:
Zend\ServiceManager\Exception\ServiceNotFoundException
File:
../vendor/zendframework/zend-servicemanager/src/...
0
votes
1
answer
51
views
Is it possible to use HTML form in Zend Framework instead of ZendForm?
Is it possible to use HTML form in Zend Framework instead of ZendForm ? In particular to a phtml file?
If so how is the <form action "abc.php"> going to work when form is submitted. ...
0
votes
1
answer
524
views
EntityManager persist expects parameter 1 to be an entity object, NULL given zend doctrine
I have this addaction controller and i'm getting this exception error though user are getting added.
public function addAction() {
$requestObj = $this->getRequest();
$viewModelObj = new ...
0
votes
1
answer
68
views
only Last 7 days from Todays Date in zend forms
My start only show past 7 days and compare with today's date in zend form and all past dates should disable except past 7 days. I have tried to set min option in attribute section but not working. ...
-1
votes
1
answer
129
views
(xampp zend framework2) server responded with a status of 500 ()
I have Xampp on windows, i'm working with zend framwork 2.
I have this error : localhost is currently unable to handle this request. http error 500
When i delete the code of my index.php as above and ...
0
votes
2
answers
2k
views
Can we run Zend framework 2.0.5 or 2.x.x version on PHP 7.3 or any latest version?
My Zend framework version is 2.0.5
In the original project, I hope to be able to easily use the php 7.3 version
Zend framework 2.0.5 or 2.x.x supports php 7.3?
or upgrate zf3?
0
votes
1
answer
47
views
can't use css file zf2 (Zend\View\HelperPluginManager::get was unable to fetch or create an instance for inlineStyle)
I have a css and js files, i want to use it and call it from controller, for js these lines work perfectly:
$serverUrl = $this->baseUrl();
$headScript = $this->getServiceLocator()->get('...
-1
votes
1
answer
408
views
How to include UTF-8 BOM to a CSV export with Zend
I have the option to export some data in my project to a .csv file, i already have the charset set to UTF-8 in the response headers, however, Excel won't open as UTF-8 just by double clicking the file,...
1
vote
0
answers
93
views
old project ZF2 - error in ServiceManager
We are trying to refactor and old ZF2 basecode to Laminas project, but we are failing to bring it up with the following error:
[Wed Mar 24 15:16:57 2021] PHP Fatal error: Uncaught exception 'Zend\...
0
votes
0
answers
86
views
This result is a forward only result set, calling rewind() after moving forward is not supported
i want to iterate à table to view tables data 2 time (in listbox and dropdown boutton), when i use one foreach for 1 inout it's ok, but when i use 2 foreach for 2 inputs i hade the bellow error i ...
0
votes
1
answer
805
views
Laminas - Unable to render template "xxxxxxx" resolver could not resolve to a file
This project has been ported over manually from Zend Frame work 2 to Laminas. The issue here is that the module.config.php has been set up in the same way as other modules that are working. However I ...
1
vote
1
answer
574
views
Can I run window and linux containers at the same time? Docker
I have a zendframework 2 website that need a linux OS, and the website use a search engine that run on windows OS (IIS). How to use docker to run the website and the search engine at the same time?
...
4
votes
0
answers
677
views
session_start(): Failed to read session data: user (path: ) -in phpUnit and zend-test
We are very new with setting up test automation for out zf2 application.
We use the test classes of zend-test (AbstractHttpControllerTestCase) since it's a zend application. We run it through phpUnit ...
0
votes
1
answer
155
views
What is version of Zend Framework?
One of our previous developer used this class but i couldn't find the zend version and documentation of this class
use Core\Db\BaseModels\BaseDbTable;
Please bear with me i have just started my zf ...
2
votes
1
answer
102
views
zf3 Listen to event triggered in another classes
I'm stuck with this for a while.
I have a service for each entity when i trigger various events
Eg in ArticleService saveArticle method
$this->triggerEvent('articleSaved', ['saved' => $entity]);
...
2
votes
1
answer
54
views
Diasble escaping in Zend 2 Forms
It seems that in some cases, allowing the attributes of a form element to be set without escaping might come in handy. Examples are assignment of multiple classes via
class="class1 class2"
...
-1
votes
1
answer
76
views
Unable to store Date in ISO8601 format for "datetime" data type column in MySQL
I am using Zend Framework 2 for Rest API and used the below code to generate a date to store in the DB table having data type "datetime".
$date = new \DateTime();
$create_date = $date->...
0
votes
1
answer
728
views
A simple REST API implementation for a website created on ZF
I have a website that stores inventory and I need to make a REST API because I have to put the web component and deliver the data to it. Communication will be secured by JWT. I found a very simple ...
0
votes
0
answers
95
views
Zend Framework - Json::encode return nothing
I have developed a web application using Zend Framework version 2.8 few months ago and i use json serialization to retrieve data from my database.
So heres the problem : I have just open again the ...
0
votes
0
answers
33
views
I want to upload 2 files on 2 differnt path on same form using Zend framework 2
My code is below. Only 2nd file (shareholder1) is getting upload, first file is not getting upload.The problem is with AddFilter..
$upload = new Zend_File_Transfer();
$company_name = $post['idcmpname']...
0
votes
1
answer
35
views
I want to upload 3 differnt file on differnt location in Zend framework2 but I have problem with addfilter
Here is my code ,how i am renaming files for differnt paths.My last file share holder is getting upload not uploading first 2.
$upload->addFilter('Rename', $path_memorandum .'/'.$...
0
votes
0
answers
793
views
An optional collection input filter - not passing empty/optional validation
I have a fairly complex form, which is presented in a tabbed format. Either of the fieldsets in the form need to be completed, so i am looking at using an OptionalInputFilter. The fieldset i am having ...
1
vote
0
answers
466
views
How to mock parameterized method in codeception framework
I have one parameterized method which accept string parameter and returns data upon passed param. I am using codeception framework for writing unit testing for php-zend project.
Method: getDataByView(...
0
votes
2
answers
591
views
Zend framework 3 ORDER BY FIELD
How would you write the following query in Zend framework 3 ?
SELECT * FROM table_name ORDER BY FIELD(field_name, 'a','b','c');
I tried
$select->order(new Expression("FIELD(field_name, 'a', 'b',...
0
votes
1
answer
295
views
Doctrine 2 define property type without column creation
I have an Address entity which is bind to a ZF / Laminas Form.
Some properties are defined. Such as street, country, ....
/**
* @var string
*
* @ORM\Column(type="string", length=2)
*/
protected $...
0
votes
2
answers
227
views
Laminas Image Resize
I'm creating a website with Laminas (new zend framework).
And I have to resize the upload images. The images are NOT being upload using zend form as I created a dropzone.
The thing is that I need to ...
0
votes
2
answers
759
views
$option in Rediect->toRoute() use for what?
I have a question about Controller Plugin: Redirect.php
I have already read about it but still don't understand clearly
/**
* Generate redirect response based on given route
*
* @...
1
vote
1
answer
209
views
json payload arguments and PUT method directly with the dispatch
The third parameter is an array in the dispatch method, so how can I pass the JSON payload in PUT request?
Json paload - {"website":"test"}
Example,
$this->dispatch(
'testUrl',
'...
0
votes
1
answer
223
views
Zend 2 escaping single-quote
I am using Zend Framework 2 to generate the following escaped single-quote SQL query,
SELECT
`document`.*
FROM
`document`
WHERE
(
`document`.`document_taxon` LIKE '%Men\'s Health %...