Created
February 2, 2016 15:01
-
-
Save half2me/0b74839eaa95cd53373e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // In my model | |
| $package = $this->get($options['package_id']); | |
| $products = $this->Products->find() | |
| ->where(['Products.package_id' => $options['package_id']]) | |
| ->toArray(); | |
| $this->Products->unlink($package, $products); | |
| // This is giving me an error: | |
| // InvalidArgumentException | |
| // Only an array or \Traversable is allowed for Collection | |
| // But $products is an array of entities | |
| // And $package is an entity | |
| // So why doesn't it work? |
half2me
commented
Feb 2, 2016
Author

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment