• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP PropelObjectCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中PropelObjectCollection的典型用法代码示例。如果您正苦于以下问题:PHP PropelObjectCollection类的具体用法?PHP PropelObjectCollection怎么用?PHP PropelObjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了PropelObjectCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor.
  *
  * @param \PropelObjectCollection $entries
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
  * @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
  * @param array $loadedSecurityIdentities
  * @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
  * @param bool $inherited
  */
 public function __construct(\PropelObjectCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
 {
     if ($entries->getModel() !== $this->model) {
         throw new AclException(sprintf('The given collection does not contain models of class "%s" but of class "%s".', $this->model, $entries->getModel()));
     }
     foreach ($entries as $eachEntry) {
         if (null === $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             $this->classAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null === $eachEntry->getObjectIdentityId()) {
             if (empty($this->classFieldAces[$eachEntry->getFieldName()])) {
                 $this->classFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->classFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
         if (null === $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             $this->objectAces[] = new Entry($eachEntry, $this);
         }
         if (null !== $eachEntry->getFieldName() and null !== $eachEntry->getObjectIdentityId()) {
             if (empty($this->objectFieldAces[$eachEntry->getFieldName()])) {
                 $this->objectFieldAces[$eachEntry->getFieldName()] = array();
                 $this->updateFields($eachEntry->getFieldName());
             }
             $this->objectFieldAces[$eachEntry->getFieldName()][] = new FieldEntry($eachEntry, $this);
         }
     }
     $this->objectIdentity = $objectIdentity;
     $this->permissionGrantingStrategy = $permissionGrantingStrategy;
     $this->parentAcl = $parentAcl;
     $this->inherited = $inherited;
     $this->loadedSecurityIdentities = $loadedSecurityIdentities;
     $this->fields = array_unique($this->fields);
 }
开发者ID:angelk,项目名称:PropelBundle,代码行数:44,代码来源:Acl.php


示例2: __construct

  /**
   * Form constructor.
   *
   * Available options:
   * - embedded_form_class: The class name of the forms to embed. Uses the model name by default.
   *                  (a form based on a collection of Book objects embeds BookForm objects)
   * - item_pattern:  The pattern used to name each embedded form. Defaults to '%index%'.
   * - add_delete:    Whether to add a delete widget for each object. Defaults to true.
   * - delete_name:   Name of the delete widget. Defaults to 'delete'.
   * - delete_widget: Optional delete widget object. If left null, uses a sfWidgetFormDelete instance.
   * - alert_text:    The text of the Javascript alert to show
   * - hide_parent:   Whether to hide the parent form when clicking the checkbox
   * - parent_level:  The number of times parentNode must be called to reach the parent to hide.
   *                  Recommended values: 6 for embedded form, 7 for merged form
   * - remove_fields: The list of fields to remove from the embedded object forms
   *
   * @param PropelCollection $collection A collection of Propel objects
   *                                     used to initialize default values
   * @param array            $options    An array of options
   * @param string           $CSRFSecret A CSRF secret (false to disable CSRF protection, null to use the global CSRF secret)
   *
   * @see sfForm
   */
  public function __construct($collection = null, $options = array(), $CSRFSecret = null)
  {
    $options = array_merge(array(
      'item_pattern'  => '%index%',
      'add_delete'    => false,
      'delete_name'   => 'delete',
      'delete_widget' => null,
      'remove_fields' => array(),
    ), $options);

    if (!$collection)
    {
      $this->model = $options['model'];
      $collection = new PropelObjectCollection();
      $collection->setModel($this->model);
      $this->collection = $collection;
    }
    else
    {
      if (!$collection instanceof PropelObjectCollection)
      {
        throw new sfException(sprintf('The "%s" form only accepts a PropelObjectCollection object.', get_class($this)));
      }
      $this->collection = $collection;
      $this->model = $collection->getModel();
    }

    $this->isEmpty = $this->getCollection()->isEmpty();

    parent::__construct(array(), $options, $CSRFSecret);
  }
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:54,代码来源:sfFormPropelCollection.class.php


示例3: testTransformWithData

 public function testTransformWithData()
 {
     $coll = new \PropelObjectCollection();
     $coll->setData(array('foo', 'bar'));
     $result = $this->transformer->transform($coll);
     $this->assertTrue(is_array($result));
     $this->assertCount(2, $result);
     $this->assertEquals('foo', $result[0]);
     $this->assertEquals('bar', $result[1]);
 }
开发者ID:tahermarkos,项目名称:Transport,代码行数:10,代码来源:CollectionToArrayTransformerTest.php


示例4: testSerializePropelObjectCollection

 public function testSerializePropelObjectCollection()
 {
     $collection = new \PropelObjectCollection();
     $collection->setData(array(new TestSubject('lolo'), new TestSubject('pepe')));
     $json = $this->serializer->serialize($collection, 'json');
     $data = json_decode($json, true);
     $this->assertCount(2, $data);
     //will fail if PropelCollectionHandler not loaded
     foreach ($data as $testSubject) {
         $this->assertArrayHasKey('name', $testSubject);
     }
 }
开发者ID:corcre,项目名称:elabftw,代码行数:12,代码来源:PropelCollectionHandlerTest.php


示例5: createBooks

 protected function createBooks($nb = 15, $con = null)
 {
     BookQuery::create()->deleteAll($con);
     $books = new PropelObjectCollection();
     $books->setModel('Book');
     for ($i = 0; $i < $nb; $i++) {
         $b = new Book();
         $b->setTitle('Book' . $i);
         $books[] = $b;
     }
     $books->save($con);
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:12,代码来源:PropelModelPagerTest.php


示例6: testFromArray

 public function testFromArray()
 {
     $author = new Author();
     $author->setFirstName('Jane');
     $author->setLastName('Austen');
     $author->save();
     $books = array(array('Title' => 'Mansfield Park', 'AuthorId' => $author->getId()), array('Title' => 'Pride And PRejudice', 'AuthorId' => $author->getId()));
     $col = new PropelObjectCollection();
     $col->setModel('Book');
     $col->fromArray($books);
     $col->save();
     $nbBooks = PropelQuery::from('Book')->count();
     $this->assertEquals(6, $nbBooks);
     $booksByJane = PropelQuery::from('Book b')->join('b.Author a')->where('a.LastName = ?', 'Austen')->count();
     $this->assertEquals(2, $booksByJane);
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:16,代码来源:PropelObjectCollectionWithFixturesTest.php


示例7: testConstruct

 public function testConstruct()
 {
     $collection = new \PropelObjectCollection();
     $collection->setModel('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\Entry');
     $acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
     $model = $this->createEntry();
     $model->setAuditFailure(true);
     $model->setSecurityIdentity(SecurityIdentity::fromAclIdentity($this->getRoleSecurityIdentity()));
     $entry = new Entry($model, $acl);
     $this->assertEquals($model->getMask(), $entry->getMask());
     $this->assertEquals($model->getGranting(), $entry->isGranting());
     $this->assertEquals($model->getGrantingStrategy(), $entry->getStrategy());
     $this->assertEquals($model->getAuditFailure(), $entry->isAuditFailure());
     $this->assertEquals($model->getAuditSuccess(), $entry->isAuditSuccess());
     $this->assertEquals($this->getRoleSecurityIdentity(), $entry->getSecurityIdentity());
     return $entry;
 }
开发者ID:propelorm,项目名称:PropelAclBundle,代码行数:17,代码来源:EntryTest.php


示例8: preremplirResponsables

    /**
     *
     * Prérempli la notification avec des responsables (sans sauvegarder la notification).
     * Si plusieurs responsables sont disponibles, un responsable 1 est pris en priorité pour remplir la notification,
     * un responsable 2 est ajouté si l'adresse est la même que le premier
     * Si trop de responsables sont disponibles, aucun choix arbitraire n'est fait et alors rien n'est rempli sur la notification
     * Si aucun responsable n'est disponible, la notification n'est pas remplie
     *
     * @return     boolean true ou false suivant que le remplissage a pu être effectué ou pas.
     *
     */
    public function preremplirResponsables() {
            $traitement = $this->getAbsenceEleveTraitement();
            if ($traitement === NULL) return false;

            $responsable_1_coll = new PropelObjectCollection();
            $responsable_2_coll = new PropelObjectCollection();
            foreach ($traitement->getResponsablesInformationsSaisies() as $responsable_information) {
                    if ($responsable_information == null) continue;
                    if ($responsable_information->getNiveauResponsabilite() == '1') {
                        $responsable_1_coll->add($responsable_information->getResponsableEleve());
                    } else if ($responsable_information->getNiveauResponsabilite() == '2') {
                        $responsable_2_coll->add($responsable_information->getResponsableEleve());
                    }
                    //si on ne peut pas choisir les responsables, on retourne sans remplir
                    if ($responsable_1_coll->count() > 1) return false;
            }

            if ($responsable_1_coll->isEmpty() && $responsable_2_coll->count() != 1) {
                //on ne peut pas choisir
                return false;
            }

            $responsable_eleve1 = $responsable_1_coll->getFirst();
            $responsable_eleve2 = $responsable_2_coll->getFirst();
            if ($responsable_eleve1 != null) {
                    $this->setEmail($responsable_eleve1->getMel());
                    $this->setTelephone($responsable_eleve1->getTelPort());
                    $this->setAdresseId($responsable_eleve1->getAdresseId());
                    $this->addResponsableEleve($responsable_eleve1);
            } else {
                    $this->setEmail($responsable_eleve2->getMel());
                    $this->setTelephone($responsable_eleve2->getTelPort());
                    $this->setAdresseId($responsable_eleve2->getAdresseId());
                    $this->addResponsableEleve($responsable_eleve2);
            }

            //on ajoute dans la liste des destinataires le resp 2 si il a la même adresse que le resp 1
            if ($responsable_eleve2 != null && $responsable_eleve1 != null && $responsable_eleve2->getAdresseId() == $responsable_eleve1->getAdresseId()) {
                    $this->addResponsableEleve($responsable_eleve2);
            }

            return true;
    }
开发者ID:rhertzog,项目名称:lcs,代码行数:54,代码来源:AbsenceEleveNotification.php


示例9: addProductWhenAjaxChangeActive

 public static function addProductWhenAjaxChangeActive($arg)
 {
     /* @var $model SProducts */
     $models = $arg['model'];
     /* @var $ci MY_Controller */
     $ci =& get_instance();
     if (!$models instanceof \PropelObjectCollection) {
         $model = $models;
         $models = new \PropelObjectCollection();
         $models->append($model);
     }
     foreach ($models as $model) {
         if ($model->getActive()) {
             $ci->db->where('trash_url', 'shop/product/' . $model->getUrl())->delete('trash');
         } else {
             $array = array('trash_id' => $model->getCategoryId(), 'trash_url' => 'shop/product/' . $model->getUrl(), 'trash_redirect_type' => 'category', 'trash_type' => '302', 'trash_redirect' => shop_url('category/' . $model->getMainCategory()->getFullPath()));
             $ci->db->insert('trash', $array);
         }
     }
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:20,代码来源:trash.php


示例10: removeFactura

 /**
  * @param	Factura $factura The factura object to remove.
  */
 public function removeFactura($factura)
 {
     if ($this->getFacturas()->contains($factura)) {
         $this->collFacturas->remove($this->collFacturas->search($factura));
         if (null === $this->facturasScheduledForDeletion) {
             $this->facturasScheduledForDeletion = clone $this->collFacturas;
             $this->facturasScheduledForDeletion->clear();
         }
         $this->facturasScheduledForDeletion[] = $factura;
         $factura->setTipoPago(null);
     }
 }
开发者ID:kcornejo,项目名称:usac,代码行数:15,代码来源:BaseTipoPago.php


示例11: removeUser

 /**
  * Remove a User object to this object
  * through the user_skill cross reference table.
  *
  * @param User $user The UserSkill object to relate
  * @return Skill The current object (for fluent API support)
  */
 public function removeUser(User $user)
 {
     if ($this->getUsers()->contains($user)) {
         $this->collUsers->remove($this->collUsers->search($user));
         if (null === $this->usersScheduledForDeletion) {
             $this->usersScheduledForDeletion = clone $this->collUsers;
             $this->usersScheduledForDeletion->clear();
         }
         $this->usersScheduledForDeletion[] = $user;
     }
     return $this;
 }
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:19,代码来源:BaseSkill.php


示例12: removeAgenda

 /**
  * @param	Agenda $agenda The agenda object to remove.
  */
 public function removeAgenda($agenda)
 {
     if ($this->getAgendas()->contains($agenda)) {
         $this->collAgendas->remove($this->collAgendas->search($agenda));
         if (null === $this->agendasScheduledForDeletion) {
             $this->agendasScheduledForDeletion = clone $this->collAgendas;
             $this->agendasScheduledForDeletion->clear();
         }
         $this->agendasScheduledForDeletion[] = $agenda;
         $agenda->setAtencion(null);
     }
 }
开发者ID:eddypre,项目名称:Quirofano,代码行数:15,代码来源:BaseAtencion.php


示例13: removesfGuardUserPermission

 /**
  * @param	sfGuardUserPermission $sfGuardUserPermission The sfGuardUserPermission object to remove.
  */
 public function removesfGuardUserPermission($sfGuardUserPermission)
 {
     if ($this->getsfGuardUserPermissions()->contains($sfGuardUserPermission)) {
         $this->collsfGuardUserPermissions->remove($this->collsfGuardUserPermissions->search($sfGuardUserPermission));
         if (null === $this->sfGuardUserPermissionsScheduledForDeletion) {
             $this->sfGuardUserPermissionsScheduledForDeletion = clone $this->collsfGuardUserPermissions;
             $this->sfGuardUserPermissionsScheduledForDeletion->clear();
         }
         $this->sfGuardUserPermissionsScheduledForDeletion[] = $sfGuardUserPermission;
         $sfGuardUserPermission->setsfGuardPermission(null);
     }
 }
开发者ID:homer6,项目名称:blank_altumo,代码行数:15,代码来源:BasesfGuardPermission.php


示例14: removeTransaccion

 /**
  * @param	Transaccion $transaccion The transaccion object to remove.
  */
 public function removeTransaccion($transaccion)
 {
     if ($this->getTransaccions()->contains($transaccion)) {
         $this->collTransaccions->remove($this->collTransaccions->search($transaccion));
         if (null === $this->transaccionsScheduledForDeletion) {
             $this->transaccionsScheduledForDeletion = clone $this->collTransaccions;
             $this->transaccionsScheduledForDeletion->clear();
         }
         $this->transaccionsScheduledForDeletion[] = $transaccion;
         $transaccion->setTipoTransaccion(null);
     }
 }
开发者ID:kcornejo,项目名称:usac,代码行数:15,代码来源:BaseTipoTransaccion.php


示例15: removesfGuardUserGroup

 /**
  * @param	sfGuardUserGroup $sfGuardUserGroup The sfGuardUserGroup object to remove.
  */
 public function removesfGuardUserGroup($sfGuardUserGroup)
 {
     if ($this->getsfGuardUserGroups()->contains($sfGuardUserGroup)) {
         $this->collsfGuardUserGroups->remove($this->collsfGuardUserGroups->search($sfGuardUserGroup));
         if (null === $this->sfGuardUserGroupsScheduledForDeletion) {
             $this->sfGuardUserGroupsScheduledForDeletion = clone $this->collsfGuardUserGroups;
             $this->sfGuardUserGroupsScheduledForDeletion->clear();
         }
         $this->sfGuardUserGroupsScheduledForDeletion[] = $sfGuardUserGroup;
         $sfGuardUserGroup->setsfGuardGroup(null);
     }
 }
开发者ID:eddypre,项目名称:Quirofano,代码行数:15,代码来源:BasesfGuardGroup.php


示例16: removeJugadorMesa

 /**
  * @param	JugadorMesa $jugadorMesa The jugadorMesa object to remove.
  */
 public function removeJugadorMesa($jugadorMesa)
 {
     if ($this->getJugadorMesas()->contains($jugadorMesa)) {
         $this->collJugadorMesas->remove($this->collJugadorMesas->search($jugadorMesa));
         if (null === $this->jugadorMesasScheduledForDeletion) {
             $this->jugadorMesasScheduledForDeletion = clone $this->collJugadorMesas;
             $this->jugadorMesasScheduledForDeletion->clear();
         }
         $this->jugadorMesasScheduledForDeletion[] = $jugadorMesa;
         $jugadorMesa->setJugador(null);
     }
 }
开发者ID:kcornejo,项目名称:usac,代码行数:15,代码来源:BaseJugador.php


示例17: removeOrganization

 /**
  * Remove a Organization object to this object
  * through the plugin_organization cross reference table.
  *
  * @param Organization $organization The PluginOrganization object to relate
  * @return Plugin The current object (for fluent API support)
  */
 public function removeOrganization(Organization $organization)
 {
     if ($this->getOrganizations()->contains($organization)) {
         $this->collOrganizations->remove($this->collOrganizations->search($organization));
         if (null === $this->organizationsScheduledForDeletion) {
             $this->organizationsScheduledForDeletion = clone $this->collOrganizations;
             $this->organizationsScheduledForDeletion->clear();
         }
         $this->organizationsScheduledForDeletion[] = $organization;
     }
     return $this;
 }
开发者ID:elaOnMars,项目名称:datawrapper,代码行数:19,代码来源:BasePlugin.php


示例18: removeAfiliado

 /**
  * @param	Afiliado $afiliado The afiliado object to remove.
  */
 public function removeAfiliado($afiliado)
 {
     if ($this->getAfiliados()->contains($afiliado)) {
         $this->collAfiliados->remove($this->collAfiliados->search($afiliado));
         if (null === $this->afiliadosScheduledForDeletion) {
             $this->afiliadosScheduledForDeletion = clone $this->collAfiliados;
             $this->afiliadosScheduledForDeletion->clear();
         }
         $this->afiliadosScheduledForDeletion[] = $afiliado;
         $afiliado->setPlan(null);
     }
 }
开发者ID:nestorfsandoval,项目名称:obraSocialSf,代码行数:15,代码来源:BasePlan.php


示例19: removeState

 /**
  * @param	State $state The state object to remove.
  */
 public function removeState($state)
 {
     if ($this->getStates()->contains($state)) {
         $this->collStates->remove($this->collStates->search($state));
         if (null === $this->statesScheduledForDeletion) {
             $this->statesScheduledForDeletion = clone $this->collStates;
             $this->statesScheduledForDeletion->clear();
         }
         $this->statesScheduledForDeletion[] = $state;
         $state->setCountry(null);
     }
 }
开发者ID:homer6,项目名称:blank_altumo,代码行数:15,代码来源:BaseCountry.php


示例20: removeSystemEventInstanceMessage

 /**
  * @param	SystemEventInstanceMessage $systemEventInstanceMessage The systemEventInstanceMessage object to remove.
  */
 public function removeSystemEventInstanceMessage($systemEventInstanceMessage)
 {
     if ($this->getSystemEventInstanceMessages()->contains($systemEventInstanceMessage)) {
         $this->collSystemEventInstanceMessages->remove($this->collSystemEventInstanceMessages->search($systemEventInstanceMessage));
         if (null === $this->systemEventInstanceMessagesScheduledForDeletion) {
             $this->systemEventInstanceMessagesScheduledForDeletion = clone $this->collSystemEventInstanceMessages;
             $this->systemEventInstanceMessagesScheduledForDeletion->clear();
         }
         $this->systemEventInstanceMessagesScheduledForDeletion[] = $systemEventInstanceMessage;
         $systemEventInstanceMessage->setSystemEventInstance(null);
     }
 }
开发者ID:homer6,项目名称:blank_altumo,代码行数:15,代码来源:BaseSystemEventInstance.php



注:本文中的PropelObjectCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP PropelPDO类代码示例发布时间:2022-05-23
下一篇:
PHP PropelDateTime类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap