zend-framework2

Trying to use Zend Escaper from ZF 2.1 in Zend Framework 1.11.11

三世轮回 提交于 2019-12-13 07:02:01
问题 I am trying to use the Zend Escaper class from Zend Framework 2.2 in Zend Framework 1.11.11 by copying the Escaper folder from the ZF 2.2 into ZF 1.11.11. I am trying to do this becuase in the Zend Escaper class documentation it says that the class is a stand-alone class and is not dependent on any of the other Zend classes/interfaces. But once I added the folder into our ZF 1.11.11 library and tried instantiating the Zend Escaper class and load the web page all I am seeing is an empty page.

ZF2 - Session dump on page change / refresh

こ雲淡風輕ζ 提交于 2019-12-13 06:49:38
问题 Last week i asked a question which is still unresolved (unfortunately). Here is the link : ZF2 empty session container between pages I'm opening a new question today because i found more understandable clues to explain my problem. This is very simple : Zend Framework 2 and/or PHP dump/purge my session containers on every single page load or refresh. It's even working like this with or without AJAX calls. Whatever i do, i can't persist my session datas because all is reset permanently. I tried

ZF2: How to attach listener on the event in the Module class?

风格不统一 提交于 2019-12-13 06:45:34
问题 I want to set a basePath to be the same for every component of my Mvc for a given request. I mean when I call these methods I want to get the same result, lets say '/spam/ham/' : echo $this->headLink()->prependStylesheet($this->basePath() . '/styles.css') // $this->basePath() has to be '/spam/ham/' $this->getServiceLocator() ->get('viewhelpermanager') ->get('headLink') ->rependStylesheet($this->getRequest()->getBasePath() . '/styles.css') // $this->setRequest()->getBasePath() has to be /spam

Number Normalization for Zend Framework 2

寵の児 提交于 2019-12-13 06:36:05
问题 I'm trying to normalize a number from a form, which will/could be in the local number format. e.g. Locale:en-US 1,234.56 -> 1234.56 Locale:nl-NL 1.234,56 -> 1234.56 Is there an equivalent in ZF2 to the ZF1 Zend_Locale_Format::getNumber ? Thanks in advance Aborgrove. 回答1: You mean something like the numberFormat Filter? 来源: https://stackoverflow.com/questions/17595260/number-normalization-for-zend-framework-2

How to access public folder in zf2 by htaccess subdomain [duplicate]

假装没事ソ 提交于 2019-12-13 06:23:21
问题 This question already has answers here : how can remove '/public' from url using htaccess for localhost and host server? (2 answers) Closed 5 years ago . I am new in zf2. Please help me. I setup my new zend project on www.example.com/zend/ directory but it didn't call directly. Its call via www.example.com/zend/public How can i access directly access by www.example.com/zend/ this url. I don't want to any changes in virtual host. I want only use of .htaccess file. Kindly suggest me solution.

return dynamic image zf2

血红的双手。 提交于 2019-12-13 06:20:21
问题 I use zend framework 2 and try to return an created with gd2 library jpeg image . but it doesn't work. could you look my code what's the problem? My code is run with plain php in normally but in zf2 problem? class PictureController extends AbstractActionController { public function colorPaletteAction(){ .... .... //canvas created at above. imagejpeg($canvas); imagedestroy($canvas); $response = $this->getResponse(); return $response->getHeaders()->addHeaderLine('Content-Type', 'image/jpeg'); }

Zend Framework 2 - Doctrine 2 - How to use GeoPointFields

瘦欲@ 提交于 2019-12-13 06:02:58
问题 I need to implement a GeoPointField with Doctrine2. It seems that Zend and Doctrine don't support it natively... Is there a best practice for validating such an input? In the database I'd use a simple string field, right? 回答1: /^(\-?\d+(?:\.\d+)?),?\s*(\-?\d+(?:\.\d+)?)$/ This regexp validates and captures GEO input: Latitude, Longitude Latitude Longitude Coords copied directly from GoogleMaps 来源: https://stackoverflow.com/questions/14067212/zend-framework-2-doctrine-2-how-to-use

Zend Framework 2 - get the new filename when uploading using a validator for inputfilter

醉酒当歌 提交于 2019-12-13 05:49:16
问题 I am new to ZF2, and I am trying to upload a file and use the "randomize" option of the Rename file adapter filter inside the validator. In the model I have this: public function getInputFilter() { $inputFilter = new InputFilter(); $inputFilter->add(array( 'name' => 'picture', 'required' => call_user_func(function() use ($prize_type_id){ if(isset($this->picture_old) && !empty($this->picture_old)){ return false; } if(in_array($prize_type_id, array(1,2,3,5))){ return true; }else{ return false;

Save entities in Database using One-To-Many relationship using Doctrine 2 and Zend Framework 2

*爱你&永不变心* 提交于 2019-12-13 04:54:00
问题 I have got a straight forward problem, but since it got tied up with Doctrine 2 and Zend Forms, giving it a try here for support from the experts. Let me start with my entities Team Entity: /** * * @ORM\Entity * @ORM\Table(name="team") * @property string $teamName * @property int $teamId */ class Team { /** * @ORM\Id * @ORM\Column(type="integer", name="teamId", unique=true); */ protected $teamId; /** * @ORM\Column(type="string") */ protected $teamName; /** * @ORM\OneToMany(targetEntity=

How can I find out which Language was used by Translator in ZF2?

a 夏天 提交于 2019-12-13 04:47:17
问题 In my ZF2 application I want to retrieve the language that was used to translate the page. I use the ZendSkeletonApplication as basis. In the Module.php I set the Locale like this: public function onBootstrap($e){ $translator = $e->getApplication()->getServiceManager()->get('translator'); $translator->setLocale( Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) ->setFallbackLocale('en_US'); } I can retrieve the locale and the fallbackLocale from the Zend\I18n\Translator\Translator ,