FAQ Database Discussion Community


Php Mysql select query not working

php,mysql,zend-framework,zend-framework2
The below query results in the following error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'AccountId' in where clause is ambiguous $select = $this->select() ->from(array('finance_account' => DB_TABLE_PREFIX . 'finance_account'), array( 'AccountId', 'ParentAccountId', 'AccountGroupId', 'AccountPath', 'AccountCode', 'AccountName', 'Description' )) ->joinLeft(array('ac' => DB_TABLE_PREFIX . 'customer'), 'finance_account.AccountId = ac.AccountId', array()) // using "array_unique()" to...

Doctrine Query Builder Result: not looping correctly

php,symfony2,zend-framework,doctrine2,doctrine-query
I'm not sure if it's that I'm not doing correctly but this is giving me an error: I have 2 Entities: Task and TaskUser. They are connected by a onetoMany. What I want to do is this: foreach($tasks as $task){ echo $task->getTitle; echo $task->getTaskUser()->getFirstName(); } This is my query in...

Manipulate value in Zend_Registry

php,zend-framework
I have an array that I write into Zend_Registry: Zend_Registry::set('myArray', $myArray); Now I want to add a new value to that array. I know that Zend_Registry is not a good choice at all and I know that it is kind of read-only. But is there any way to update it?...

FPDF cell text doesn't fit

php,zend-framework,fpdf
This is my PDF view. $pdf->cell text doesn't fit in the cell because is too big. How can I make my text go to another line if it doesn't fit? Here's a screenshot: ...

Zend 1 Redirect to controller from library

php,zend-framework
$this->_helper->redirector('save', 'index', 'report', $params); This does not work when i use it from a library file It says Fatal error: Call to undefined method Mylib::getHelper(). But When used from controller it works properly. Can any guide me with code what I need to do?...

PHP Zend library results in Fatal Error: class 'Zend\[whatever]' not found

php,zend-framework
I'm hoping someone can spot what I've forgotten to do. Here are my steps: Downloaded and unpacked the ZendFramework-2.3.5 into /usr/share. Updated include_path in my php.ini file to include '/usr/share/ZendFramework-2.3.5/library' per the INSTALL.md, and restarted Apache to confirm the path is set (now ".:/usr/share/php:/usr/share/ZendFramework-2.3.5/library"). Created a test script in my...

Stuck on No_Frills_Magento_layout section 2.4

php,xml,magento,zend-framework,mage
I have been following this guide fairly successfully up to this point here is the code I am working with: public function complexAction() { $layout= Mage::getSingleton('core/layout'); $path = Mage::getModuleDir('', 'Nofrills_Booklayout') . DS . 'page-layouts' . DS . 'complex.xml'; $xml = simplexml_load_file($path, Mage::getConfig()->getModelClassName('core/layout_element')); $layout->setXml($xml); $layout->generateBlocks(); echo $layout->setDirectOutput(true)->getOutput(); } } After loading...

File upload form validation invalid

php,zend-framework
Current form: $main = new Zend_Form_SubForm(); $kids = new Zend_Form_SubForm(); $number = $main->addElement(... attribs and so on ...); $this->addSubForms(array('main'=>$main,'kids'=>$kids)); When I'm adding this file upload fields to my form: for($index = 1; $index <= 10; $index++) { $name = 'Image'.$index; $label = 'Image'.$index; $image = new Zend_Form_Element_File($name); $image->setLabel($label) ->addValidator('Count', true,...

How to create Log File on hourly basis in Zend Framework 1.1

php,apache,zend-framework,logging,logfile
I have created log file on day basis but on day basis content have huge amount of data and difficult to download and open so i want to create on hour basis Below the content of log4phpconfig.xml Path :library\log4php\log4phpconfig.xml <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns="http://logging.apache.org/log4php/"> <appender name="default" class="LoggerAppenderDailyFile"> <layout class="LoggerLayoutPattern"> <param...

DB connection issue when trying to connect with Zend Framework Abstract.php No Such File Or Directory

php,mysql,sockets,zend-framework,mamp
I am trying to setup a ZF1 application on my local machine using MAMP. I am attempting to run the Ruckusing Database migrations, however it appears that ZF1 cannot connect to my DB. This is the command I am running and the error I get. crmpicco-MacBook:confirmation crmpicco$ php vendor/ruckusing/ruckusing-migrations/ruckus.php db:migrate...

How to use helper classes in zf2?

zend-framework,zend-framework2
I'm using Zend Framework 2 for web apps. In a controller Action I would create some PDF Documents. I'd like to use a helper class for developing the methods creating the PDF. What is the best place to store the class? inside the controller directory? Or does the framework provide...

How to properly terminate or throw from index.php

