Remove first from collections

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Remove first from collections

rafaelmsantos.com
Hi, 
i'm using CakePHP's Collections on a non-cakephp project. I was search for a Collection package and I find yours to be the best. 
Is there a way to easily delete the first element of a collection? 
For example, $collection->first()->remove().

Thanks

--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
 
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Remove first from collections

John Andersen
I deletion is not possible, would the skip method work for you?
http://book.cakephp.org/3.0/en/core-libraries/collections.html#Cake\Collection\Collection::skip

Enjoy, John

On Thursday, 25 February 2016 16:56:27 UTC+2, Rafael Santos wrote:
Hi, 
i'm using <a href="http://book.cakephp.org/3.0/en/core-libraries/collections.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fbook.cakephp.org%2F3.0%2Fen%2Fcore-libraries%2Fcollections.html\46sa\75D\46sntz\0751\46usg\75AFQjCNEnSBN66L2rL20xmhCwTIWlksYqaQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fbook.cakephp.org%2F3.0%2Fen%2Fcore-libraries%2Fcollections.html\46sa\75D\46sntz\0751\46usg\75AFQjCNEnSBN66L2rL20xmhCwTIWlksYqaQ&#39;;return true;">CakePHP's Collections on a non-cakephp project. I was search for a Collection package and I find yours to be the best. 
Is there a way to easily delete the first element of a collection? 
For example, $collection->first()->remove().

Thanks

--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
 
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...