| @@ 597-617 (lines=21) @@ | ||
| 594 | * |
|
| 595 | * @return int |
|
| 596 | */ |
|
| 597 | public function getContentCount($stateId) |
|
| 598 | { |
|
| 599 | $query = $this->dbHandler->createSelectQuery(); |
|
| 600 | $query->select( |
|
| 601 | $query->alias($query->expr->count('*'), 'count') |
|
| 602 | )->from( |
|
| 603 | $this->dbHandler->quoteTable('ezcobj_state_link') |
|
| 604 | )->where( |
|
| 605 | $query->expr->eq( |
|
| 606 | $this->dbHandler->quoteColumn('contentobject_state_id'), |
|
| 607 | $query->bindValue($stateId, null, \PDO::PARAM_INT) |
|
| 608 | ) |
|
| 609 | ); |
|
| 610 | ||
| 611 | $statement = $query->prepare(); |
|
| 612 | $statement->execute(); |
|
| 613 | ||
| 614 | $count = $statement->fetchColumn(); |
|
| 615 | ||
| 616 | return $count !== null ? (int)$count : 0; |
|
| 617 | } |
|
| 618 | ||
| 619 | /** |
|
| 620 | * Updates the object state priority to provided value. |
|
| @@ 1207-1227 (lines=21) @@ | ||
| 1204 | * |
|
| 1205 | * @return array |
|
| 1206 | */ |
|
| 1207 | public function loadTrashByLocation($locationId) |
|
| 1208 | { |
|
| 1209 | $query = $this->handler->createSelectQuery(); |
|
| 1210 | $query |
|
| 1211 | ->select('*') |
|
| 1212 | ->from($this->handler->quoteTable('ezcontentobject_trash')) |
|
| 1213 | ->where( |
|
| 1214 | $query->expr->eq( |
|
| 1215 | $this->handler->quoteColumn('node_id'), |
|
| 1216 | $query->bindValue($locationId) |
|
| 1217 | ) |
|
| 1218 | ); |
|
| 1219 | $statement = $query->prepare(); |
|
| 1220 | $statement->execute(); |
|
| 1221 | ||
| 1222 | if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) { |
|
| 1223 | return $row; |
|
| 1224 | } |
|
| 1225 | ||
| 1226 | throw new NotFound('trash', $locationId); |
|
| 1227 | } |
|
| 1228 | ||
| 1229 | /** |
|
| 1230 | * List trashed items. |
|