Skip to content

Instantly share code, notes, and snippets.

@davidcp90
Created March 10, 2016 15:37
Show Gist options
  • Save davidcp90/38628009ba64af1f5846 to your computer and use it in GitHub Desktop.
Save davidcp90/38628009ba64af1f5846 to your computer and use it in GitHub Desktop.
RandomSamplesShell
<?php
/**
* Definition of RandomSamplesShell
*
* PHP version 5.3.x
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @category PHP
* @package BURRTON
* @subpackage Console.Command
* @copyright Copyright 2013 BunnyForce, Inc.
* @version Release: @package_version@
*/
class RandomSamplesShell extends AppShell {
public $uses = array('Sample');
public function main() {
$this->Sample->bindCategoryBehavior(array("category" => "voice_over"));
echo 'ACA VA BIEN';
//$data = $this->Sample->read(null, 1);
$data = $this->Sample->find('first', array("conditions" => array("Sample.id" => 64183)));
// $data = $this->Sample->find('first');
unset($data['Sample']['id']);
// VB
$languages = array('eng-us', 'eng-uk', 'eng-uk', 'deu-de', 'deu-de', 'fra-fr', 'fra-ca', 'ita-it');
$genders = array('seniorMale', 'seniorFemale', 'youngAdultMale', 'youngAdultFemale', 'middleAgeMale');
$purposes = array(6, 7, 20, 10);
//Put the list of IDs of your talents here
$talents = array(54212,54216,54217,54218,54219,54220,54221,54222,54223,54224,54225,54226);
$popularity = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10);
for($i = 0; $i < 200; $i++) {
$talent = $talents[array_rand($talents)];
$data['Sample']['talent_id'] = $talent;
$data['Sample']['popularity_index'] = $popularity[array_rand($popularity)];
$data['Sample']['data']['popularityIndex'] = $data['Sample']['popularity_index'];
// VB
$language = $languages[array_rand($languages)];
$gender = $genders[array_rand($genders)];
$purpose = $purposes[array_rand($purposes)];
$data['Sample']['data']['language'] = $language;
$data['Sample']['language_id'] = $language;
$data['Sample']['data']['genderAndAge'] = $gender;
$data['Sample']['gender_and_age_id'] = $gender;
$data['Sample']['data']['purpose'] = $purpose;
$data['Sample']['purpose'] = $purpose;
$this->Sample->create();
$this->Sample->save($data);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment