[CORE][Entity] Rename createOrUpdate to 'checkExistingAndCreateOrUpdate', remove update feature from 'create' and add 'createOrUpdate' and fix users

This commit is contained in:
2022-03-28 03:15:39 +01:00
committed by Diogo Peralta Cordeiro
parent b10c359dec
commit dac94f53cd
5 changed files with 43 additions and 29 deletions

View File

@@ -84,16 +84,14 @@ class NoteToLink extends Entity
* Create an instance of NoteToLink or fill in the
* properties of $obj with the associative array $args. Doesn't
* persist the result
*
* @param null|mixed $obj
*/
public static function create(array $args, $obj = null)
public static function create(array $args, bool $_delegated_call = false): static
{
$link = DB::find('link', ['id' => $args['link_id']]);
$note = DB::find('note', ['id' => $args['note_id']]);
Event::handle('NewLinkFromNote', [$link, $note]);
$obj = new self();
return parent::create($args, $obj);
return parent::createOrUpdate($args, $obj);
}
public static function removeWhereNoteId(int $note_id): mixed