public static function addSchools() { $class = get_called_class(); decho("Adding schools for {$class}"); foreach (static::getSchools() as $data) { print_r($data); $school = SchoolQuery::create()->filterByBookstoreType($class)->filterBySubdomain($data['Subdomain'])->findOne(); if (!$school) { $school = new School(); $school->setBookstoreType($class)->setSubdomain($data['Subdomain']); } $school->setSlug($data['Slug'])->setName($school->getName() ?: $data['Name'])->setShortName($school->getShortName(true) ?: (isset($data['ShortName']) ? $data['ShortName'] : School::guessShortName($data['Name'], $data['Slug'])))->setTouched(1)->save(); } }