Jump to content

chrizz

Members
  • Content Count

    115
  • Joined

  • Last visited

Community Reputation

58 Excellent

About chrizz

  • Rank
    Sr. Member

Profile Information

  • Gender
    Male
  • Location
    Berlin, Germany

Recent Profile Visitors

3,950 profile views
  1. hey guys - thanks again for your valuable input! I think I got just confused by the fact that the same code behaves differently in the last to master versions. Nevertheless, I am going to refactor a bit and take care of my own that an exception is thrown as soon as the page name already exists. thanks again!
  2. that's exactly what I don't want 😞 I guess there's no other way than hooking into these methods (same would apply for page updates (if the name changes as well). Maybe someone knows why/when this chnage has been implemented and/or why I experience differences between the two PW versions.
  3. okay - maybe then it's some weird other co-incidence: Originally I was creating pages via API. Based upon your question I tested the behavior in Admin and guess what: The UI warns me that a page with this name already exists but then adds it's own number at the end. It seems as if PW adds a numbering and checks which first (lowest) number is not already taken yet: A quick research showed that this is wanted behavior. PW takes care of the name automatically. *BUT* How can I avoid this? What I need is a way that duplicates are not created. I want PW do a lot of things, but not in this case πŸ˜‰ The following code behaves differently based on the PW version. $title = "mytitle"; $channel = new Page(); $channel->template = "basic-page"; $channel->parent = $pages->get("/styleguide/"); $channel->title = $title; $channel->name = $this->sanitizer->pageName($title); $channel->save(); with PW 3.0.123 it runs once - a second run results in an SQL exception: Error: Exception: SQLSTATE[23000]: Integrity constraint violation: with PW3.0.148 the code runs as often as you want and generates page names on it's own. So... bug or feature? ^^
  4. I recently upgraded one of my projects to 3.0.148 and I got screwed by the new "unique" flag for pages introdueced here. Until now I was relying on PW's internal logic to throw an exception if a page with the same name already exists using the same parent page. Now I am trying to find a clever and easy to use method which can bring back that functionality. Is there maybe a config option I am not aware of? Because I need this duplicate check in many places of the project I want to find a solution which reduces code duplication. So, is there by chance a config for this? If not: ideas are welcome how this could be solved :) Cheers! chrizz
  5. as discussed yesterday this wasn't the last Wireabend-Bier (perfect wording @marcus!) in Berlin. I am looking forward to meet more of you in the future with another beer πŸ™‚
  6. what about the others Berliners here: @blickwerker, @Bron, @ceberlin, @Dave Damage, @dlen, @fermion, @Jan Fromm, @masslevel, @Mitko, @neophron, @Neue Rituale, @Nico Knoll, @operat, @ottogal, @owzim, @Philipp Nowinski, @RSA, @sisterlarao, @skovar, @skries πŸ™‚
  7. @marcus, is Monday still the plan for the meetup? Looks as if we are the only ones for now though, or do you know from others planning to join us?
  8. @marcus, yep. that works and I'd available for beers πŸ™‚
  9. haha. obviously.... the wrong question... yes πŸ€¦β€β™‚οΈ Thanks a lot for pointing me into the right direction
  10. @bernhard, thats what I did as well - but then I ran into trouble because I needed to access the same class from a different module (autoloaded as well). And then it became tricky because I don't know any way to control the order of autoloading πŸ˜‰
  11. I have a module (autoload: true) which uses a custom class. If it would be only relevant for templates, _init.php would be the way to go but due to autoload functionality I need the class also to be availabel in the backend - this is where _init.php stops working. If the class is declared in config.php it works fine - but is this the recommended way or is there a better solution for this?
  12. I am running into the same issue. Unfortunately I wasn't able to reproduce it isolated, but it happens constantly in my current setup during debugging. Has this issue been solved for you @FrancisChung or is it still happening for you as well?
  13. thanks for bringing this up. To me this means: a cronjob will always use the first defined host, as there's no $_SERVER variable available, aye? Unless for sure the cronjob is called via http (e.g. "curl https:host.../") Thanks for your feedback - helps a lot πŸ™‚
  14. I was wondering which logic is behind the httpUrl method when multiple hosts are availble? My config says $config->httpHosts = array('api.local', 'www.api.local', '10.0.1.10'); $page->httpUrl returns always api.local. In the current setup 10.0.1.10 would be appreciated. Is there any logic behind this or is just the first host taken for the httpUrl() call? Checking the code brings up this comment But: How is this runtime valued defined when I use this method in a hook?
  15. whoop. Perfect! Thanks for that link πŸ™‚
Γ—
Γ—
  • Create New...