Example #1
0
 public static function retrieveById($pk, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria(VisitorDevPeer::DATABASE_NAME);
     $criteria->add(VisitorDevPeer::ID, $pk);
     $v = VisitorDevPeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }
Example #2
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VisitorDevPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setMemberId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTimeIn($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTimeOut($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setDepartmentId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCode($arr[$keys[5]]);
     }
 }
Example #3
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(VisitorDevPeer::ID, $pks, Criteria::IN);
         $objs = VisitorDevPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #4
0
 public function executeDelete()
 {
     $visitor = VisitorDevPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($visitor);
     $ref_error = 0;
     foreach ($visitor->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $visitor->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('visitor_list_dev/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('visitor_list_dev/delete', '_ERR_DELETE_ (' . $visitor->toString() . ' - id:' . $visitor->getId() . ')');
     } else {
         $visitor->delete();
     }
     return $this->forward('visitor_list_dev', 'list');
 }