php,exception,zend-framework
In index.php of a Zend Framework app. I check for the existence of application.ini and local.ini. If these don't exist then I want to exit and put a message in a place where it can be seen such as syslog. In the context of PHP and ZF1 what is a...

Pimcore multilanguage site static route

php,zend-framework,routing,pimcore
I've just recently started working with Pimcore in my work and I'm now on a project consisting of three languages each in their seperate tree. Today the sites URL is my-site.com/LANGUAGE/sub-page For example: my-site.com/se/about But what we would want to have is LANGUAGE.my-site.com/sub-page. For example: se.my-site.com/about I've tried using the...

codeigniter not working after installing zend Framework

php,codeigniter,zend-framework,ubuntu-14.04
I am using Ubuntu 14.04. i have done a project using codeigniter and that was working fine. but now i thought of learning zend framework and installed zend framework 1.12.3 on my machine using this tutorial Digital Ocean. When i tried to access the new project i have created http://localhost/ZendApp...

ZF2 directory structure for lots of applications

php,zend-framework,zend-framework2,directory,structure
I'm learning ZF2 and I need some help. I am working in a company which has an intranet. We have lots of applications like newsletter, HR, website control, helpdesk, etc. Is it correct to put all the applications in the same ZF2 directory structure as if they were modules? Like...

Is there a way to print out SQL query sentence in phpstorm?

php,zend-framework
I am currently debugging php code. One of the trouble is, I don't know how to print out the variable's value. Our code is constructed in Zend framework and IDE is phpstorm. For example, for the following SQL query, how can I print out the actual sql sentence sending to...

ZF2 - update user profile page

php,authentication,zend-framework,zend-framework2
I am building a website using Zend Framework 2, managing authentication with ZfcUser. Now I'm working on a page where a registered user can update his profile data. I noticed that even after the user updated his data via a form, and the data are written to the database, the...

ZF2 - Display image in view based on full path

php,image,zend-framework,zend-framework2
I have managed to upload image file in ZF2 and store full path in the database. Path looks like this: /home/ubuntu/NetBeansProjects/project/data/upload/event_5554a7b600c0f.jpg Project structure is a Zend Skeleton application: project data upload event_5554a7b600c0f.jpg module public In my view I call: <img src="<?php echo $event->getImage(); ?>" class="img-thumbnail" alt="<?php echo $event->getTitle(); ?>" width="304"...

Trigger Zend FlashMessenger in jQuery

php,jquery,ajax,zend-framework
I'm facing an issue and I was wondering if someone could point me in the right direction. I am using Zend's FlashMessenger in my controllers, but in one of my files I handle my forms via AJAX posts. I thought Humane-flatty would be a nice replacement for Zend FlashMessenger in...

How I can use custom view helper for form in Zend Framework 1?

php,zend-framework
I try to create a custom ViewHelper to integrate that code of Dennis D.: label = '<label ' . $this->_htmlAttribs($label_attribs) . ' for="' . $optId . '">' . $opt_label .'</label>'; // Wrap the radios in labels $radio = '<input type="' . $this->_inputType . '"' . ' name="' . $name ....

Overriding ZF2 global/local config: unsetting

zend-framework,zend-framework2
I've run into a problem where my local config overrides global but I need local to remove not just override. E.g. // global.php 'mail_transport' => [ 'type' => 'Zend\Mail\Transport\Smtp', 'options' => [ 'host' => 'smtp.gmail.com', 'port' => 587, 'connectionClass' => 'login', 'connectionConfig' => [ // ... ], ], ], //...

PHP-DI is not working in integration with ZendFramework2

