| @@ 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. |
|
| @@ 926-945 (lines=20) @@ | ||
| 923 | * |
|
| 924 | * @return array(int=>array(string=>mixed)) Data rows. |
|
| 925 | */ |
|
| 926 | public function loadTypeDataByIdentifier($identifier, $status) |
|
| 927 | { |
|
| 928 | $q = $this->getLoadTypeQuery(); |
|
| 929 | $q->where( |
|
| 930 | $q->expr->lAnd( |
|
| 931 | $q->expr->eq( |
|
| 932 | $this->dbHandler->quoteColumn('identifier', 'ezcontentclass'), |
|
| 933 | $q->bindValue($identifier) |
|
| 934 | ), |
|
| 935 | $q->expr->eq( |
|
| 936 | $this->dbHandler->quoteColumn('version', 'ezcontentclass'), |
|
| 937 | $q->bindValue($status) |
|
| 938 | ) |
|
| 939 | ) |
|
| 940 | ); |
|
| 941 | $stmt = $q->prepare(); |
|
| 942 | $stmt->execute(); |
|
| 943 | ||
| 944 | return $stmt->fetchAll(\PDO::FETCH_ASSOC); |
|
| 945 | } |
|
| 946 | ||
| 947 | /** |
|
| 948 | * Loads an array with data about the type referred to by $remoteId in |
|
| @@ 956-975 (lines=20) @@ | ||
| 953 | * |
|
| 954 | * @return array(int=>array(string=>mixed)) Data rows. |
|
| 955 | */ |
|
| 956 | public function loadTypeDataByRemoteId($remoteId, $status) |
|
| 957 | { |
|
| 958 | $q = $this->getLoadTypeQuery(); |
|
| 959 | $q->where( |
|
| 960 | $q->expr->lAnd( |
|
| 961 | $q->expr->eq( |
|
| 962 | $this->dbHandler->quoteColumn('remote_id', 'ezcontentclass'), |
|
| 963 | $q->bindValue($remoteId) |
|
| 964 | ), |
|
| 965 | $q->expr->eq( |
|
| 966 | $this->dbHandler->quoteColumn('version', 'ezcontentclass'), |
|
| 967 | $q->bindValue($status) |
|
| 968 | ) |
|
| 969 | ) |
|
| 970 | ); |
|
| 971 | $stmt = $q->prepare(); |
|
| 972 | $stmt->execute(); |
|
| 973 | ||
| 974 | return $stmt->fetchAll(\PDO::FETCH_ASSOC); |
|
| 975 | } |
|
| 976 | ||
| 977 | /** |
|
| 978 | * Returns a basic query to retrieve Type data. |
|