setMaxMailboxCount(sfConfig::get('app_domain_max_mailbox_count')); $this->setQuota(sfConfig::get('app_domain_quota')); $this->setDefaultMailboxQuota(sfConfig::get('app_domain_default_mailbox_quota')); } public function getMailboxCount() { return $this->countMailboxs(); } public function getUsedQuota() { $used = 0; $c = new Criteria(); $c->add(MailboxPeer::DOMAIN_ID, $this->getId()); $c->addSelectColumn('SUM('.MailboxPeer::MAX_QUOTA.')'); $rs = MailboxPeer::doSelectRS($c); if($rs->next()) return $rs->getInt(1); /* foreach($this->getMailboxs() as $mbox) { $used += $mbox->getQuota(); } */ return $used; } public function __toString() { return $this->getName(); } }