php,zend-framework,zend-framework2,php-di
Could you please give a hint why PHP-DI integration with Zend Framework 2 is not working for me (reproduced with Apache/2.4.9 (Win64) PHP/5.5.12 and Apache/2.2.22 (Win32) PHP/5.3.13). composer.json: { "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.3.5", "mnapoli/php-di": "4.4.6", "mnapoli/php-di-zf2": "0.3.0", ... }, ... config\application.config.php: <?php return array( 'modules' => array( 'Morpho',...

Failed installation of zend-escaper with Composer

php,zend-framework,composer-php
I'm trying to install zend-escaper but I'm getting this error: This is strange as my PHP version (from phpinfo()) is 5.5.19, the message claims it is 5.3.5(!) which should satisfy the requirement anyway. My ZF version is 1.12.13 I'm using PHP Storm Can anyone help please? Thanks Tomasz...

Zend And YouTube Not Deleting Videos

zend-framework,youtube-api,google-client-login
Until yesterday I could delete YouTube videos using Zend framework. I was using this code: $httpClient = Zend_Gdata_ClientLogin::getHttpClient( $username, $password, 'youtube', null, 'MySite', null, null, 'https://www.google.com/accounts/ClientLogin'); $yt = new Zend_Gdata_YouTube($httpClient, '', '', $myDevKey); $vid = $yt->getVideoEntry($myVidID, null, true); $yt->delete($vid); Now I am getting this error: Expected response code 200, got...

How to get all available languages from Localized Fields in pimcore?

php,zend-framework,zend-locale,pimcore
I'm a little bit stuck with this: I have a controller where I'm collecting all available languages for an object in pimcore. Right now I simply take a Localized Field from that object, run through it via foreach and fill an array with the Localized Fields's keys. So I get...

Uninstalling php 5.3 in ubuntu 14.04

php,zend-framework,ubuntu-14.04
I have installed php 5.3 manually by executing commands like make & make install. But I need to upgrade it to v5.5 therefore I deleted all the directories related to php5 using sudo command. But when I run php -v Still I am getting PHP 5.3.29 (cli) (built: Jun 8...

How to send field name for required true validation in zend

php,zend-framework,zend-form,zend-validate
Here is what my form field, $this->addElement( 'text', 'title', array( 'placeholder' => 'Title', 'class' => 'form-control', 'required' => true, 'filters' => array( 'StringTrim' ), 'autocomplete' => 'off', ) ); I Simply need the error string like: Title is required and can't be empty....

Socialengine addon Advanced Events Plugin v4.8.8p2 throwing errror on create

php,zend-framework,socialengine
I've got a site set up with the base Socialengine setup going. I've installed most of the SocialEngineAddon suite of plugins, and for some reason, the Advanced Events plugin throws this error when I try and create one ie: example.com/appeals/create I've tried renaming back to the default site-event, but the...

Static route for a subdomain in pimcore

php,zend-framework,routing,pimcore
I need to add a static route in pimcore that only takes effect for a special subdomain. So e.g. /de/json should snap for the URL api.example.org/de/json but not for www.example.org/de/json. Is this possible in pimcore? Or do I have to work with Zend Framework's Hostname? Thanks! ...

Cell width = text width FPDF

php,pdf,zend-framework,export,fpdf
I have made a PDF exporter, which takes data from a model and export it in PDF by FPDF library. $pdf = new FPDF(); $pdf->AddPage(); foreach ( $finalData AS $finalRow ) { foreach($finalRow as $one) { $pdf->SetFont("Arial", "", "8"); $pdf->Cell(18, 5, $one, 1, 0, "C"); } $pdf->Ln(); } $pdf->Output();` But...

zend frmawork 1 set variable value of view in plugin

zend-framework,plugins
controller file class AController extends Model_BaseController { public function getCityAction() { $this->view->city = 'Ada'; } } plugin file class Plugin_ConvertObjectPublic extends Zend_Controller_Plugin_Abstract { public function postDispatch($request) { $layout = Zend_Layout::getMvcInstance(); $view = $layout->getView(); $view->newCity = strtoupper($view->city); } } newCity variable pass to NULL value ? how can I change variable...

Php Class not Found (Zend)

php,class,zend-framework
I am getting an error Php Class not Found (Zend) My Folder Hierarchy : /FFMobile(main Folder) /Controller(Folder) /Model(Folder) /Tournament.php /class1.php /method1(); /class2.php /method2(); My goad is to access Class1 and class2 in Tournament.php ATM I am trying to access them in a following way $data1 = /class1::method1(); $data2 = /class2::method2();...

Zendframework(1.12.11) view helper not found in phpunit

zend-framework,phpunit
I have following directory structure for view helper in my zendframework project --application --views --helpers --Test.php and configuration setting in application.ini is resources.view.helperPath = APPLICATION_PATH "/views/helpers" and configuration in Bootstrap.php is $view->setHelperPath(APPLICATION_PATH . "/views/helpers/"); in Test.php file naming convention is class Zend_View_Helper_Test extends Zend_View_Helper_Abstract {} and I am using helper...

Doctrine2: Lazy loading fails and I have to re-initialize the class

php,zend-framework,doctrine2
I have three entities wallpost, albums and photos. wallpost has many to one relationship with albums. album has one to many relationship with photos. When I post photos on my wall, the data goes into all three tables. One record in wallpost, one in album and multiple in photos. Now...

How to use group in phpunit?

zend-framework,phpunit
How to invoke phpunit for zendframework module group wise. I mean when you invoke phpunit then it invoke module1 first then module2 and so on.

JQuery :toggle images

php,jquery,zend-framework
I would like to toggle photo by jQuery while I click on specific div , I have two image (close1.gif and open.png), Now it's working just first time , close photo replace to open photo, but I want to replace open photo to close if I click on div again....

Zend Framework 2 Cache filesystem

php,zend-framework,zend-framework2
I've been using the filesystem adapter for cacheing data. E.g.. $cache = StorageFactory::factory(array( 'adapter' => array( 'name' => 'filesystem' 'options' => array('ttl' => 1800, 'cache_dir' => './data/cache'), ), )); But when using the getItem() function AFTER the TTL clocks over it returns false on success etc, which it should... However,...

Error in Array comparison in php

php,arrays,zend-framework,foreach,zend-framework2
Below are the sample arrays I'm Comparing. Table 1 $csvData= ( [0] =&gt; Array ( [Account Number] =&gt; 1.01100156278101E+15 [Posting Date] =&gt; 2014/07/08 [Value Date] =&gt; 2014/07/08 [Description] =&gt; Cash Withdrawal by Cheque-173320--TT1421957901 [Debit Amount] =&gt; 2000 [Credit Amount] =&gt; [Running Balance] =&gt; 388392.62 ) [1] =&gt; Array ( [Account...

Create dynamic input name with Zend Form

php,forms,zend-framework,zend-form
I would like to make my Zend_Form_Element_Text dynamic, i.e it will accept different input name. I have this: $email = new Zend_Form_Element_Text('email'); It create an input with 'email' as the name: <input name="email" id="email" size="20" maxlength="100" placeholder="Email" class="input" type="text"> But sometimes I receive some external POST request and their input...

Different login states when using www vs no www

php,zend-framework,zend-framework2,zfcuser
I am using zfc user and am having issues with users being logged in/out based on web address. If the user logs in at www.foo.com they are able to access all their pages. However if they move to foo.com they must re log in. How can I prevent this? Is...

Zend 1 3d party NameSpaces autoload don't working

php,zend-framework,amazon-web-services,namespaces,autoloader
I'm trying to implement Amazon WebServices PHP SDK into my Zend 1 project, but it seems to fail loading the classes. I have got the library into library/Eplan/AmazonCloudSearch and after investigation it seems that in order to be able to load the namespace I need to call the registerNamespace method...

Fetch the maximum value of a field having same id in php

php,mysql,zend-framework,zend-framework2,zend-db-table
Here's my code,I need to return all the InstallmentDate's along with the return data,the issue here is I have same OrderInstallmentDetailsId for multiple InstallmentDate's. $select = $this->select() ->setIntegrityCheck(false) ->from(array('j' => DB_TABLE_PREFIX . 'finance_journal'), array( '*', 'JournalCreatedDate' => 'CreatedDate' )) ->join(array('jr' => DB_TABLE_PREFIX . 'finance_journal_reference'), 'j.JournalId = jr.JournalId', array( 'totalDebitAmount' =>...

Zend Cache Static directory configuration in Zend Framework 1.11

caching,zend-framework,config
How can I configure temporary directory for Zend Cache (Zend Cache Static)? Now it tries to save the files to / and I get the open_basedir restriction in effect. I use Zend Application with application.ini file config. ZF v 1.11 Maybe I need to set the default tmp dir somewhere...

Pass array on url using zend framework 2 routes

php,zend-framework,routes,zend-framework2
I have a web app that lets user make multiple searches and show the results of that searches all on the same page. Here's a basic structure: Search 1 - Attribute 1 = X - Attribute 3 = Y Search 2 -Attribute 2 = Z All these results are loaded...

Convert SQL query to Zend DB Select [closed]

php,mysql,zend-framework
How to convert this query to a Zend DB Query SELECT t1.date, t1.station, t1.ftype, t1.price, t1.currency FROM fueling as t1 INNER JOIN (SELECT MAX(t2.date) as maxdate, t2.station, t2.ftype FROM fueling as t2 GROUP BY t2.station, t2.ftype) as t3 ON t1.date=t3.maxdate AND t1.station=t3.station AND t1.ftype=t3.ftype where t1.station in ('GF112','GF11') ORDER by...

Understanding bootstrap, config.php, application.ini

php,zend-framework
I´m still beginner with Zend Framework. If I read different articles I wonder which are the differences between the three configuration files, bootstrap.php, config.php and application.ini. I only use the application.ini, my bootstrap so far ist empty (of course it is called in my index.php), at the moment I don´t...

Set APPLICATION_ENV in Zend Framework 1.12

zend-framework
I just stated to get familiar with Zend Framework 1.12 and I don't understand how the dispatching of the application environment should work. In the Zend Framework index.php I can see: // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); When I var_dump(getenv('APPLICATION_ENV')) I get "bool(false)". So...

How to route pages using text instead of IDs?

zend-framework,zend-framework2,zend-route,zend-router
Currently, my Zend application routes using the URL: example.com/news/12 Selects the news with ID 12 to display on page. But the client wants to use only text, example: example.com/news/man-dies-after-burning-himself Does someone knows how can it be done?...

Zend framework 2 PHP requirement

php,zend-framework,zend-framework2
Can we run Zend framework 2 on PHP 5.5, PHP 5.6 or any latest version? This official requirement link says: PHP 5.2.11 or later. This official FAQ link says: Zend Framework 2 is based on PHP 5.3. We expect to add support for PHP 5.4 once it starts to be...

Zend form validation - NotEmpty + StringLength

forms,validation,zend-framework
In form element, I have edited error messages: $this->addElement('text', 'type', array( 'label' => 'Type: ', 'class' => 'form-control', 'placeholder' => 'type', 'required' => true, 'validators' => array( array('validator' => 'StringLength', 'options' => array('min' => 3, 'max' => 10, 'messages' => array('stringLengthTooShort' => 'The type is too short.', 'stringLengthTooLong' => 'The...

Laravel, Codeigniter or Zend? [closed]

java,codeigniter,laravel,zend-framework
I want to develop an ERP application. What is the best framework to use. Am good with Codeigniter and ready to learn a better framework. Plus, the application will be used in a a large organization. I have read many forums but can't end up with a concrete reason why...

Get Google Plus Images Using Zend Framework 1 Gdata

php,cakephp,zend-framework,google-plus,gdata
I've been searching for an answer for this for quite some time now. I've looked into the other questions here but couldn't find a relevant one to my situation. Googling the question wasn't helpful as well. Basically, I am using ZF1's Gdata class to access the photos api. This was...

Zend InputFilter requires intl PHP extension?

php,zend-framework,zend-framework2
I am setting up some filters and validators for my form, but when I submit it, this error appears: "Zend\I18n\Filter component requires the intl PHP extension". Is this because of the Alnum and Alpha validators ? Code: public function getInputFilter() { if (!$this->inputFilter) { $inputFilter = new InputFilter(); $inputFilter->add(array( 'name'...

Zend Frame Work Cron Error

php,zend-framework,cron,zend-framework2
My second cron action (sendDailyRecap) works however I also get an email informing me of an error. Error Message: Zend Framework 2.3.3 application Usage: Reason for failure: Invalid arguments or no arguments provided I believe the issue lies in my module.config file. Any ideas why I'm getting an error (when...

Zend date validator fail for format dd-mm-yyyy

php,validation,date,zend-framework
I have the following code: <?php $dateString = '12.12.12'; $dateCheckArray['format'] = 'dd-mm-yyyy'; $validator = new Zend_Validate_Date($dateCheckArray); if ($validator->isValid($dateString)) { echo 'valid'; } else { echo 'invalid'; } The code works ok for most formats, but for the one specified it fails when using a . date instead of a -...

controller action not found on production server

php,zend-framework
In my development area (wamp) everything works fine. Today I uploaded my whole project to my production webspace. I seems like in the production area, some paths are lost. First I saw that in my start layout (ZEND_Layout) my pictures aren't found. So I needed to change the paths to...

Is it possible to set a separator for Zend Framework 2 form rows or display them in paragraphs?

php,zend-framework,formcollection
I have this for a form $this->add(array( 'name'=>'username', 'type'=>'Text', 'options'=>array( 'label' => 'Username', ) )); $this->add(array( 'name'=>'password', 'type'=>'Password', 'options'=>array( 'label' => 'Password', ) )); and echo $this->formCollection($form); This are obviously just the relevant parts of the code. The output is as follows: <fieldset ><label><span>Username</span><input type="text" name="username"...

Zend Skeleton Application album tutorial 404

php,zend-framework,zend-framework2
As far as I can see I've followed the Zend skeleton application tutorial to the letter (I actually went through it twice with the same result) but when I try to access zf2-tutorial.localhost/album I get the following error: A 404 error occurred Page not found. The requested URL could not...

How to manage Zend session save handler using Zend?

php,zend-framework,memcached,zend-session,libmemcached
I want to save zend session in memcache rather than files bases session management. I have correctly added memcache.dll file in Windows 8 x64 system and check that memcache is working fine and have also installed memcached and windows services showing memcached Server running. I have searched so far for...

How to add special span to addDisplayGroup fieldset

php,html,zend-framework,zend-form
What should I modify in this piece of code. $this->addDisplayGroup($groupInputs, 'group_'.$i, array('attribs'=>array('class'=>'fieldset_group'))); to add in fieldset new html tag like: <span class="delete_fieldset" onclick="foo()">[X]</span> Or if its possible: <span class="delete_fieldset_$i" onclick="foo($i)">[X]</span> ...

Transfert a Zend Project to Symfony

php,symfony2,zend-framework
I have a project made using Zend. My boss asked me to change the technology to Symfony 2.7. Is there a way to transfer the project ? Or to take some files into Symfony ? Or should I begin all the project from scratch using Symfony ? Thanks !...

Storing objects in an array and retrieving - PHP

php,oop,symfony2,zend-framework
I have 2 classes called Edge and Graph, I need to send set of edge objects (out side those classes) to Graph object by looping and retrieve from Graph Object. Please help on that. Graph Class class Graph { /** * Array of edge objects * * @var array */...

Throwing exceptions in pimcore

php,zend-framework,pimcore
Does anyone know if there are 'pimcore-exceptions' or do I have to throw the Zend Framework- or PHP-exceptions? I've scanned their GitHub-repository but found no hint. Thanks!...

Working with prefixes and Zend_Controller_Router_Route

php,zend-framework,zend-route
On an existing Zend Framework website with few controllers and no modules I need to add some prefixes to the default routes. For example, I currently have : /products /products/id/1 /training /commonpage I want to add a product line level, without duplicating my controllers in x modules (I'll just request...

ZendX Console Process posix functions

zend-framework,zendx
I am catch the follow exception in my code: ZendX_Console_Process_Exception' with message 'posix_* functions are required What's posix function is need for it work right? Thanks...

Password protecting Apigility admin UI without htpasswd

zend-framework,zend-framework2,apigility
I was being searching to password protect apiglity admin ui without using htpasswd, but i did not got any information about. Can anybody help me out with this? Thanks in advance...

Zend_Pdf how to reduce the loading time of images?

zend-framework,zend-pdf
I built an pdf document which is based on database records of 2 related tables. The mastertable contains shopdata with logos. In the records I of course don't save the image itself, but only the pathinfo. The detailtable just contains meeting dates, no problems with this one. If I start...

Zend Framework 2 - Sending form using Zend\Mail

php,jquery,ajax,zend-framework,sendmail
So i'm making a contact page. Of course it will have a form, which needs to be sent. I made the class to send email: <?php namespace Site\Mail; use Zend\Mail\Message; use Zend\Mail\Transport\Sendmail; class SendEMail { public function SendEMail($to, $from, $subject, $body) { $message = new Message(); $message->addTo($to) ->addFrom($from) ->setSubject($subject) ->setBody($body);...

Facebook share button shows thumbnail only after refresh. ZendFramework

php,facebook,facebook-graph-api,zend-framework
im using Zend Framework v1, I have implemented the facebook share button on my site. If I click the share button for the first time, the data is fetched (title, description and URL) but not thumbnail. However if I refresh the page, come back and press again the button, the...

PHP - how to send png or jpg email attachment?

php,zend-framework
I am using mandrillapp for mailing using following method. But i need to send JPEG or PDF or PNG scan copy from scanner. How can i do that please? public static function sendBcc($from, $to, $subject, $htmlBody, $bcc = '', $bcc1 = '', $utype = '') { $bcc = '', $bcc1...

HTTP response returning status 0 when adding filemimetype validator to Zf2 form

php,validation,zend-framework,zend-framework2,mime-types
I had an error when i add filemimetype validator to my validator chain in one of my forms. I got an http status 0 and there aren't messages on Apache 2 logs. Does someone have an idea about what's happening? Here is the code: $fileInput->getValidatorChain() ->attachByName('filesize', ['max' => 1440000], false)...

Zend paginator with AJAX

jquery,ajax,zend-framework,pagination
I have multiple albums listed on a page, next to each album are listed reviews about the album. Essentially this means there are many reviews about many albums on a single page. What would be the best approach to paginate each review section for each album? For example so each...

PHP ZF2 Mysql has gone away

php,mysql,zend-framework,zend-framework2
Hi I have a php daemon that handle request from rabbitmq After a day, it can no longer execute due to error MySQL has gone away. PHP Warning: PDOStatement::execute(): MySQL server has gone away in /var/www/daemon/www/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php on line 239 PHP Warning: PDOStatement::execute(): Error reading result set\'s header in /var/www/daemon/www/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php on...

Zend Framework 2 routing error: resolves to invalid controller class or alias

zend-framework,routing,zend-framework2,zend-framework-mvc,zend-framework-routing
I'm trying to learn Zend Framework 2 and I have their skeleton application up and running. In order to access it I visit http://localhost:8080/. When visiting that link it displays their generic Zend page. What I want to be able to do is visit http://localhost:8080/application/test and have it bring me...

zend 1 xsd validation

xml,zend-framework,xsd-validation
I am building a simple API end-point in ZF1 and got to the stage of XML validation. I could not find it anywhere in Zend documentation, so maybe someonehas come accross this before: Does Zend Framework 1 has any kind of library or wrapper for validating XML against XSD? or...

Validation for Add screen not working but it working in edit screen with same code

php,validation,zend-framework,zend-form
I am learning Zend framework and currently I have created add, update , delete functionality for country name and continent name and it is working perfectly. I have set validation by $name->setRequired('true'); and $continent->setRequired('true'); in my form.php. Validation is working in edit form but it return error 'An error occurred'...

Object of class Zend_Db_Table_Row could not be converted to string

php,mysql,zend-framework
I get the error message in the title when I run the following: $year = date('Y'); $month = date('n'); $day = date('j') - 3; $week = date('W') - 1; $select = "SELECT IF( station_name = '', 'Unknown', station_name ) station_name, station_name as db_name, sum(case when year(print_date) = $year then print_pages...

Use AJAX with Zend Framework 2

jquery,ajax,zend-framework,zend-framework2
I want to use AJAX with Jquery in my ZF2 project. Exactly, I want to change select options when an over select value change. For this, I try to implement AJAX method. I don't find a good tutorial on internet for my problem, but I try to do this with...

Content type-error when using Zend_Http_Client

php,post,zend-framework,zend-http-client
I'm trying to send data to Google Analytic's collector with Zend_Http_Client and POST. I have an array $postParams that's including my tracking-ID, cid and hit types and I add the values of this array to my client via setParameterPost(). Here's the relevant part of my Action: $client = new Zend_Http_Client('https://ssl.google-analytics.com/debug/collect');...

Zend Frameworks 1.12: how to join custom subquery table without returning results

php,zend-framework,zend-db-select
I need to create the following query (this is just an example) using Zend Framework 1.12 as part of a larger query: SELECT `s`.* FROM `s` INNER JOIN SELECT id FROM table where id = 13 AS `t` Here's my attempt: $query = $this->getDbTable()->select() ->from($this->getDbTable(), array('*')) ->join(array('t' => new Zend_Db_Expr('(SELECT...

Zend framework - how can i update the row if status field and id match?

php,zend-framework
How to updates the status='ok' only when status is NULL or done or notdone and id matches? $this->db->update('table1', array('status' => 'ok'), array('id=?' => 55)); ...

How to get a $_POST request from view module?

php,html,forms,zend-framework,zend-framework2
I want to get the checkboxes from a table in a view module, but I can't get it to work. This is the table: <form action="" method="post"> <TABLE id="dt_basic" class="table table-striped table-bordered table-hover dataTable"> <THEAD> <TR> <TH></TH> <TH>ID</TH> <TH>Client</TH> <TH>User</TH> <TH>Role</TH> <TH>Projects</TH> </TR> </THEAD> <TBODY> <?php /* @var $item Admin\Model\User...

Get the cid for Google Analytics in PHP/Zend Framework

php,zend-framework,google-analytics,measurement-protocol
I want to track the usage of an API. So I'm using Zend_Http_Client to send POST-parameters to Google Analytic's collector. The Google developers-page tells me, that I have to send a cid (Anonymous Client ID). But how can I send it via PHP when it is part of the _ga-cookie?...

Setting up ServiceManager with configuration files in Zend Framework 2

zend-framework,dependency-injection,zend-framework2,servicemanager
I have read ZF documentation about ServiceManager and think configuration (even in "config" php files) like public function getServiceConfig() { return array( 'invokables' => array( 'my-foo' => 'MyModule\Foo\Bar', ), ); } is very long and verbose. And, if I have a lot of dependencies, I want to use some sort...

zend framework 2 nested module structrue in one main module

php,zend-framework,zend-framework2
I am trying to create a app using zend framework 2. Have used structure as follow. Getting error class not found. Trying to created nested sub module login inside a main module called album. I have following structure: Album - src - Album - Controller - AlbumController.php - Form -...

Zend rpc json return array

php,arrays,json,zend-framework,zend-framework2
Hi there I have a small problem i can't figure out. Im writing a RPC service using ZendFramework and Apigility. The response must be a json array. Next comes all the content negotiation code. 'controllers' => array( 'NmdaWebApi\\V1\\Rpc\\Hola\\Controller' => 'Json', 'accept_whitelist' => array( 'NmdaWebApi\\V1\\Rpc\\Hola\\Controller' => array( 0 => 'application/vnd.nmda-web-api.v1+json', 1...

How to make zend to set time_zone in sql

php,mysql,zend-framework
I tried to execute a sql query that contains set time_zone='+8:00'; in zend, but couldn't execute it because of this string. How do I make so that it run the query properly? Code: $sql = "set time_zone='+8:00'; SELECT n.id, ..."; $query=$this->_db->query($sql); $fetch=$query->fetchAll(); return $fetch; ...

Reuse DB adapter on bootstrap to set custom handler DB session in Zend Framework

php,zend-framework,database-connection
In bootstrap: public function _initSession() { $config = Zend_Registry::get('config'); // application.ini $params = $config->default->resources->db->params->toArray(); $db = Zend_Db::factory($config->default->resources->db->adapter, $params); Zend_Db_Table_Abstract::setDefaultAdapter($db); $config = array( 'name' => 'session', 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'lifetime' ); Zend_Session::setSaveHandler( new...

Zend_Db - How to use results from Zend_Db_Table_Select

php,zend-framework
I'm forced to work with the Zend-Framework in my current project, but I'm stuck at a specific point. Unfortunately, the documentation of the framework is horrible and doesn't really help me at the moment. The solution is probably extremely easy, but i can't figure it out on my own. I'm...

Wrong datatype for referenced entity on Doctrine ObjectSelect

php,zend-framework,orm,doctrine2
I have a form which uses Doctrine's ObjectSelect to make a dropdown $this->add(array( 'name' => 'category', 'type' => 'DoctrineModule\Form\Element\ObjectSelect', 'options' => array( 'label' => 'Category', 'object_manager' => $em, 'target_class' => 'Blog\Entity\Category', 'property' => 'name' ), 'attributes' => array( 'required' => true ) )); the issue I have, is that this...

Zend File Create folder while uploading

zend-framework,zend-form
With this form element I'm uploading a file: $element = new Zend_Form_Element_File('foo'); $element->setLabel('Upload Image1:') ->setDestination('/var/www/upload'); $element->addValidator('Count', false, 1); $element->addValidator('Size', false, 102400); $element->addValidator('Extension', false, 'jpg,png,gif'); $form->addElement($element, 'foo'); This requires that the folder is already existing. How can I add an option, that the folder is beeing created, but only if a...

How to get video commented users profile Details using Zend Gdata YouTube?

php,zend-framework,youtube
I am trying to get the details of the video in youtube. I was able to get the details except the photo of the users who have commented in the video. How can I get the photo of user who have commented the video without authenticate on youtube. Here is...

Bootstrap of Zend Module is not loading

php,zend-framework,autoload
I am new in working with zend so I am facing this problem from the past two days. I have searched a lot but still can not find any solution. Possible duplicate of Zend Module Bootstrap does not load but it still can not solve my problem. In my User...

How to get the column names of table in a database in zend?

php,mysql,zend-framework
I am creating an app in zend where the user will enter the host, database name, username and password to connect the database and will able to retrieve the tables and columns in the tables also to start some work.. I am using this code to get the tables in...

ZF Error ZF tool setup

zend-framework,command-line-interface
Zend 1.9.1 so I get this error Blockquote ***************************** ZF ERROR ******************************** In order to run the zf command, you need to ensure that Zend Framework is inside your include_path. If you are running this without Zendframework in your include-path, you can alternatively set one of two enviroment variables to...

is not null condition in zend framework 2

php,mysql,sql,zend-framework,zend-framework2
I am new to zf and I've started working with zf2, I don't find much documentation for the syntax and all. My issue is how to write is not null condition in zf2 syntax. $select->where->notEqualTo('pe_name', ''); I've written for not equal to, now I need for is not null. I...

Sending Stock Update Email Magento

php,magento,zend-framework
I have been working on this stock update email alert module for my Magento store and I based my code on a magento stack exchange thread here. After much fiddling I got my own version to work. I was wondering why the example code did not work: class MyCompany_MyModule_Model_Observer {...

using decorators with file element

php,zend-framework,zend-form
I have trouble using decorators in combination with $logo=$this->createElement('file', 'logo') I have a form in table style, everything worked quite fine until I wanted to add a file element. Here is the related part of my code (form class): $logo=$this->createElement('file', 'logo') ->setLabel('logo:') ->setDestination(APPLICATION_PATH . "/../public/images/logos") ->addValidator('Count', false, 1) ->addValidator('Size', false,...

How to make item selected in dropdown list

php,zend-framework,default
here is a piece of my php code, related to dropdown list creation: $s_t = array( "key1" => "value1", "key2" => 'value2', "key3" => 'value3'); $default_select = "value2"; $attr = array("id" => "name"); $form->addElement('select','name',"Choose your option:",$s_t, $attr); How to make default selected item in the list, according to $default_select value?...

How to check if string exists in table which is added using addslashes?

php,mysql,zend-framework
I am storing names in a database-column called 'name' using the following function: public function insertCategory($arrCat) { $id = $this->insert($arrCat); return $id; } $arrCat is passed from my controller: $arrCat = array( 'name' => addslashes($name), 'type' => $type, 'rank' => $catOrder, 'created_by' => $created_by, 'created' => Zend_Date::now()->toString('yyyy:MM:dd HH:mm:ss'), 'active' =>...