{"action":"created","issue":{"url":"https://api.github.com/repos/contao/core/issues/7614","labels_url":"https://api.github.com/repos/contao/core/issues/7614/labels{/name}","comments_url":"https://api.github.com/repos/contao/core/issues/7614/comments","events_url":"https://api.github.com/repos/contao/core/issues/7614/events","html_url":"https://github.com/contao/core/issues/7614","id":56272819,"number":7614,"title":"Calendar/events optimization","user":{"login":"qzminski","id":193483,"avatar_url":"https://avatars.githubusercontent.com/u/193483?v=3","gravatar_id":"","url":"https://api.github.com/users/qzminski","html_url":"https://github.com/qzminski","followers_url":"https://api.github.com/users/qzminski/followers","following_url":"https://api.github.com/users/qzminski/following{/other_user}","gists_url":"https://api.github.com/users/qzminski/gists{/gist_id}","starred_url":"https://api.github.com/users/qzminski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qzminski/subscriptions","organizations_url":"https://api.github.com/users/qzminski/orgs","repos_url":"https://api.github.com/users/qzminski/repos","events_url":"https://api.github.com/users/qzminski/events{/privacy}","received_events_url":"https://api.github.com/users/qzminski/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contao/core/labels/feature","name":"feature","color":"4183c4"},{"url":"https://api.github.com/repos/contao/core/labels/up%20for%20discussion","name":"up for discussion","color":"2a982a"}],"state":"open","locked":false,"assignee":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/contao/core/milestones/96","html_url":"https://github.com/contao/core/milestones/3.5.0","labels_url":"https://api.github.com/repos/contao/core/milestones/96/labels","id":837472,"number":96,"title":"3.5.0","description":"Contao 3.5.0 (feature release)","creator":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"open_issues":50,"closed_issues":32,"state":"open","created_at":"2014-10-23T14:05:16Z","updated_at":"2015-03-25T12:45:42Z","due_on":"2015-05-25T07:00:00Z","closed_at":null},"comments":16,"created_at":"2015-02-02T18:18:05Z","updated_at":"2015-03-25T14:17:16Z","closed_at":null,"body":"I would like to propose a solution that will optimize the calendar/events module. This is also related to other modules like news and faq.\r\n\r\nThe problem: if you have dozens of events with multiple content elements each, the event list/menu module will generate the content event if it's not displayed. This will consume the resources and a lot of time, especially when you have both of the modules on the same page - the job will be done twice. I have measured the generation time with 50+ events and it took **10-20 seconds per each module** (event list, event menu) to generate itself. In total it lasted about half a minute before the page was generated.\r\n\r\nThe solution: I think that the content elements can be generated on demand, i.e. in the template file. It should be as simple as adding the closure to the template. This way you can call it on demand, only when it needs to be used - like in the events reader module.\r\n\r\n```php\r\n// module\r\n$objTemplate->getContent = function() {\r\n    // return the content\r\n};\r\n\r\n// template\r\necho $this->getContent();\r\n```"},"comment":{"url":"https://api.github.com/repos/contao/core/issues/comments/86046340","html_url":"https://github.com/contao/core/issues/7614#issuecomment-86046340","issue_url":"https://api.github.com/repos/contao/core/issues/7614","id":86046340,"user":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T14:17:16Z","updated_at":"2015-03-25T14:17:16Z","body":"Let's discuss this tomorrow. I don't think your suggestions are correct. I have checked the Symfony code and found no occurrences of `is_scalar()` or `instanceof Closure`. What I did find is `!is_string() && is_callable()` and `is_object() && is_callable()`.\r\n\r\n> For `Template::__get()` the `instanceof \\Closure` makes sense to me because we don’t want to execute strings or arrays in this context.\r\n\r\nWe do not want to execute strings aka PHP functions. Arrays, however, seem fine with me. They'll never map to a PHP function, so they are valid callbacks."}}