Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. /**
  2. * @return yiidbActiveQuery
  3. */
  4. public function getComplexDocument()
  5. {
  6. return $this->hasMany(ComplexDocument::className(), ['complex_id' => 'id']);
  7. }
  8.  
  9. /**
  10. * @return yiidbActiveQuery
  11. */
  12. public function getDocuments()
  13. {
  14. return $this->hasMany(Documents::className(), ['id' => 'document_id'])
  15. ->via('complexDocument');
  16. }
  17.  
  18. public function beforeDelete()
  19. {
  20. foreach ($this->documents as $document){
  21. var_dump($document);
  22. }
  23. return parent::beforeDelete();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement