File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,20 @@ public function findAll()
8282 return $ this ->map (parent ::findAll ());
8383 }
8484
85+ /**
86+ * Counts all records.
87+ *
88+ * @return int
89+ */
90+ public function count (string $ column = '* ' )
91+ {
92+ if ($ this ->definition ->getDeletionTimestamp ()) {
93+ $ this ->isNull ($ this ->prefixTableNameTo ($ this ->definition ->getDeletionTimestamp ()));
94+ }
95+
96+ return parent ::count ($ column );
97+ }
98+
8599 /**
86100 * Maps the provided array into the database.
87101 *
Original file line number Diff line number Diff line change @@ -72,6 +72,15 @@ public function testFindOne()
7272 $ this ->assertEquals (400 , $ customer ['orders ' ][0 ]['items ' ][1 ]['amount ' ]);
7373 }
7474
75+ public function testCount ()
76+ {
77+ $ this ->assertSame (2 , $ this ->getMapping ()->count ());
78+
79+ $ this ->getMapping ()->eq ('id ' , 1 )->remove ();
80+
81+ $ this ->assertSame (1 , $ this ->getMapping ()->count ());
82+ }
83+
7584 public function testInsert ()
7685 {
7786 $ customer = [
You can’t perform that action at this time.
0 commit comments