Recent content by asprin

  1. asprin

    XF 2.1 Can I move/transfer my addon which is currently in build to a new system and resume the process?

    Any help here please? Looking forward to make the shift to the new system.
  2. asprin

    XF 2.1 Can I move/transfer my addon which is currently in build to a new system and resume the process?

    So the addon that I'm building is about 60% complete. The system that I'm currently using is almost about to give up on me. Hence, I went ahead and got a new laptop. Now I'm wondering if I would be able to resume the build on the new system (I seem to recall reading somewhere about it but...
  3. asprin

    XF 2.2 how to check if record exists before saving with basicEntitySave

    It doesn't go in the controller. It's a function of the entity's structure class (found usually at <xen_root>/src/addons/YOURADDON/Entity/YourEntity.php)
  4. asprin

    XF 2.2 how to check if record exists before saving with basicEntitySave

    An example for this as well protected function _preSave() { $exists = $this->finder('YourAddonShortName') ->where('col_name', $this->col_name)->fetchOne(); if ($exists && $exists != $this) { $this->error(\XF::phrase('duplicate_record_found')); } } Replace...
  5. asprin

    XF 2.2 how to check if record exists before saving with basicEntitySave

    Two ways you can achieve this: (a) By setting unique property in the entity structure definition 'my_field' => ['type' => self::STR, 'unique' => 'my_error_phrase_name'] // my_error_phrase_name is the phrase name. You can also use a hardcoded string (b) By using the __preSave() function in the...
  6. asprin

    Tabbed Options

    Thanks @DragonByte Tech for sharing this tutorial. It's simply awesome having to categorize the options based on the order value. So much elegant.
  7. asprin

    Create XenForo PHP documentation

    This is pure gold.
  8. asprin

    XF 2.2 Fetch all items from relation

    I don't know, the following should work if one is using TO_MANY relationship. <xf:foreach loop="$codeList" value="$test" key="$key"> <tr> <td>{$test.username}</td> <td>{$test.title}</td> <td> <xf:foreach loop="$test.Codes" value="$singleCode" i="$i">...
  9. asprin

    XF 2.2 Fetch all items from relation

    I could be misinterpreting your issue but can't you simply use a TO_MANY relationship? 'type' => self::TO_MANY
  10. asprin

    XF 2.1 <xf:toggle /> display as on/off switch without submit=true

    Thanks, I'll try that out and let you know.
  11. asprin

    XF 2.1 <xf:toggle /> display as on/off switch without submit=true

    Guess that's one way to do it. However, this would mean a trip to the server for no reason. Imagine user clicking on multiple items on a list and that could become unnecessary overhead.
  12. asprin

    XF 2.1 Is it possible to know the caller inside entity's _preSave() function?

    No, no. I meant dentifying if there was post inside the entity's preSave function and not the public controller action. That's the first I'm hearing of. Let me see if I can find some info it. I don't have much experience on services. Is there an example out there?
Top