Thursday, March 26, 2015

Re: Virtual property not working on production server

Hi again,

in addition I just found out, that a pr() on $entry->photo[0] (or $photo in foreach loop) ist different ob both servers.
On the server where everything works as expected i get:
App\Model\Entity\Photo Object
(
    [_accessible:protected] => Array
        (
            [user_id] => 1
            [entry_id] => 1
            [filename] => 1
            [org_name] => 1
            [description] => 1
            [user] => 1
            [entry] => 1
        )

    [_virtual:protected] => Array
        (
            [0] => path
        )
[...]

and on the server where the virtual property is missing i get:
Cake\ORM\Entity Object
(
    [_properties:protected] => Array
        (
            [id] => 37
            [user_id] => 1
            [entry_id] => 4
            [filename] => p19fng7349bb2p6nsac14j51qnu4.jpg
[...]

Any idea?

Thanks a lot
Simon


On Wednesday, March 25, 2015 at 3:04:16 PM UTC+1, s...@construktiv.de wrote:
Hey cakers,

I have a strage issue with virtual properties on our server.
We have a Photo Entity with the following virtual property:

/**
 * Get url for all image sizes
 *
 * @return array
 */
protected function _getPath()
{
[...]

return $path; // array with path for different photo sizes
}

On our development server (Ubuntu, Apache, PHP 5.5.9-1ubuntu4.6) everything works perfectly.
On our production server (Linux, Apache, PHP 5.5.23) the site is working great, except that the virtual properties are missing in the data objects.

The photo entity is read from db via contain and echoed like this:

$entry->photos[0]['path']['wide'];

The normaly properties of the Photo entity can be read on both servers with:

$entry->photos[0]['filename'];

Any idea why the virtual property on the production environment is missing?

Thanks a lot!

Simon

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: