Developer Tools

Developer Tools 1.4.3

No permission to download
batpool52! updated Developer Tools with a new update entry:

Last update for XF 2.0.x

New
  • New ticktackk-devtools:git-init, ticktackk-devtools:git-move, tdt:create-entity and tdt:schema-entity (modified to round-trip better) CLI command
  • Added method to get random entity based on an identifier
  • Added post seed
  • New "Custom Git repository location" option
  • Show template modifications which are applying (or failing) for a template
Changes
  • Clear cache before adding files to the...

Read the rest of this update entry...
 
Nope, but you can find the one which is compatible with XF 2.1 and requires manually installing via CLI command in GitHub.
 
batpool52! updated Developer Tools with a new update entry:

1.0.0

Changes
  • New: Enable hidden file-based email transport option
  • New: Option to disable template watching (performance improvement)
  • New: Option to disable file hash checking
  • New: Add link to build add-on archive from add-on control menu
  • New: New CLI command to add phrase
  • Changed: Allow per-style analysis of how template modifications apply
Contributions
Some of the changes and...

Read the rest of this update entry...
 
Not sure if this is intended behaviour or a bug (seems like a bug to me):
If I manually change the automatically filled callback for a code event listener it does not automatically generate/update the correct listener file.
 
Happens in both cases. As far as I can see, the service does not even get the callback info and thus uses the fallback.

PHP:
protected function _preSave()
{
    parent::_preSave();

    if (\array_key_exists('callback_method', $this->getErrors()))
    {
        unset($this->_errors['callback_method']);

        $eventId = $this->event_id;
        $callbackClass = $this->callback_class;
        $callbackMethod = $this->callback_method;
        $addOnId = $this->addon_id;

        if ($eventId && $callbackClass && $callbackMethod && $addOnId)
        {
            /** @var CodeEventEntity $codeEvent */
            $codeEvent = $this->em()->find('XF:CodeEvent', $eventId);
            if (!$codeEvent) {
                parent::_preSave();
                return;
            }

            /** @var ListenerCreatorSvc $listenerCreatorSvc */
            $listenerCreatorSvc = $this->app()->service(
                'TickTackk\DeveloperTools:Listener\Creator',
                $codeEvent, $this->addon_id
            );
            $listenerCreatorSvc->create();
        }
    }
}

Changing this to
PHP:
protected function _preSave()
{
    parent::_preSave();

    if (\array_key_exists('callback_method', $this->getErrors()))
    {
        $eventId = $this->event_id;
        $callbackClass = $this->callback_class;
        $callbackMethod = $this->callback_method;
        $addOnId = $this->addon_id;

        if ($eventId && $callbackClass && $callbackMethod && $addOnId)
        {
            /** @var CodeEventEntity $codeEvent */
            $codeEvent = $this->em()->find('XF:CodeEvent', $eventId);
            if (!$codeEvent) {
                return;
            }

            unset($this->_errors['callback_method']);

            /** @var ListenerCreatorSvc $listenerCreatorSvc */
            $listenerCreatorSvc = $this->app()->service(
                'TickTackk\DeveloperTools:Listener\Creator',
                $codeEvent, $this->addon_id
            );
            $listenerCreatorSvc->setListenerClass($callbackClass);
            $listenerCreatorSvc->setListenerMethod($callbackMethod);
            $listenerCreatorSvc->create();
        }
    }
}
seems to fix the issue for me.
 
After upgrading to the latest version, the issue I reported seems to be fixed.
But the behaviour still is a bit different to standard:
If I do not enter a class but only a method I do get two errors without this Add-on, with this Add-on I only get one.

I think this is caused by unconditionally unsetting error callback_method even if nothing is being done afterwards.

Is this being done intentionally and if so: Why?
 
When you select code event and just the add-on, it will fill in the inputs for you so that you don't have to go and do these steps
  1. Copy the class name
  2. Paste it in callback class
  3. Get the code event and turn it into camelcase
  4. Paste it in callback method
Now if you decide to empty any of the field it will only throw the "Please enter a valid [input friendly name]." error because even if the class/method did not exist, they will be created automatically upon saving so there is no point in showing "Callback [class]::[method] is invalid".

Hopefully that explains.
 
Hopefully that explains.
I fully understood what the codes does, I just wanted to know if supressing the additional message was intentional as I disagree that on not showing this error.
So the short answer is: Yes, this is intentional ;)
 
Top Bottom