Browse Source

Rename AssociationCollection::type() to AssociationCollection::getByType()

Closes #11220
ADmad 8 years ago
parent
commit
2db733604b
1 changed files with 14 additions and 0 deletions
  1. 14 0
      src/ORM/AssociationCollection.php

+ 14 - 0
src/ORM/AssociationCollection.php

@@ -114,9 +114,23 @@ class AssociationCollection implements IteratorAggregate
      * @param string|array $class The type of associations you want.
      *   For example 'BelongsTo' or array like ['BelongsTo', 'HasOne']
      * @return array An array of Association objects.
+     * @deprecated 3.6.0 Use getByType() instead.
      */
     public function type($class)
     {
+        return $this->getByType($class);
+    }
+
+    /**
+     * Get an array of associations matching a specific type.
+     *
+     * @param string|array $class The type of associations you want.
+     *   For example 'BelongsTo' or array like ['BelongsTo', 'HasOne']
+     * @return array An array of Association objects.
+     * @since 3.5.3
+     */
+    public function getByType($class)
+    {
         $class = array_map('strtolower', (array)$class);
 
         $out = array_filter($this->_items, function ($assoc) use ($class) {