Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit b88f8bb

Browse files
author
Jamie Snape
committed
Add documentation to various DAO classes
1 parent 237785c commit b88f8bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+917
-102
lines changed

core/models/AppDao.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
=========================================================================*/
2020

2121
/**
22-
* GlobalDao
23-
* Global dao methods
22+
* Generic DAO class.
23+
*
24+
* @package Core\DAO
2425
*/
2526
class AppDao extends MIDAS_GlobalDao
2627
{

core/models/GlobalDao.php

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
=========================================================================*/
2020

2121
/**
22-
* Global dao methods
22+
* Generic DAO base class.
23+
*
24+
* @package Core\DAO
2325
*/
2426
class MIDAS_GlobalDao
2527
{
28+
/** @var string */
2629
protected $key;
2730

28-
/**
29-
* Construct dao
30-
*/
31+
/** Constructor */
3132
public function __construct()
3233
{
3334
if ($this->getModel()->getKey() !== '') {
@@ -39,9 +40,7 @@ public function __construct()
3940
$this->loadElements();
4041
}
4142

42-
/**
43-
* Loads model and components
44-
*/
43+
/** Load the components. */
4544
public function loadElements()
4645
{
4746
Zend_Registry::set('components', array());
@@ -58,9 +57,11 @@ public function loadElements()
5857
}
5958

6059
/**
61-
* Init the dao based on the primary key
60+
* Initialize the DAO from the primary key.
6261
*
63-
* @param $key Primary Key
62+
* @param string $key primary key with which to initialize the DAO
63+
* @return bool true if the DAO is successfully initialized
64+
* @throws Zend_Exception
6465
*/
6566
public function initValues($key)
6667
{
@@ -82,7 +83,11 @@ public function initValues($key)
8283
return true;
8384
}
8485

85-
/** return values as an array */
86+
/**
87+
* Return the names and values of the fields of the DAO as an associative array.
88+
*
89+
* @return array
90+
*/
8691
public function toArray()
8792
{
8893
$return = array();
@@ -99,9 +104,10 @@ public function toArray()
99104
}
100105

101106
/**
102-
* Return key value
107+
* Return the value of the key field of the DAO.
103108
*
104-
* @return key
109+
* @return mixed
110+
* @throws Zend_Exception
105111
*/
106112
public function getKey()
107113
{
@@ -114,10 +120,11 @@ public function getKey()
114120
}
115121

116122
/**
117-
* Generic get function. You can define custom function.
123+
* Return the value of a field of the DAO.
118124
*
119-
* @param $var name of the element we want to get
120-
* @return value
125+
* @param string $var name of the field of which to return the value
126+
* @return mixed
127+
* @throws Zend_Exception
121128
*/
122129
public function get($var)
123130
{
@@ -144,10 +151,12 @@ public function get($var)
144151
}
145152

146153
/**
147-
* Set a value
154+
* Set the value of a field of the DAO.
148155
*
149-
* @param $var name of the element we want to set
150-
* @param $value
156+
* @param string $var name of the field of which to set the value
157+
* @param mixed $value value of the field
158+
* @return void|mixed
159+
* @throws Zend_Exception
151160
*/
152161
public function set($var, $value)
153162
{
@@ -164,9 +173,10 @@ public function set($var, $value)
164173
}
165174

166175
/**
167-
* Get Model
176+
* Return a model.
168177
*
169-
* @return model
178+
* @param string|null $name name of the model
179+
* @return object
170180
*/
171181
public function getModel($name = null)
172182
{
@@ -185,7 +195,7 @@ public function getModel($name = null)
185195
}
186196

187197
/**
188-
* Get Logger
198+
* Fetch the logger from the Zend registry.
189199
*
190200
* @return Zend_Log
191201
*/
@@ -195,11 +205,12 @@ public function getLogger()
195205
}
196206

197207
/**
198-
* Catch if the method does not exist and create a method dynamically
208+
* Invoke inaccessible methods.
199209
*
200-
* @param $method method name
201-
* @param $params array of param
202-
* @return return the result of the function dynamically created
210+
* @param string $method name of the method
211+
* @param array $params parameters of the method
212+
* @return mixed
213+
* @throws Zend_Exception
203214
*/
204215
public function __call($method, $params)
205216
{
@@ -233,8 +244,10 @@ public function __call($method, $params)
233244
}
234245

235246
/**
236-
* @param $var name
237-
* @return real var
247+
* Return a method name given the name of an item of data in a model.
248+
*
249+
* @param string $var name of an item of data
250+
* @return string
238251
*/
239252
private function _getRealName($var)
240253
{

core/models/dao/ActivedownloadDao.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,20 @@
1919
=========================================================================*/
2020

2121
/**
22+
* Active download lock DAO.
23+
*
24+
* @method int getActivedownloadId()
25+
* @method void setActivedownloadId(int $activeDownloadId)
26+
* @method string getIp()
27+
* @method void setIp(string $ip)
28+
* @method string getDateCreation()
29+
* @method void setDateCreation(string $dateCreation)
30+
* @method string getLastUpdate()
31+
* @method void setLastUpdate(string $lastUpdate)
32+
* @package Core\DAO
2233
*/
2334
class ActivedownloadDao extends AppDao
2435
{
36+
/** @var string */
2537
public $_model = 'Activedownload';
2638
}

core/models/dao/AssetstoreDao.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,22 @@
1919
=========================================================================*/
2020

2121
/**
22-
* DAO Assetstore (table assetstore)
22+
* Asset store DAO.
23+
*
24+
* @method int getAssetstoreId()
25+
* @method void setAssetstoreId(int $assetStoreId)
26+
* @method string getName()
27+
* @method void setName(string $name)
28+
* @method string getPath()
29+
* @method void setPath(string $path)
30+
* @method int getType()
31+
* @method void setType(int $type)
32+
* @method array getBitstreams()
33+
* @method void setBitstreams(array $bitstreams)
34+
* @package Core\DAO
2335
*/
2436
class AssetstoreDao extends AppDao
2537
{
38+
/** @var string */
2639
public $_model = 'Assetstore';
2740
}

core/models/dao/BitstreamDao.php

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,46 @@
1919
=========================================================================*/
2020

2121
/**
22-
* DAO Bitstream (table bitstream)
22+
* Bitstream DAO.
23+
*
24+
* @method int getBitstreamId()
25+
* @method void setBitstreamId(int $bitstreamId)
26+
* @method int getItemrevisionId()
27+
* @method void setItemrevisionId(int $itemRevisionId)
28+
* @method int getAssetstoreId()
29+
* @method void setAssetstoreId(int $assetStoreId)
30+
* @method string getName()
31+
* @method void setName(string $name)
32+
* @method string getMimetype()
33+
* @method void setMimetype(string $mimeType)
34+
* @method int getSizebytes()
35+
* @method void setSizebytes(int $sizeBytes)
36+
* @method string getChecksum()
37+
* @method void setChecksum(string $checksum)
38+
* @method string getPath()
39+
* @method void setPath(string $path)
40+
* @method string getDate()
41+
* @method void setDate(string $date)
42+
* @method ItemrevisionDao getItemrevision()
43+
* @method void setItemrevision(ItemrevisionDao $itemRevision)
44+
* @method AssetstoreDao getAssetstore()
45+
* @method void setAssetstore(AssetstoreDao $assetStore)
46+
* @package Core\DAO
2347
*/
2448
class BitstreamDao extends AppDao
2549
{
50+
/** @var string */
2651
public $_model = 'Bitstream';
52+
53+
/** @var array */
2754
public $_components = array('MimeType', 'Utility');
2855

2956
/**
30-
* Fill the properties of the bitstream given the path.
31-
* The file should be accessible from the web server.
57+
* Fill in the properties of this bitstream given its path. The file must
58+
* accessible by the web server.
59+
*
60+
* @deprecated
61+
* @throws Zend_Exception
3262
*/
3363
public function fillPropertiesFromPath()
3464
{
@@ -37,7 +67,7 @@ public function fillPropertiesFromPath()
3767
throw new Zend_Exception('BitstreamDao path is not set in fillPropertiesFromPath()');
3868
}
3969

40-
// TODO Compute the full path from the assetstore. For now using the path
70+
// TODO: Compute the full path from the asset store. For now using the path.
4171
$this->setMimetype($this->Component->MimeType->getType($this->path));
4272
// clear the stat cache, as the underlying file might have changed
4373
// since the last time filesize was called on the same filepath
@@ -48,7 +78,13 @@ public function fillPropertiesFromPath()
4878
}
4979
}
5080

51-
/** Returns the full path of the bitstream based on the assetstore and the path of the bitstream */
81+
/**
82+
* Return the full path of this bitstream from its asset store and the
83+
* relative path of the bitstream.
84+
*
85+
* @deprecated
86+
* @return string
87+
*/
5288
public function getFullPath()
5389
{
5490
$assetstore = $this->get('assetstore');

core/models/dao/CommunityDao.php

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,50 @@
1919
=========================================================================*/
2020

2121
/**
22-
* DAO Item (table item)
22+
* Community DAO.
23+
*
24+
* @method int getCommunityId()
25+
* @method void setCommunityId(int $communityId)
26+
* @method string getName()
27+
* @method void setName(string $name)
28+
* @method string getDescription()
29+
* @method void setDescription(string $description)
30+
* @method string getCreation()
31+
* @method void setCreation(string $creation)
32+
* @method int getPrivacy()
33+
* @method void setPrivacy(int $privacy)
34+
* @method int getFolderId()
35+
* @method void setFolderId(int $folderId)
36+
* @method int getAdmingroupId()
37+
* @method void setAdmingroupId(int $adminGroupId)
38+
* @method int getModeratorgroupId()
39+
* @method void setModeratorgroupId(int $moderatorGroupId)
40+
* @method int getMembergroupId()
41+
* @method void setMembergroupId(int $memberGroupId)
42+
* @method int getCanJoin()
43+
* @method void setCanJoin(int $canJoin)
44+
* @method int getView()
45+
* @method void setView(int $view)
46+
* @method string getUuid()
47+
* @method void setUuid(string $uuid)
48+
* @method FolderDao getFolder()
49+
* @method void setFolder(FolderDao $folder)
50+
* @method GroupDao getAdminGroup()
51+
* @method void setAdminGroup(GroupDao $adminGroup)
52+
* @method GroupDao getModeratorGroup()
53+
* @method void setModeratorGroup(GroupDao $moderatorGroup)
54+
* @method array getInvitations()
55+
* @method void setInvitations(array $invitations)
56+
* @method array getGroups()
57+
* @method void setGroups(array $groups)
58+
* @method GroupDao getMemberGroup()
59+
* @method void setMemberGroup(GroupDao $memberGroup)
60+
* @method array getFeeds()
61+
* @method void setFeeds(array $feeds)
62+
* @package Core\DAO
2363
*/
2464
class CommunityDao extends AppDao
2565
{
66+
/** @var string */
2667
public $_model = 'Community';
2768
}

core/models/dao/CommunityInvitationDao.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,26 @@
1919
=========================================================================*/
2020

2121
/**
22-
* DAO Assetstore
22+
* Community invitation DAO.
23+
*
24+
* @method int getCommunityinvitationId()
25+
* @method void setCommunityinvitationId(int $communityInvitationId)
26+
* @method int getCommunityId()
27+
* @method void setCommunityId(int $communityId)
28+
* @method int getGroupId()
29+
* @method void setGroupId(int $groupId)
30+
* @method int getUserId()
31+
* @method void setUserId(int $userId)
32+
* @method CommunityDao getCommunity()
33+
* @method void setCommunity(CommunityDao $community)
34+
* @method GroupDao getGroup()
35+
* @method void setGroup(GroupDao $group)
36+
* @method UserDao getUser()
37+
* @method void setUser(UserDao $user)
38+
* @package Core\DAO
2339
*/
2440
class CommunityInvitationDao extends AppDao
2541
{
42+
/** @var string */
2643
public $_model = 'CommunityInvitation';
2744
}

core/models/dao/ErrorlogDao.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,22 @@
1919
=========================================================================*/
2020

2121
/**
22+
* Error log DAO.
23+
*
24+
* @method int getErrorlogId()
25+
* @method void setErrorlogId(int $errorLogId)
26+
* @method string getModule()
27+
* @method void setModule(string $module)
28+
* @method string getMessage()
29+
* @method void setMessage(string $message)
30+
* @method string getDatetime()
31+
* @method void setDatetime(string $dateTime)
32+
* @method int getPriority()
33+
* @method void setPriority(int $priority)
34+
* @package Core\DAO
2235
*/
2336
class ErrorlogDao extends AppDao
2437
{
38+
/** @var string */
2539
public $_model = 'Errorlog';
2640
}

0 commit comments

Comments
 (0)