1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

The existing data required by the data writer could not be found.

Discussion in 'XenForo Development Discussions' started by Jeremy P, Jun 9, 2011.

  1. Jeremy P

    Jeremy P Well-Known Member

    Is there any reason at all that I can fetch a database row from a model, try to modify it via a datawriter by passing the row to setExistingData(), and have it return that the existing data could not be found?

    I am able to do this with the same datawriter without error in other actions, and a dump shows the row is being fetched correctly. I'm genuinely lost as to why this is happening.

    This is occurring in attachmentPostDelete() for a custom attachment handler, it attempts to fetch a row in a custom table by it's attachment_id, and then set that row in a datawriter to delete it.

    public function attachmentPostDelete(array $attachmentZend_Db_Adapter_Abstract $db)
    $photo $this->_getAlbumModel()->getPhotoByAttachmentId($attachment['attachment_id']);

    $dw XenForo_DataWriter::create('Album_DataWriter_AlbumPhoto');
    public function getPhotoByAttachmentId($attachmentId)
    SELECT *
    FROM album_photo
    WHERE album_photo.attachment_id = ?

Share This Page