php - Getting blob type Doctrine entity property returns data only once -
I use the theory to store odd data options / different bits in an array and it's serial in the database I am where it is stored as a Blob. Everything was working fine, till today I found that array twice and saw that it only gets the right value for the first time. Any repeated attempts return false, which gives failure / stream_ get_contents on failure.
My best estimate is that the theory closes the stream after receiving the data, but it does not make much sense. I need to have data available during the entire request. I'm not an expert with streams:
How can I get Blob data or block the stream several times? Principle unit and these methods: Receive the serial options option: Your problem is experienced because you handle your tasks in between Do not do it. However, considering the unsettling performance of the array of options on each access is a bad idea. Each access must have the Update: Types of theory type are described.
/ ** * @ War resource * * @ORM \ column (name = "option", type = " Blob ") * / Private $ option; / ** * Set options * * @ Ultimate array $ option * * @ Return campaign * / Public function setopts ($ option) {$ this- & options; Options = serialize ($ option); $ This return; } / ** * Get options * * Returns array * / Public functions getOptions () {Repeat Cancel (stream_get_contents ($ this-> Option)); }
$ campaign = $ this- & gt; M-> GetRepository ('TreasureForgeMessageBundle: Campaign') - & gt; (1) is received; $ Options1 = $ Campaign- & gt; GetOptions (); // Right option array $ options2 = $ campaign- & gt; GetOptions (); // false $ option3 = $ campaign- & gt; GetOptions ();
$ option string to be converted to an array. Instead, you should tell the theory that
$ options is an array, which will then be automatically sorted and unzolished, when the data is written and written from the database:
/ ** * Var array * * @ORM \ column (name = "option", type = "array") * / personal $ option; / ** * Set options * * @ Ultimate array $ option * * @ Return campaign * / Public function set option ($ option) {$ this- & gt; Option = $ option; $ This return; } / ** * get option * * return array * / public function getOptions () {return $ this-> option; }
Comments
Post a Comment