Announcement

Collapse
No announcement yet.

Add file (Note) to Contact Stream

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add file (Note) to Contact Stream

    Hi,
    in a sheduled Job, I want unzip a document and these contains many csv file.
    All here is OK.

    But, how I can create Note (?) and relate this to contact ? So ?

    $entityManager = $this->getEntityManager();

    $note = $entityManager->getEntity('Note')

    How put file ?

    $entityManager->saveEntity($note);

    $entityManager->getRepository('Contact')->relate($contact, 'notes', $notes);

    Can be do able ? Where can find help ? Thanks Regards

  • #2
    Strange,

    When I creat a note and a attachment, why parent_id and parent_type is not filled ? all other field are filled.

    Regards.

    PHP Code:
                        $attachment->set(array(

                                               
    'name' =&gt$fileName,

                                               
    'deleted' =&gt0,

                                               
    'type' =&gtfiletype($pathToFile),

                                               
    'size' =&gtfilesize($pathToFile),

                                               
    'source_id' =&gtnull,

                                               
    'field' =&gt'attachments',

                                               
    'role' =&gt'Attachment',

                                               
    'storage' =&gtnull,

                                               
    'storage_file_path' =&gtnull,

                                               
    'global' =&gt0,

                                               
    'parent_id' =&gt$noteId,

                                               
    'parent_type' =&gt'Note',

                                               
    'related_id' =&gtnull,

                                               
    'related_type' =&gtnull,

                                               
    'created_by_id' =&gt'system',

                                               ));

                        
    $attachmentId $entityManager->saveEntity($attachment); 

    Comment

    Working...
    X