| 127 | | } |
|---|
| 128 | | } |
|---|
| 129 | | |
|---|
| 130 | | /** |
|---|
| 131 | | * Constructor parameters parser |
|---|
| 132 | | * |
|---|
| 133 | | * Takes a list of strings (shortcut for array('object', 'PropelObjectClassName')), array(type, name) and array(arrays). |
|---|
| 134 | | */ |
|---|
| 135 | | protected function parseConstructorParameters($args, &$customFields, $finalize=false) |
|---|
| 136 | | { |
|---|
| 137 | | foreach ($args as $arg) |
|---|
| 138 | | { |
|---|
| 139 | | if (is_array($arg)) |
|---|
| 140 | | { |
|---|
| 141 | | // ignore empty arrays |
|---|
| 142 | | |
|---|
| 143 | | if (isset($arg[0])) |
|---|
| 144 | | { |
|---|
| 145 | | if (is_array($arg[0])) |
|---|
| 146 | | { |
|---|
| 147 | | // Array of array, recursion |
|---|
| 148 | | |
|---|
| 149 | | $this->parseConstructorParameters($arg, $customFields); |
|---|
| 150 | | } |
|---|
| 151 | | elseif ('object'==$arg[0]) |
|---|
| 152 | | { |
|---|
| 153 | | // Propel object, long version |
|---|
| 154 | | |
|---|
| 155 | | if (!isset($arg[1])) |
|---|
| 156 | | { |
|---|
| 157 | | throw new Exception('Invalid constructor item found: An object must take the object class name as parameter'); |
|---|
| 158 | | } |
|---|
| 159 | | else |
|---|
| 160 | | { |
|---|
| 161 | | $this->addCustomObjectIfApplicable($customFields); |
|---|
| 162 | | $this->addObjectByClassName($arg[1]); |
|---|
| 163 | | } |
|---|
| 164 | | } |
|---|
| 165 | | else |
|---|
| 166 | | { |
|---|
| 167 | | // Pure custom field |
|---|
| 168 | | |
|---|
| 169 | | array_push($customFields, $arg); |
|---|
| 170 | | } |
|---|
| 171 | | } |
|---|
| 172 | | } |
|---|
| 173 | | else |
|---|
| 174 | | { |
|---|
| 175 | | // Propel object, short version. Will only be applicable on first level, deeper levels must use the |
|---|
| 176 | | // long version (ie array('object', 'PropelObjectClassName')) |
|---|
| 177 | | |
|---|
| 178 | | $this->addCustomObjectIfApplicable($customFields); |
|---|
| 179 | | $this->addObjectByClassName($arg); |
|---|
| 180 | | } |
|---|
| 181 | | } |
|---|
| 182 | | |
|---|
| 183 | | // If we're in top recursion level, add remaining custom objects if any |
|---|
| 184 | | if ($finalize) |
|---|
| 185 | | { |
|---|
| 186 | | $this->addCustomObjectIfApplicable($customFields); |
|---|
| 374 | | public function doCount(Criteria $criteria, $distinct = false, $con=null) |
|---|
| 375 | | { |
|---|
| 376 | | $criteria = clone $criteria; |
|---|
| 377 | | $asColumns = $criteria->getAsColumns(); |
|---|
| 378 | | $criteria->clearSelectColumns()->clearOrderByColumns(); |
|---|
| 379 | | |
|---|
| 380 | | // hack against criteria private policy |
|---|
| 381 | | foreach ($asColumns as $key => $value) |
|---|
| 382 | | { |
|---|
| 383 | | $criteria->addAsColumn($key, $value); |
|---|
| 384 | | } |
|---|
| | 318 | public function doCount(Criteria $criteria, $distinct = false, $con=null, $usePeerClassSelectResultSetMethod=true) |
|---|
| | 319 | { |
|---|
| | 320 | $criteria = sfPropelCriteriaImpersonator::clearSelectColumns($criteria); |
|---|
| 402 | | $rs = call_user_func(array($peerClass, 'doSelectRS'), $criteria, $con); |
|---|
| | 338 | if ($usePeerClassSelectResultSetMethod) |
|---|
| | 339 | { |
|---|
| | 340 | // kept for compatibility, but maybe useless. Problem with this is that doSelectRS can modify |
|---|
| | 341 | // criteria, especially because of propel behaviours. That should be ok, but doSelect do not use |
|---|
| | 342 | // it, so you can't use same criteria for both. |
|---|
| | 343 | // |
|---|
| | 344 | // for now, $usePeerClassSelectResultSetMethod is true by default |
|---|
| | 345 | $rs = call_user_func(array($peerClass, 'doSelectRS'), $criteria, $con); |
|---|
| | 346 | } |
|---|
| | 347 | else |
|---|
| | 348 | { |
|---|
| | 349 | $rs = BasePeer::doSelect($criteria, $con); |
|---|
| | 350 | } |
|---|
| | 916 | |
|---|
| | 917 | /** |
|---|
| | 918 | * Constructor parameters parser |
|---|
| | 919 | * |
|---|
| | 920 | * Takes a list of strings (shortcut for array('object', 'PropelObjectClassName')), array(type, name) and array(arrays). |
|---|
| | 921 | */ |
|---|
| | 922 | protected function parseConstructorParameters($args, &$customFields, $finalize=false) |
|---|
| | 923 | { |
|---|
| | 924 | foreach ($args as $arg) |
|---|
| | 925 | { |
|---|
| | 926 | if (is_array($arg)) |
|---|
| | 927 | { |
|---|
| | 928 | // ignore empty arrays |
|---|
| | 929 | |
|---|
| | 930 | if (isset($arg[0])) |
|---|
| | 931 | { |
|---|
| | 932 | if (is_array($arg[0])) |
|---|
| | 933 | { |
|---|
| | 934 | // Array of array, recursion |
|---|
| | 935 | |
|---|
| | 936 | $this->parseConstructorParameters($arg, $customFields); |
|---|
| | 937 | } |
|---|
| | 938 | elseif ('object'==$arg[0]) |
|---|
| | 939 | { |
|---|
| | 940 | // Propel object, long version |
|---|
| | 941 | |
|---|
| | 942 | if (!isset($arg[1])) |
|---|
| | 943 | { |
|---|
| | 944 | throw new Exception('Invalid constructor item found: An object must take the object class name as parameter'); |
|---|
| | 945 | } |
|---|
| | 946 | else |
|---|
| | 947 | { |
|---|
| | 948 | $this->addCustomObjectIfApplicable($customFields); |
|---|
| | 949 | $this->addObjectByClassName($arg[1]); |
|---|
| | 950 | } |
|---|
| | 951 | } |
|---|
| | 952 | else |
|---|
| | 953 | { |
|---|
| | 954 | // Pure custom field |
|---|
| | 955 | |
|---|
| | 956 | array_push($customFields, $arg); |
|---|
| | 957 | } |
|---|
| | 958 | } |
|---|
| | 959 | } |
|---|
| | 960 | else |
|---|
| | 961 | { |
|---|
| | 962 | // Propel object, short version. Will only be applicable on first level, deeper levels must use the |
|---|
| | 963 | // long version (ie array('object', 'PropelObjectClassName')) |
|---|
| | 964 | |
|---|
| | 965 | $this->addCustomObjectIfApplicable($customFields); |
|---|
| | 966 | $this->addObjectByClassName($arg); |
|---|
| | 967 | } |
|---|
| | 968 | } |
|---|
| | 969 | |
|---|
| | 970 | // If we're in top recursion level, add remaining custom objects if any |
|---|
| | 971 | if ($finalize) |
|---|
| | 972 | { |
|---|
| | 973 | $this->addCustomObjectIfApplicable($customFields); |
|---|
| | 974 | } |
|---|
| | 975 | } |
|---|